diff --git a/tests/clean-image.sh b/tests/clean-image.sh index 8ce4cd8..b1a031a 100755 --- a/tests/clean-image.sh +++ b/tests/clean-image.sh @@ -1,12 +1,23 @@ #!/bin/bash -eux image=$1 +if [ "$image" == "wordpress" ] || [ "$image" == "known" ]; then + systemctl stop lamp@$image.test + sleep 15 +else + systemctl stop $image@$image.test +fi -systemctl stop *@$image.test.timer -systemctl stop *@$image.test -systemctl reset-failed systemctl list-units | grep -c "$image\.test" | grep 0 rm -rf /data/import/$image.test rm -rf /data/runtime/domains/$image.test rm -rf /data/domains/$image.test -systemctl disable $image@$image.test +systemctl stop *@$image.test.timer +systemctl stop *@$image.test +systemctl reset-failed +if [ "$image" == "wordpress" ] || [ "$image" == "known" ]; then + systemctl disable lamp@$image.test +else + systemctl disable $image@$image.test +fi +systemctl list-units | grep -c "$image\.test" | grep 0 diff --git a/tests/image.sh b/tests/image.sh index 63d04bf..dec908e 100755 --- a/tests/image.sh +++ b/tests/image.sh @@ -7,13 +7,17 @@ image=$1 # prepare data mkdir -p /data/import/$image.test/TLS cp /data/indiehosters/scripts/unsecure-certs/example.dev.pem /data/import/$image.test/TLS/$image.test.pem -if [ "$image" == "staticgit" ]; then - mkdir -p /data/import/$image.test/static-git - echo "https://github.com/indiehosters/website.git" > /data/import/$image.test/static-git/GITURL +echo "APPLICATION=$image" > /data/import/$image.test/.env +if [ "$image" == "wordpress" ] || [ "$image" == "known" ]; then + echo "VOLUME=$(cat /data/indiehosters/dockerfiles/services/$image/VOLUME)" >> /data/import/$image.test/.env fi # start image from import -systemctl start $image@$image.test +if [ "$image" == "wordpress" ] || [ "$image" == "known" ]; then + systemctl start lamp@$image.test +else + systemctl start $image@$image.test +fi # tests /data/indiehosters/tests/test-image.sh $image @@ -22,8 +26,13 @@ systemctl start $image@$image.test ## make sure to backup first systemctl start backup@$image.test /data/indiehosters/tests/clean-image.sh $image -systemctl enable $image@$image.test -systemctl start $image@$image.test +if [ "$image" == "wordpress" ] || [ "$image" == "known" ]; then + systemctl enable lamp@$image.test + systemctl start lamp@$image.test +else + systemctl enable $image@$image.test + systemctl start $image@$image.test +fi # tests /data/indiehosters/tests/test-image.sh $image diff --git a/tests/test-image.sh b/tests/test-image.sh index ee91f9b..40b3786 100755 --- a/tests/test-image.sh +++ b/tests/test-image.sh @@ -9,5 +9,5 @@ else fi systemctl list-units | grep "$image\.test" | grep -c failed | grep 0 -ip=`docker inspect --format {{.NetworkSettings.IPAddress}} $image-$image.test` +ip=`docker inspect --format {{.NetworkSettings.IPAddress}} $image.test` curl -L $ip