summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Callaghan <dcallagh@redhat.com>2012-02-07 19:44:27 +1000
committerDan Callaghan <dcallagh@redhat.com>2012-02-07 19:44:27 +1000
commitd1d36d40025b0ddce882057c8e2240434a870d6b (patch)
tree770ca47de2fae988e629672e1139cf6aceb8b566
parent6f02787da0033f5bd9ea57417636c0ed493a4d63 (diff)
/distribution/beaker/custom_kickstart: some fixesbeaker-distribution-beaker-custom_kickstart-1_0-2
-rw-r--r--Tasks/distribution/beaker/custom_kickstart/Makefile4
-rwxr-xr-xTasks/distribution/beaker/custom_kickstart/runtest.sh77
-rwxr-xr-xTasks/distribution/beaker/custom_kickstart/test_custom_kickstart.sh68
-rwxr-xr-xTasks/distribution/beaker/custom_kickstart/test_no_custom_kickstart.sh42
4 files changed, 117 insertions, 74 deletions
diff --git a/Tasks/distribution/beaker/custom_kickstart/Makefile b/Tasks/distribution/beaker/custom_kickstart/Makefile
index cd6fc80..c5cb2f0 100644
--- a/Tasks/distribution/beaker/custom_kickstart/Makefile
+++ b/Tasks/distribution/beaker/custom_kickstart/Makefile
@@ -32,7 +32,9 @@ export TEST=/$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
BUILT_FILES=
# data files, .c files, scripts anything needed to either compile the test and/or run it.
-FILES=$(METADATA) runtest.sh Makefile PURPOSE
+FILES=$(METADATA) runtest.sh Makefile PURPOSE \
+ test_custom_kickstart.sh \
+ test_no_custom_kickstart.sh
run: $(FILES) build
./runtest.sh
diff --git a/Tasks/distribution/beaker/custom_kickstart/runtest.sh b/Tasks/distribution/beaker/custom_kickstart/runtest.sh
index 55380ff..fc3700e 100755
--- a/Tasks/distribution/beaker/custom_kickstart/runtest.sh
+++ b/Tasks/distribution/beaker/custom_kickstart/runtest.sh
@@ -13,85 +13,15 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-set -ex
-
# XXX shouldn't hardcode this (comes from /distribution/beaker/add_systems)
-SYSTEM="virt-10"
-
-function test_custom_kickstart() {
- bkr job-submit - <<EOF
-<job retention_tag="scratch">
- <whiteboard>
- custom kickstart
- </whiteboard>
- <recipeSet>
- <recipe>
- <distroRequires>
- <and>
- <distro_arch op="=" value="x86_64"/>
- <distro_family op="=" value="RedHatEnterpriseLinux6"/>
- <distro_variant op="=" value="Server"/>
- </and>
- </distroRequires>
- <hostRequires>
- <hostname op="=" value="$SYSTEM" />
- </hostRequires>
- <task name="/distribution/install" role="STANDALONE">
- <params/>
- </task>
- <kickstart>
-<![CDATA[
-install
-firewall --disabled
-rootpw --iscrypted $1$lol$HhoQLlgGBmDdhd0l7YaK2.
-text
-keyboard us
-lang en_AU
-selinux --permissive
-skipx
-logging --level=info
-timezone --utc Australia/Brisbane
-bootloader --location=mbr
-zerombr
-clearpart --all --initlabel
-autopart
-reboot
-
-%packages --nobase
-@core
-
-%post --log=/dev/console
-echo hello
-%end
-]]>
- </kickstart>
- </recipe>
- </recipeSet>
-</job>
-EOF
-
- # XXX find a better way to wait for the job to start
- sleep 90
-
- wget -nv -O kickstart.actual "http://$SERVERS/cblr/svc/op/ks/system/$SYSTEM"
- rhts-submit-log -l kickstart.actual
- # We could diff this against an expected kickstart, like this...
- #diff -u kickstart.expected kickstart.actual
- # We would get an exit status of 1 if there were some difference.
- # But the kickstart has lots of site-specific stuff in it (distro paths etc)
- # so that's not really practical. :-(
- # We can at least check for our magical %post command:
- grep -q '^echo hello$' kickstart.actual
-
- echo PASSED
-}
+export TEST_SYSTEM="virt-10"
if $(echo $SERVERS $STANDALONE | grep -q $HOSTNAME) ; then
if [ -z "$SERVERS" ]; then
SERVERS="$STANDALONE"
fi
# XXX should the setup task do this for us?
- yum install -y "beaker-client$VERSION"
+ rhts-run-simple-test $TEST/install-beaker-client "yum install -y beaker-client$VERSION"
mkdir ~/.beaker_client
cat >~/.beaker_client/config <<EOF
HUB_URL = "http://$SERVERS/bkr"
@@ -99,7 +29,8 @@ AUTH_METHOD = "password"
USERNAME = "admin"
PASSWORD = "testing"
EOF
- test_custom_kickstart
+ rhts-run-simple-test $TEST/custom-kickstart ./test_custom_kickstart.sh
+ rhts-run-simple-test $TEST/no-custom-kickstart ./test_no_custom_kickstart.sh
else
rhts-run-simple-test $TEST/noop true
fi
diff --git a/Tasks/distribution/beaker/custom_kickstart/test_custom_kickstart.sh b/Tasks/distribution/beaker/custom_kickstart/test_custom_kickstart.sh
new file mode 100755
index 0000000..3320ecb
--- /dev/null
+++ b/Tasks/distribution/beaker/custom_kickstart/test_custom_kickstart.sh
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+set -ex
+
+function submit() {
+ bkr job-submit - <<EOF
+<job retention_tag="scratch">
+ <whiteboard>
+ custom kickstart
+ </whiteboard>
+ <recipeSet>
+ <recipe>
+ <distroRequires>
+ <and>
+ <distro_arch op="=" value="x86_64"/>
+ <distro_family op="=" value="RedHatEnterpriseLinux6"/>
+ <distro_variant op="=" value="Server"/>
+ </and>
+ </distroRequires>
+ <hostRequires>
+ <hostname op="=" value="$TEST_SYSTEM" />
+ </hostRequires>
+ <task name="/distribution/install" role="STANDALONE">
+ <params/>
+ </task>
+ <kickstart>
+<![CDATA[
+install
+firewall --disabled
+rootpw --iscrypted $1$lol$HhoQLlgGBmDdhd0l7YaK2.
+text
+keyboard us
+lang en_AU
+selinux --permissive
+skipx
+logging --level=info
+timezone --utc Australia/Brisbane
+bootloader --location=mbr
+zerombr
+clearpart --all --initlabel
+autopart
+reboot
+
+%packages --nobase
+@core
+
+%post --log=/dev/console
+echo hello
+%end
+]]>
+ </kickstart>
+ </recipe>
+ </recipeSet>
+</job>
+EOF
+}
+
+job_id=$(submit | awk -F\' '{print $2}')
+bkr job-watch $job_id
+wget -nv -O kickstart.actual "http://$SERVERS/cblr/svc/op/ks/system/$TEST_SYSTEM"
+rhts-submit-log -l kickstart.actual
+# We could diff this against an expected kickstart, like this...
+#diff -u kickstart.expected kickstart.actual
+# We would get an exit status of 1 if there were some difference.
+# But the kickstart has lots of site-specific stuff in it (distro paths etc)
+# so that's not really practical. :-(
+# We can at least check for our magical %post command:
+grep -q '^echo hello$' kickstart.actual
diff --git a/Tasks/distribution/beaker/custom_kickstart/test_no_custom_kickstart.sh b/Tasks/distribution/beaker/custom_kickstart/test_no_custom_kickstart.sh
new file mode 100755
index 0000000..04e499a
--- /dev/null
+++ b/Tasks/distribution/beaker/custom_kickstart/test_no_custom_kickstart.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+set -ex
+
+function submit() {
+ bkr job-submit - <<EOF
+<job retention_tag="scratch">
+ <whiteboard>
+ custom kickstart
+ </whiteboard>
+ <recipeSet>
+ <recipe>
+ <distroRequires>
+ <and>
+ <distro_arch op="=" value="x86_64"/>
+ <distro_family op="=" value="RedHatEnterpriseLinux6"/>
+ <distro_variant op="=" value="Server"/>
+ </and>
+ </distroRequires>
+ <hostRequires>
+ <hostname op="=" value="$TEST_SYSTEM" />
+ </hostRequires>
+ <task name="/distribution/install" role="STANDALONE">
+ <params/>
+ </task>
+ </recipe>
+ </recipeSet>
+</job>
+EOF
+}
+
+job_id=$(submit | awk -F\' '{print $2}')
+bkr job-watch $job_id
+wget -nv -O kickstart.actual "http://$SERVERS/cblr/svc/op/ks/system/$TEST_SYSTEM"
+rhts-submit-log -l kickstart.actual
+# We could diff this against an expected kickstart, like this...
+#diff -u kickstart.expected kickstart.actual
+# We would get an exit status of 1 if there were some difference.
+# But the kickstart has lots of site-specific stuff in it (distro paths etc)
+# so that's not really practical. :-(
+# We can at least check for the absence of our magical %post command:
+if grep -q '^echo hello$' kickstart.actual ; then exit 1 ; fi