TT#56053 Switch from environment variables to a goss variables file

The semantics of the environment variables are different, as they are
always considered strings. The variables file makes it possible to
specify types, given that it's a yaml file. So the SKIP variables
will now be proper booleans.

Change-Id: Ibbc02c047fd743b8bff9a9da52cffd76db5d7524
changes/43/37543/3
Guillem Jover 5 years ago
parent 3fc5629bc6
commit 38264e82c5

@ -83,12 +83,16 @@ case "${NGCP_TESTS_MODE}" in
esac
export DEBIAN_RELEASE
# We need to export these, so that goss sees existent variables.
export SKIP_DNS_CHECK_TEST=${SKIP_DNS_CHECK_TEST:-false}
export SKIP_STRICT_HOSTNAME_TEST=${SKIP_STRICT_HOSTNAME_TEST:-false}
VARS=$(mktemp --tmpdir ngcp-system-tests.XXXXXXXXXX.yaml)
trap 'rm -f "${VARS}"' EXIT
cat >"${VARS}" <<-EOF
SKIP_DNS_CHECK_TEST: ${SKIP_DNS_CHECK_TEST:-false}
SKIP_STRICT_HOSTNAME_TEST: ${SKIP_STRICT_HOSTNAME_TEST:-false}
EOF
PLAN='/etc/ngcp-system-tests/goss.yaml'
goss -g "${PLAN}" validate --format "${NGCP_TESTS_MODE}"
goss --gossfile "${PLAN}" --vars "${VARS}" \
validate --format "${NGCP_TESTS_MODE}"
;;
esac

@ -15,7 +15,7 @@ command:
hostname:
exit-status: 0
{{if ne .Env.SKIP_STRICT_HOSTNAME_TEST "true"}}
{{if .Vars.SKIP_STRICT_HOSTNAME_TEST}}
hostname:
exit-status: 0
stdout:

@ -22,7 +22,7 @@ gossfile:
610_kernel-sysctl-params.yaml: {}
615_kernel-modules.yaml: {}
800_network-hostname.yaml: {}
{{if ne .Env.SKIP_DNS_CHECK_TEST "true"}}
{{if .Vars.SKIP_DNS_CHECK_TEST}}
810_network-dns-debian.yaml: {}
[% IF general.ngcp_type == 'spce' -%]
811_network-dns-ngcp-ce.yaml: {}

Loading…
Cancel
Save