tests: Drain more readonly tests into nondestructive/misc

Part of migrating the test suite to kola.
This commit is contained in:
Colin Walters 2020-04-29 17:44:03 +00:00 committed by OpenShift Merge Robot
parent 11af9c41d3
commit 22bf449296
2 changed files with 23 additions and 23 deletions

View File

@ -4,6 +4,10 @@ set -euo pipefail
. ${KOLA_EXT_DATA}/libtest-core.sh
cd $(mktemp -d)
rpm-ostree status --jsonpath '$.deployments[0].booted' > jsonpath.txt
assert_file_has_content_literal jsonpath.txt 'true'
echo "ok jsonpath"
# Verify operations as non-root
runuser -u core rpm-ostree status
echo "ok status doesn't require root"
@ -23,3 +27,22 @@ rpm-ostree status -b > status.txt
assert_streq $(grep -F -e 'ostree://' status.txt | wc -l) "1"
assert_file_has_content status.txt BootedDeployment:
echo "ok status -b"
if rpm-ostree nosuchcommand --nosuchoption 2>err.txt; then
assert_not_reached "Expected an error for nosuchcommand"
fi
assert_file_has_content err.txt 'Unknown.*command'
echo "ok error on unknown command"
tmprootfs=$(mktemp -d -p /var/tmp)
rpm-ostree coreos-rootfs seal "${tmprootfs}"
lsattr -d "${tmprootfs}" > coreos-rootfs.txt
rpm-ostree coreos-rootfs seal "${tmprootfs}"
assert_file_has_content coreos-rootfs.txt '-*i-* '"${tmprootfs}"
chattr -i "${tmprootfs}"
rm -rf "${tmprootfs}" coreos-rootfs.txt
echo "ok coreos-rootfs seal"
# Reload as root https://github.com/projectatomic/rpm-ostree/issues/976
rpm-ostree reload
echo "ok reload"

View File

@ -51,9 +51,6 @@ vm_assert_status_jq \
'.deployments[0]["layered-commit-meta"]|not'
echo "ok empty pkg arrays, and commit meta correct in status json"
vm_rpmostree status --jsonpath '$.deployments[0].booted' > jsonpath.txt
assert_file_has_content_literal jsonpath.txt 'true'
echo "ok jsonpath"
vm_rpmostree --version > version.yaml
python3 -c 'import yaml; v=yaml.safe_load(open("version.yaml")); assert("Version" in v["rpm-ostree"])'
@ -68,12 +65,6 @@ while read command; do
done < commands
echo "ok error on unknown command options"
if vm_rpmostree nosuchcommand --nosuchoption 2>err.txt; then
assert_not_reached "Expected an error for nosuchcommand"
fi
assert_file_has_content err.txt 'Unknown.*command'
echo "ok error on unknown command"
# Make sure we can't do various operations as non-root
vm_build_rpm foo
if vm_cmd_as core rpm-ostree pkg-add foo &> err.txt; then
@ -108,20 +99,6 @@ else
echo "Missing ${wrapdir}; cliwrap not enabled"
fi
# Test coreos-rootfs
vm_shell_inline > coreos-rootfs.txt << EOF
mkdir /var/tmp/coreos-rootfs
rpm-ostree coreos-rootfs seal /var/tmp/coreos-rootfs
lsattr -d /var/tmp/coreos-rootfs
rpm-ostree coreos-rootfs seal /var/tmp/coreos-rootfs
EOF
assert_file_has_content coreos-rootfs.txt '-*i-* /var/tmp/coreos-rootfs'
# Reload as root https://github.com/projectatomic/rpm-ostree/issues/976
vm_cmd rpm-ostree reload
echo "ok reload"
stateroot=$(vm_get_booted_stateroot)
ospath=/org/projectatomic/rpmostree1/${stateroot//-/_}
# related: https://github.com/coreos/fedora-coreos-config/issues/194