rpm-ostree/tests/compose-tests/test-machineid-compat.sh
Jonathan Lebon dce98e4a53 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
2018-08-07 16:00:13 +00:00

30 lines
986 B
Bash
Executable File

#!/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"