From 22bf449296fcc279ea732ee9939f47c3b39ec7b6 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 29 Apr 2020 17:44:03 +0000 Subject: [PATCH] tests: Drain more readonly tests into nondestructive/misc Part of migrating the test suite to kola. --- tests/kola/nondestructive/misc.sh | 23 +++++++++++++++++++++++ tests/vmcheck/test-misc-1.sh | 23 ----------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/tests/kola/nondestructive/misc.sh b/tests/kola/nondestructive/misc.sh index 52b4714c..8ab6c705 100755 --- a/tests/kola/nondestructive/misc.sh +++ b/tests/kola/nondestructive/misc.sh @@ -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" diff --git a/tests/vmcheck/test-misc-1.sh b/tests/vmcheck/test-misc-1.sh index c5f24eaf..aee52e0c 100755 --- a/tests/vmcheck/test-misc-1.sh +++ b/tests/vmcheck/test-misc-1.sh @@ -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