tests/compose: Split out machineid-compat test

My fix to the testsuite in #1488 in which I made the `machineid-compat`
test part of `test-basic.sh` wasn't correct since the basic tests in
`libbasic-test.sh` also check that the default behaviour without the
`machineid-compat` option is to include it.

Let's just do this right and split out the `machineid-compat` test into
its own run.

Closes: #1491
Approved by: cgwalters
This commit is contained in:
Jonathan Lebon 2018-08-07 10:46:47 -04:00 committed by Atomic Bot
parent 391a684b5f
commit dce98e4a53
2 changed files with 29 additions and 6 deletions

View File

@ -16,7 +16,6 @@ cat > metadata.json <<EOF
"exampleos.tests": ["smoketested", "e2e"]
}
EOF
pysetjsonmember "machineid-compat" 'False'
runcompose --add-metadata-from-json metadata.json
. ${dn}/libbasic-test.sh
@ -34,11 +33,6 @@ echo "ok autovar"
ostree --repo=${repobuild} cat ${treeref} /usr/lib/systemd/system-preset/40-rpm-ostree-auto.preset > preset.txt
assert_file_has_content preset.txt '^enable ostree-remount.service$'
# https://github.com/projectatomic/rpm-ostree/pull/1425
ostree --repo=${repobuild} ls ${treeref} /usr/etc > ls.txt
assert_not_file_has_content ls.txt 'machine-id'
echo "ok machine-id"
if ! rpm-ostree --version | grep -q rust; then
echo "ok yaml (SKIP)"
else

View File

@ -0,0 +1,29 @@
#!/bin/bash
set -xeuo pipefail
dn=$(cd $(dirname $0) && pwd)
. ${dn}/libcomposetest.sh
# Test that `units` and `machineid-compat: False` conflict
prepare_compose_test "machineid-compat-conflict"
pysetjsonmember "machineid-compat" 'False'
pysetjsonmember "units" '["tuned.service"]'
# Do the compose -- we call compose directly because `set -e` has no effect when
# calling functions within an if condition context
if rpm-ostree compose tree ${compose_base_argv} ${treefile} |& tee err.txt; then
assert_not_reached err.txt "Successfully composed with units and machineid-compat=False?"
fi
assert_file_has_content_literal err.txt \
"'units' directive is incompatible with machineid-compat = false"
echo "ok conflict with units"
prepare_compose_test "machineid-compat"
pysetjsonmember "machineid-compat" 'False'
runcompose
echo "ok compose"
ostree --repo=${repobuild} ls ${treeref} /usr/etc > ls.txt
assert_not_file_has_content ls.txt 'machine-id'
echo "ok machineid-compat"