From 8b3a17c54aa2ecba8bcc226c04efc4d6910caeb4 Mon Sep 17 00:00:00 2001 From: Jonathan Crooke Date: Wed, 13 Nov 2019 12:08:44 +0100 Subject: [PATCH] Add -test container suffix --- hooks/test | 2 +- test/bats/helpers.bash | 2 +- test/bats/no-ispconfig-ssl.sh | 6 +++--- test/bats/reconfigure.sh | 10 +++++----- test/bats/tests.sh | 2 +- test/default/ispconfig.test.js | 2 +- test/docker-compose.bats.custom-ssl.test.yml | 5 +++-- test/docker-compose.bats.no-ispconfig-ssl.test.yml | 5 +++-- test/docker-compose.bats.reconfigure.test.yml | 5 +++-- test/docker-compose.bats.test.yml | 5 +++-- test/docker-compose.puppeteer.no-phpmyadmin.test.yml | 5 +++-- .../docker-compose.puppeteer.remote-db-seeded.test.yml | 6 +++--- test/docker-compose.puppeteer.remote-db.test.yml | 6 +++--- test/docker-compose.puppeteer.test.yml | 4 ++-- test/no-phpmyadmin/phpmyadmin.test.js | 4 ++-- test/remote-db/ispconfig.test.js | 2 +- 16 files changed, 38 insertions(+), 33 deletions(-) diff --git a/hooks/test b/hooks/test index cef0609..ef16f8d 100755 --- a/hooks/test +++ b/hooks/test @@ -13,7 +13,7 @@ function buildAndTest() { fi DOWN="docker-compose -f test/$YML down -v" - CMD="docker-compose -f test/$YML up --no-build --abort-on-container-exit sut" + CMD="docker-compose -f test/$YML up --no-build --abort-on-container-exit --force-recreate --remove-orphans sut" if ! $CMD; then echo "Failed: \"$CMD\"" $DOWN &> /dev/null || true diff --git a/test/bats/helpers.bash b/test/bats/helpers.bash index b66d82a..e3194fc 100644 --- a/test/bats/helpers.bash +++ b/test/bats/helpers.bash @@ -1,6 +1,6 @@ #!/usr/bin/env bats -export CONTAINER="ispconfig" +export CONTAINER="ispconfig-test" export TIMEOUT=10 function waitForPort() { diff --git a/test/bats/no-ispconfig-ssl.sh b/test/bats/no-ispconfig-ssl.sh index 45fbf0a..5eae5c0 100755 --- a/test/bats/no-ispconfig-ssl.sh +++ b/test/bats/no-ispconfig-ssl.sh @@ -12,13 +12,13 @@ setup() { } @test "ISPConfig at expected HTTP URL" { - curl -sL "http://ispconfig:8080" | grep "ISPConfig" + curl -sL "http://$CONTAINER:8080" | grep "ISPConfig" } @test "phpMyAdmin at expected HTTP URL" { - curl -sL "http://ispconfig:8080/phpmyadmin" | grep "phpMyAdmin" + curl -sL "http://$CONTAINER:8080/phpmyadmin" | grep "phpMyAdmin" } @test "ISPConfig at expected HTTP URL" { - curl -sL "http://ispconfig:8080/webmail" | grep "Roundcube Webmail :: Welcome to Roundcube Webmail" + curl -sL "http://$CONTAINER:8080/webmail" | grep "Roundcube Webmail :: Welcome to Roundcube Webmail" } diff --git a/test/bats/reconfigure.sh b/test/bats/reconfigure.sh index 7146a5f..c2782ca 100755 --- a/test/bats/reconfigure.sh +++ b/test/bats/reconfigure.sh @@ -9,18 +9,18 @@ setup() { } @test "services have been reconfigured to MYSQL_HOST" { - docker exec ispconfig grep "^\$conf\['db_host'\] = '0.0.0.0';$" /usr/local/ispconfig/interface/lib/config.inc.php - docker exec ispconfig grep "^\$dbserver='0.0.0.0';$" /etc/phpmyadmin/config-db.php - docker exec ispconfig grep "^\$config\['db_dsnw'\] = 'mysql://roundcube:secretpassword@0.0.0.0/roundcube';$" /opt/roundcube/config/config.inc.php + docker exec "$CONTAINER" grep "^\$conf\['db_host'\] = '0.0.0.0';$" /usr/local/ispconfig/interface/lib/config.inc.php + docker exec "$CONTAINER" grep "^\$dbserver='0.0.0.0';$" /etc/phpmyadmin/config-db.php + docker exec "$CONTAINER" grep "^\$config\['db_dsnw'\] = 'mysql://roundcube:secretpassword@0.0.0.0/roundcube';$" /opt/roundcube/config/config.inc.php } @test "ispconfig database connection" { # The logo is stored in the database - curl -Lk "https://ispconfig:8080" | grep -E ' { it('should not be available', async () => { try { - await page.goto('https://ispconfig:8080/phpmyadmin'); + await page.goto('https://' + host + '/phpmyadmin'); throw new Error("phpMyAdmin interface loaded, but it should not be available"); } catch (error) { // should fail diff --git a/test/remote-db/ispconfig.test.js b/test/remote-db/ispconfig.test.js index 9f249b3..4ba47bf 100644 --- a/test/remote-db/ispconfig.test.js +++ b/test/remote-db/ispconfig.test.js @@ -1,5 +1,5 @@ const puppeteer = require('puppeteer'); -const host = "ispconfig:8080"; +const host = "ispconfig-test:8080"; const timeout = 30 * 1000; jasmine.DEFAULT_TIMEOUT_INTERVAL = timeout;