From 7ed7202c67b5f8cd04769e4d63b922fded310a3a Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 29 Dec 2018 04:16:58 -0500 Subject: [PATCH] tests: switch to bats-core This switches from the older, unmaintained version of bats to one that _is_ maintained. In particular, this fork of the community version - bats-core/bats-core - adds junit timing support, which can be used to track down slow tests. Once the bats-core/bats-core repository merges junit support, we will switch back to upstream. Note that tests on OS X will still run using a version that _does not_ have junit timing support. --- tests.mk | 8 ++++---- tests/unit/10_certs.bats | 4 ++-- tests/unit/10_ps-dockerfile.bats | 2 +- tests/unit/10_ps-herokuish.bats | 17 +++++++++++------ tests/unit/40_nginx-vhosts_2.bats | 6 +++--- 5 files changed, 21 insertions(+), 16 deletions(-) diff --git a/tests.mk b/tests.mk index 8eb1eaa7d..3acc43968 100644 --- a/tests.mk +++ b/tests.mk @@ -58,15 +58,15 @@ ifeq ($(shell grep dokku.me /home/dokku/VHOST 2>/dev/null),) endif bats: -ifneq ($(shell bats --version > /dev/null 2>&1 ; echo $$?),0) ifeq ($(SYSTEM),Darwin) - brew install bats +ifneq ($(shell bats --version > /dev/null 2>&1 ; echo $$?),0) + brew install bats-core +endif else - git clone https://github.com/sstephenson/bats.git /tmp/bats + git clone https://github.com/josegonzalez/bats-core.git /tmp/bats cd /tmp/bats && sudo ./install.sh /usr/local rm -rf /tmp/bats endif -endif lint: # these are disabled due to their expansive existence in the codebase. we should clean it up though diff --git a/tests/unit/10_certs.bats b/tests/unit/10_certs.bats index 2d5d1507a..4335ff832 100644 --- a/tests/unit/10_certs.bats +++ b/tests/unit/10_certs.bats @@ -41,14 +41,14 @@ teardown() { assert_success } -@test "(certs) certs:add < tar" { +@test "(certs) certs:add tar:in" { run /bin/bash -c "dokku certs:add $TEST_APP < $BATS_TEST_DIRNAME/server_ssl.tar" echo "output: $output" echo "status: $status" assert_success } -@test "(certs) certs:add < tar should ignore OSX hidden files" { +@test "(certs) certs:add tar:in should ignore OSX hidden files" { run /bin/bash -c "dokku certs:add $TEST_APP < $BATS_TEST_DIRNAME/osx_ssl_tarred.tar" echo "output: $output" echo "status: $status" diff --git a/tests/unit/10_ps-dockerfile.bats b/tests/unit/10_ps-dockerfile.bats index 9a1266140..3101dc6b0 100644 --- a/tests/unit/10_ps-dockerfile.bats +++ b/tests/unit/10_ps-dockerfile.bats @@ -12,7 +12,7 @@ teardown() { global_teardown } -# @test "(ps) dockerfile" { +# @test "(ps) dockerfile base" { # # CI support: 'Ah. I just spoke with our Docker expert -- # # looks like docker exec is built to work with docker-under-libcontainer, # # but we're using docker-under-lxc. I don't have an estimated time for the fix, sorry diff --git a/tests/unit/10_ps-herokuish.bats b/tests/unit/10_ps-herokuish.bats index b9fec3ff0..8fc613441 100644 --- a/tests/unit/10_ps-herokuish.bats +++ b/tests/unit/10_ps-herokuish.bats @@ -13,12 +13,17 @@ teardown() { global_teardown } -@test "(ps) herokuish" { - run /bin/bash -c "dokku ps $TEST_APP | grep -q \"node web.js\"" - echo "output: $output" - echo "status: $status" - assert_success -} +# @test "(ps) herokuish base" { +# # CI support: 'Ah. I just spoke with our Docker expert -- +# # looks like docker exec is built to work with docker-under-libcontainer, +# # but we're using docker-under-lxc. I don't have an estimated time for the fix, sorry +# skip "circleci does not support docker exec at the moment." +# deploy_app +# run /bin/bash -c "dokku ps $TEST_APP | grep -q \"node web.js\"" +# echo "output: $output" +# echo "status: $status" +# assert_success +# } @test "(ps) herokuish" { deploy_app diff --git a/tests/unit/40_nginx-vhosts_2.bats b/tests/unit/40_nginx-vhosts_2.bats index 52420d940..40b041585 100644 --- a/tests/unit/40_nginx-vhosts_2.bats +++ b/tests/unit/40_nginx-vhosts_2.bats @@ -43,7 +43,7 @@ assert_error_log() { assert_error_log ${TEST_APP} } -@test "(nginx-vhosts) nginx:build-config (with SSL & unrelated domain)" { +@test "(nginx-vhosts) nginx:build-config (with SSL and unrelated domain)" { setup_test_tls add_domain "node-js-app.dokku.me" add_domain "test.dokku.me" @@ -62,7 +62,7 @@ assert_error_log() { assert_ssl_domain "wildcard2.dokku.me" } -@test "(nginx-vhosts) nginx:build-config (wildcard SSL & unrelated domain)" { +@test "(nginx-vhosts) nginx:build-config (wildcard SSL and unrelated domain)" { destroy_app TEST_APP="${TEST_APP}.example.com" setup_test_tls wildcard @@ -82,7 +82,7 @@ assert_error_log() { assert_ssl_domain "www.test.app.dokku.me" } -@test "(nginx-vhosts) nginx:build-config (wildcard SSL & custom nginx template)" { +@test "(nginx-vhosts) nginx:build-config (wildcard SSL and custom nginx template)" { setup_test_tls wildcard add_domain "wildcard1.dokku.me" add_domain "wildcard2.dokku.me"