rpm-ostree/tests/compose-tests/test-mutate-os-release.sh
Colin Walters 3e9c6cf230 Fix "releasever" option, test it by default
In #875 AKA b46fc35901 we
added support for the `releasever` option in treefiles.  I am
pretty sure it worked at the time...but I didn't add tests.

Either it never worked or some refactoring broke it. The whole chain of
`GKeyFile` → `GVariant` is so confusing. Anyways fix it by copying the string.
Now let's use it by default in the compose tests, and while we're here bump
those to F27.

I'm doing this patch now as I was playing with doing a compose from
the `/usr/share/rpm-ostree/treefile.json` and wanted to use the stock
`.repo` files.

Closes: #1220
Approved by: jlebon
2018-01-23 15:18:52 +00:00

61 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
set -xeuo pipefail
dn=$(cd $(dirname $0) && pwd)
. ${dn}/libcomposetest.sh
releasever=27
# specifying the key but neither automatic_version_prefix nor
# --add-metadata-string should cause no mutation
prepare_compose_test "mutate-os-release-none"
pysetjsonmember "mutate-os-release" '"'${releasever}'"'
runcompose
echo "ok compose (none)"
ostree --repo=${repobuild} cat ${treeref} \
/usr/lib/os.release.d/os-release-fedora > os-release.prop
assert_file_has_content os-release.prop VERSION_ID=${releasever}
assert_not_file_has_content os-release.prop OSTREE_VERSION=
assert_file_has_content os-release.prop 'VERSION="'${releasever}' (Twenty '
echo "ok mutate-os-release-none"
# make sure --add-metadata-string has precedence and works with
# mutate-os-release
prepare_compose_test "mutate-os-release-cli"
pysetjsonmember "automatic_version_prefix" '"'${releasever}'.555"'
pysetjsonmember "mutate-os-release" '"'${releasever}'"'
runcompose --add-metadata-string=version=${releasever}.444
echo "ok compose (cli)"
ostree --repo=${repobuild} cat ${treeref} \
/usr/lib/os.release.d/os-release-fedora > os-release.prop
# VERSION_ID *shouldn't* change
# (https://github.com/projectatomic/rpm-ostree/pull/433)
assert_file_has_content os-release.prop VERSION_ID=${releasever}
assert_file_has_content os-release.prop OSTREE_VERSION=${releasever}.444
assert_file_has_content os-release.prop 'VERSION="'${releasever}'\.444 (Twenty '
echo "ok mutate-os-release-cli"
# make sure automatic_version_prefix works
prepare_compose_test "mutate-os-release-auto"
pysetjsonmember "automatic_version_prefix" '"'${releasever}'.555"'
pysetjsonmember "mutate-os-release" '"'${releasever}'"'
runcompose
echo "ok compose (auto)"
ostree --repo=${repobuild} cat ${treeref} \
/usr/lib/os.release.d/os-release-fedora > os-release.prop
# VERSION_ID *shouldn't* change
# (https://github.com/projectatomic/rpm-ostree/pull/433)
assert_file_has_content os-release.prop VERSION_ID=${releasever}
assert_file_has_content os-release.prop OSTREE_VERSION=${releasever}.555
assert_file_has_content os-release.prop 'VERSION="'${releasever}'\.555 (Twenty '
echo "ok mutate-os-release (auto)"