[PATCH] Change how success is checked for the basic-ostree test.

Chris Lumens clumens at redhat.com
Mon Aug 10 14:14:42 UTC 2015


The reboot test is flawed because the actual location of /root/RESULT may
move around.  We can't count on its location always being the same.  Also,
rebooting doesn't really test anaconda in any way.  It also tests that dracut
and everything else works right, which is more than we need.  Those things
may fail while anaconda itself still performed the install correctly.
---
 tests/kickstart_tests/basic-ostree.ks | 23 +++--------------------
 tests/kickstart_tests/basic-ostree.sh | 28 ----------------------------
 2 files changed, 3 insertions(+), 48 deletions(-)

diff --git a/tests/kickstart_tests/basic-ostree.ks b/tests/kickstart_tests/basic-ostree.ks
index 63b6dae..9fe1509 100644
--- a/tests/kickstart_tests/basic-ostree.ks
+++ b/tests/kickstart_tests/basic-ostree.ks
@@ -14,24 +14,7 @@ timezone America/New_York
 rootpw qweqwe
 shutdown
 
-%post
-cat <<EOF > /lib/systemd/system/default.target.wants/run-test.service
-[Unit]
-Description=Run a test to see if anaconda+ostree worked
-After=basic.target
-
-[Service]
-Type=oneshot
-ExecStart=/usr/bin/run-test.sh
-EOF
-
-cat <<EOF > /usr/bin/run-test.sh
-#!/bin/bash
-
-# For now, just the fact that we rebooted is good enough.
-echo SUCCESS > /root/RESULT
-shutdown -h now
-EOF
-
-chmod +x /usr/bin/run-test.sh
+%post --nochroot
+mkdir -p /mnt/sysimage/root/
+echo SUCCESS > /mnt/sysimage/root/RESULT
 %end
diff --git a/tests/kickstart_tests/basic-ostree.sh b/tests/kickstart_tests/basic-ostree.sh
index 215d3e3..e193854 100755
--- a/tests/kickstart_tests/basic-ostree.sh
+++ b/tests/kickstart_tests/basic-ostree.sh
@@ -32,31 +32,3 @@ prepare() {
     sed -e "/ostreesetup/ s|REPO|${KSTEST_OSTREE_REPO}|" ${ks} > ${tmpdir}/kickstart.ks
     echo ${tmpdir}/kickstart.ks
 }
-
-validate() {
-    disksdir=$1
-    qemuArgs=$(for d in ${disksdir}/disk-*img; do echo -drive file=${d}; done)
-    virtCatArgs=$(for d in ${disksdir}/disk-*img; do echo -a ${d}; done)
-
-    # Now attempt to boot the resulting VM and see if the install
-    # actually worked.  The VM will shut itself down so there's no
-    # need to worry with that here.
-    timeout 5m /usr/bin/qemu-kvm -m 2048 \
-                                 -smp 2 \
-                                 ${qemuArgs} \
-                                 -vnc localhost:3
-
-    # There should be a /root/RESULT file with results in it.  Check
-    # its contents and decide whether the test finally succeeded or
-    # not.
-    result=$(virt-cat ${virtCatArgs} -m /dev/mapper/fedora-root /ostree/deploy/fedora-atomic/var/roothome/RESULT)
-    if [[ $? != 0 ]]; then
-        status=1
-        echo '*** /root/RESULT does not exist in VM image.'
-    elif [[ "${result}" != "SUCCESS" ]]; then
-        status=1
-        echo "${result}"
-    fi
-
-    return ${status}
-}
-- 
2.4.3



More information about the anaconda-patches mailing list