rpm-ostree/tests/compose-tests/test-machineid-compat.sh
Colin Walters 3d60a31aaa Fix include: with machineid-compat and a few other keys
It turns out we basically have to slap an `Option<T>` around
everything, (in particular `bool` etc.) we need to be able
to distinguish in (I believe) all the cases between
"value unspecified" and "value provided".

Concretely it didn't work to try to set `machineid-compat: false`
in an included yaml treefile becuase it was just defaulted to `true`
by the toplevel.

Down the line we should move all of the parsing into Rust
and have two different `struct` types for "YAML we load" versus
"verified treefile".

Closes: https://github.com/projectatomic/rpm-ostree/issues/1524

Closes: #1525
Approved by: lucab
2018-08-29 12:59:34 +00:00

36 lines
1.2 KiB
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"
# In this test we also want to test that include:
# correctly handles machineid-compat.
prepare_compose_test "machineid-compat"
pysetjsonmember "machineid-compat" 'False'
cat > composedata/fedora-machineid-compat-includer.yaml <<EOF
include: fedora-machineid-compat.json
EOF
export treefile=composedata/fedora-machineid-compat-includer.yaml
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"