9daea46d66
Again, a lot going on here, but essentially, we adapt the compose tests to run either privileged or fully unprivileged via supermin, just like cosa. I actually got more than halfway through this initially using `cosa build` directly for testing. But in the end, we simply need more flexibility than that. We want to be able to manipulate exactly how rpm-ostree is called, and cosa is very opinionated about this (and may also change from under us in the future). (Another big difference for example is that cosa doesn't care about non-unified mode, whereas we *need* to have coverage for this until we fully kill it.) Really, the most important bit we want from there is the unprivileged-via-supermin bits. So we copy and adapt that here. One obvious improvement then is sharing this code more easily (e.g. a `cosa runasroot` or something?) However, we still use the FCOS manifest (frozen at a specific tag). It's a realistic example, and because of the lockfiles and pool, we get good reproducibility.
42 lines
1.6 KiB
Bash
Executable File
42 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
set -xeuo pipefail
|
|
|
|
dn=$(cd "$(dirname "$0")" && pwd)
|
|
# shellcheck source=libcomposetest.sh
|
|
. "${dn}/libcomposetest.sh"
|
|
|
|
treefile_set "install-langs" '["fr", "fr_FR", "en_US"]'
|
|
treefile_set "postprocess-script" "'$PWD/lang-test.sh'"
|
|
cat > lang-test.sh << EOF
|
|
#!/bin/bash
|
|
set -xeuo pipefail
|
|
env LANG=fr_FR.UTF-8 date -ud @0 &> /etc/lang-test.date.txt
|
|
(env LANG=fr_FR.UTF-8 touch || :) &> /etc/lang-test.touch.txt
|
|
env LANG=de_DE.UTF-8 date -ud @0 &> /etc/lang-test.de.date.txt
|
|
(env LANG=de_DE.UTF-8 touch || :) &> /etc/lang-test.de.touch.txt
|
|
EOF
|
|
chmod a+x lang-test.sh
|
|
runcompose
|
|
echo "ok compose"
|
|
|
|
ostree --repo=${repo} cat ${treeref} /usr/etc/lang-test.date.txt > out.txt
|
|
assert_file_has_content out.txt 'jeu\. janv\. 1 00:00:00 UTC 1970'
|
|
ostree --repo=${repo} cat ${treeref} /usr/etc/lang-test.touch.txt > out.txt
|
|
assert_file_has_content out.txt 'opérande de fichier manquant'
|
|
|
|
# XXX: this test doesn't currently work since glibc no longer obeys install-langs:
|
|
# https://github.com/coreos/fedora-coreos-config/issues/194#issuecomment-556365516
|
|
|
|
# # check that de_DE was culled
|
|
# ostree --repo=${repo} cat ${treeref} /usr/etc/lang-test.de.date.txt > out.txt
|
|
# assert_file_has_content out.txt 'Thu Jan 1 00:00:00 UTC 1970'
|
|
# ostree --repo=${repo} cat ${treeref} /usr/etc/lang-test.de.touch.txt > out.txt
|
|
# assert_file_has_content out.txt 'missing file operand'
|
|
|
|
if ostree --repo=${repo} ls ${treeref} /usr/bin/rpmostree-postprocess-lang-test.sh 2>err.txt; then
|
|
assert_not_reached "we failed to unlink?"
|
|
fi
|
|
assert_file_has_content err.txt "error: No such file or directory"
|
|
|
|
echo "ok install-langs"
|