From 02ae15a8b33939bbd94d1f919eb4f9a88a614aee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sara=20Aim=C3=A9e=20Smiseth?= <51710585+SaraSmiseth@users.noreply.github.com> Date: Fri, 7 May 2021 13:02:43 +0200 Subject: [PATCH] Add tests that check if postgres or sqlite is used. --- tests/bats/bats-assert | 2 +- tests/bats/bats-core | 2 +- tests/test.bash | 3 ++- tests/tests-prosody.bats | 10 ++++++++++ tests/tests-prosody_postgres.bats | 10 ++++++++++ 5 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 tests/tests-prosody.bats create mode 100644 tests/tests-prosody_postgres.bats diff --git a/tests/bats/bats-assert b/tests/bats/bats-assert index 0a8dd57..e0de84e 160000 --- a/tests/bats/bats-assert +++ b/tests/bats/bats-assert @@ -1 +1 @@ -Subproject commit 0a8dd57e2cc6d4cc064b1ed6b4e79b9f7fee096f +Subproject commit e0de84e9c011223e7f88b7ccf1c929f4327097ba diff --git a/tests/bats/bats-core b/tests/bats/bats-core index 8fb853a..49b377a 160000 --- a/tests/bats/bats-core +++ b/tests/bats/bats-core @@ -1 +1 @@ -Subproject commit 8fb853a6cbc0169958707381985f3cd59789ccb1 +Subproject commit 49b377a751e6f9379abfdfb3dfa3aafabd8495a1 diff --git a/tests/test.bash b/tests/test.bash index 34c0f71..7b1e436 100755 --- a/tests/test.bash +++ b/tests/test.bash @@ -43,7 +43,8 @@ runTests() { && sleep 5 \ && sudo docker-compose logs "$containerName" \ && export batsContainerName="$containerName" \ - && ./bats/bats-core/bin/bats tests.bats + && ./bats/bats-core/bin/bats tests.bats \ + && ./bats/bats-core/bin/bats tests-"$containerName".bats } generateCert "localhost" diff --git a/tests/tests-prosody.bats b/tests/tests-prosody.bats new file mode 100644 index 0000000..74ddc22 --- /dev/null +++ b/tests/tests-prosody.bats @@ -0,0 +1,10 @@ +# For tests with pipes see: https://github.com/sstephenson/bats/issues/10 + +load 'bats/bats-support/load' +load 'bats/bats-assert/load' + +@test "Should use sqlite" { + run bash -c "sudo docker-compose logs $batsContainerName | grep -E \"Connecting to \[SQLite3\] \/usr\/local\/var\/lib\/prosody\/prosody\.sqlite\.\.\.\"" + assert_success + assert_output +} diff --git a/tests/tests-prosody_postgres.bats b/tests/tests-prosody_postgres.bats new file mode 100644 index 0000000..2a1d1d0 --- /dev/null +++ b/tests/tests-prosody_postgres.bats @@ -0,0 +1,10 @@ +# For tests with pipes see: https://github.com/sstephenson/bats/issues/10 + +load 'bats/bats-support/load' +load 'bats/bats-assert/load' + +@test "Should use postgres" { + run bash -c "sudo docker-compose logs $batsContainerName | grep -E \"Connecting to \[PostgreSQL\] prosody\.\.\.\"" + assert_success + assert_output +}