Skip to content

Commit

Permalink
test: add script to run tests for all supported uptime kuma versions
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasheld committed Oct 6, 2022
1 parent 6f9490b commit 3528b66
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/sh

collection_path="$HOME/.ansible/collections/ansible_collections/lucasheld/uptime_kuma"
version="$1"

if [ ! -d "$collection_path" ]
then
ansible-galaxy collection install git+https://github.com/lucasheld/ansible-uptime-kuma.git
fi
cp -r ./{plugins,tests} "$collection_path"
cd "$collection_path"

if [ $version ]
then
versions="$version"
else
versions="1.18.2 1.17.1"
fi

for version in $versions
do
docker rm -f uptimekuma > /dev/null 2>&1

echo "Starting uptime kuma $version..."
docker run -d -it --rm -p 3001:3001 --name uptimekuma "louislam/uptime-kuma:$version" > /dev/null || exit 1

while [[ "$(curl -s -L -o /dev/null -w ''%{http_code}'' 127.0.0.1:3001)" != "200" ]]
do
sleep 0.5
done

echo "Running tests..."
ansible-test units --target-python default --num-workers 1

echo "Stopping uptime kuma..."
docker stop uptimekuma > /dev/null

echo ''
done

0 comments on commit 3528b66

Please sign in to comment.