tests: Update submodules for bats (#2715)

* tests: Update testing submodules (bats-assert, bats-support)
These two submodules were migrated to the `bats-core` organization, where they continued to receive updates.

* tests: Use tagged release of `bats-core/bats-support`
This is technically one commit backwards, but no relevant difference has been made since, other than moving the submodule to the `bats-core` organization.

* tests: Bump `bats-assert` to August 2022 (master)
No official release tag since Nov 2018, but a fair amount of changes since then.

* tests: Bump `bats-core` to `v1.7.0` release

* tests(fix): Correctly use assertions
Some tests were updated as the upgrade of bats submodules had `assert` methods raise awareness of incorrect usage.
This additionally revealed some existing tests that weren't meant to be using `run`, which swallowed failures from surfacing.
This commit is contained in:
Brennan Kinney 2022-08-12 11:09:17 +12:00 committed by GitHub
parent 2d0f5a0791
commit 0d5f550bdf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 19 deletions

4
.gitmodules vendored
View file

@ -3,10 +3,10 @@
url = https://github.com/bats-core/bats-core.git url = https://github.com/bats-core/bats-core.git
[submodule "test/test_helper/bats-support"] [submodule "test/test_helper/bats-support"]
path = test/test_helper/bats-support path = test/test_helper/bats-support
url = https://github.com/ztombol/bats-support url = https://github.com/bats-core/bats-support
[submodule "test/test_helper/bats-assert"] [submodule "test/test_helper/bats-assert"]
path = test/test_helper/bats-assert path = test/test_helper/bats-assert
url = https://github.com/ztombol/bats-assert url = https://github.com/bats-core/bats-assert
[submodule "target/docker-configomat"] [submodule "target/docker-configomat"]
path = target/docker-configomat path = target/docker-configomat
url = https://github.com/alinmear/docker-configomat url = https://github.com/alinmear/docker-configomat

@ -1 +1 @@
Subproject commit 54e965fa9d269c2b3ff9036d81f32bac3df0edea Subproject commit 410dd229a5ed005c68167cc90ed0712ad2a1c909

View file

@ -31,14 +31,12 @@ function teardown_file() {
@test "checking setup.sh: setup.sh email add and login" { @test "checking setup.sh: setup.sh email add and login" {
wait_for_service "${TEST_NAME}" changedetector wait_for_service "${TEST_NAME}" changedetector
assert_success
run ./setup.sh -c "${TEST_NAME}" email add setup_email_add@example.com test_password run ./setup.sh -c "${TEST_NAME}" email add setup_email_add@example.com test_password
assert_success assert_success
value=$(grep setup_email_add@example.com "${TEST_TMP_CONFIG}/postfix-accounts.cf" | awk -F '|' '{print $1}') value=$(grep setup_email_add@example.com "${TEST_TMP_CONFIG}/postfix-accounts.cf" | awk -F '|' '{print $1}')
[[ ${value} == "setup_email_add@example.com" ]] assert_equal "${value}" 'setup_email_add@example.com'
assert_success
wait_for_changes_to_be_detected_in_container "${TEST_NAME}" wait_for_changes_to_be_detected_in_container "${TEST_NAME}"
@ -60,8 +58,7 @@ function teardown_file() {
assert_success assert_success
initialpass=$(grep lorem@impsum.org "${TEST_TMP_CONFIG}/postfix-accounts.cf" | awk -F '|' '{print $2}') initialpass=$(grep lorem@impsum.org "${TEST_TMP_CONFIG}/postfix-accounts.cf" | awk -F '|' '{print $2}')
[[ ${initialpass} != "" ]] [[ -n ${initialpass} ]]
assert_success
run ./setup.sh -c "${TEST_NAME}" email update lorem@impsum.org my password run ./setup.sh -c "${TEST_NAME}" email update lorem@impsum.org my password
assert_success assert_success
@ -70,8 +67,8 @@ function teardown_file() {
[[ ${updatepass} != "" ]] [[ ${updatepass} != "" ]]
[[ ${initialpass} != "${updatepass}" ]] [[ ${initialpass} != "${updatepass}" ]]
docker exec "${TEST_NAME}" doveadm pw -t "${updatepass}" -p 'my password' | grep 'verified' run docker exec "${TEST_NAME}" doveadm pw -t "${updatepass}" -p 'my password'
assert_success assert_output --partial 'verified'
} }
@test "checking setup.sh: setup.sh email del" { @test "checking setup.sh: setup.sh email del" {
@ -151,8 +148,8 @@ function teardown_file() {
# quota # quota
@test "checking setup.sh: setup.sh setquota" { @test "checking setup.sh: setup.sh setquota" {
run ./setup.sh -c "${TEST_NAME}" email add quota_user@example.com test_password ./setup.sh -c "${TEST_NAME}" email add quota_user@example.com test_password
run ./setup.sh -c "${TEST_NAME}" email add quota_user2@example.com test_password ./setup.sh -c "${TEST_NAME}" email add quota_user2@example.com test_password
run ./setup.sh -c "${TEST_NAME}" quota set quota_user@example.com 12M run ./setup.sh -c "${TEST_NAME}" quota set quota_user@example.com 12M
assert_success assert_success
@ -176,10 +173,8 @@ function teardown_file() {
assert_failure assert_failure
} }
# `quota_user@example.com` created in previous `setquota` test
@test "checking setup.sh: setup.sh delquota" { @test "checking setup.sh: setup.sh delquota" {
run ./setup.sh -c "${TEST_NAME}" email add quota_user@example.com test_password
run ./setup.sh -c "${TEST_NAME}" email add quota_user2@example.com test_password
run ./setup.sh -c "${TEST_NAME}" quota set quota_user@example.com 12M run ./setup.sh -c "${TEST_NAME}" quota set quota_user@example.com 12M
assert_success assert_success
run /bin/sh -c "cat ${TEST_TMP_CONFIG}/dovecot-quotas.cf | grep -E '^quota_user@example.com\:12M\$' | wc -l | grep 1" run /bin/sh -c "cat ${TEST_TMP_CONFIG}/dovecot-quotas.cf | grep -E '^quota_user@example.com\:12M\$' | wc -l | grep 1"

@ -1 +1 @@
Subproject commit 9f88b4207da750093baabc4e3f41bf68f0dd3630 Subproject commit ffe84ea5dd43b568851549b3e241db150c12929c

@ -1 +1 @@
Subproject commit 004e707638eedd62e0481e8cdc9223ad471f12ee Subproject commit 24a72e14349690bcbf7c151b9d2d1cdd32d36eb1

View file

@ -649,8 +649,7 @@ EOF
[[ ${initialpass} != "${changepass}" ]] [[ ${initialpass} != "${changepass}" ]]
docker exec mail /bin/sh -c "delmailuser -y auser3@domain.tld" run docker exec mail /bin/sh -c "delmailuser -y auser3@domain.tld"
assert_success assert_success
} }