From 82fa60a81f072777168de2fd0d526879b8bc9999 Mon Sep 17 00:00:00 2001 From: Tim Kimber Date: Mon, 24 Aug 2020 18:34:58 +0100 Subject: [PATCH] Fix tests for old nginx --- test/6-dual-rsa-ecdsa-copy-2-locations.bats | 6 ++++-- test/test_helper.bash | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/6-dual-rsa-ecdsa-copy-2-locations.bats b/test/6-dual-rsa-ecdsa-copy-2-locations.bats index 593d770..6f75f25 100644 --- a/test/6-dual-rsa-ecdsa-copy-2-locations.bats +++ b/test/6-dual-rsa-ecdsa-copy-2-locations.bats @@ -40,8 +40,10 @@ teardown() { create_certificate assert_success check_output_for_errors - assert_line --partial "rsa certificate installed OK on server" - assert_line --partial "prime256v1 certificate installed OK on server" + if [ "$OLD_NGINX" = "false" ]; then + assert_line --partial "rsa certificate installed OK on server" + assert_line --partial "prime256v1 certificate installed OK on server" + fi # Check that the RSA chain and key have been copied to both locations assert [ -e "/etc/nginx/pki/domain-chain.crt" ] diff --git a/test/test_helper.bash b/test/test_helper.bash index d498f93..db79ea4 100644 --- a/test/test_helper.bash +++ b/test/test_helper.bash @@ -12,7 +12,7 @@ check_certificates() # https://unix.stackexchange.com/questions/285924/how-to-compare-a-programs-version-in-a-shell-script check_nginx() { requiredver="1.11.0" - currentver=$(nginx -v 2>&1) + currentver=$(nginx -v 2>&1 | awk -F"/" '{print $2}') if [ "$(printf '%s\n' "$requiredver" "$currentver" | sort -V | head -n1)" = "$requiredver" ]; then export OLD_NGINX="false" else