summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Callaghan <dcallagh@redhat.com>2012-02-07 17:17:03 +1000
committerDan Callaghan <dcallagh@redhat.com>2012-02-07 17:17:14 +1000
commit6f02787da0033f5bd9ea57417636c0ed493a4d63 (patch)
tree5b2c25b2acbf0e7a794f58561219aec2c9c62dec
parent0d64e061e6ea1d314b3360be497e4ff811a845ea (diff)
/distribution/beaker/custom_kickstart: initial version of testbeaker-distribution-beaker-custom_kickstart-1_0-1
-rw-r--r--Tasks/distribution/beaker/custom_kickstart/Makefile61
-rw-r--r--Tasks/distribution/beaker/custom_kickstart/PURPOSE2
-rwxr-xr-xTasks/distribution/beaker/custom_kickstart/runtest.sh105
3 files changed, 168 insertions, 0 deletions
diff --git a/Tasks/distribution/beaker/custom_kickstart/Makefile b/Tasks/distribution/beaker/custom_kickstart/Makefile
new file mode 100644
index 0000000..cd6fc80
--- /dev/null
+++ b/Tasks/distribution/beaker/custom_kickstart/Makefile
@@ -0,0 +1,61 @@
+# Copyright (c) 2012 Red Hat, Inc. All rights reserved. This copyrighted material
+# is made available to anyone wishing to use, modify, copy, or
+# redistribute it subject to the terms and conditions of the GNU General
+# Public License v.2.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# The toplevel namespace within which the test lives.
+TOPLEVEL_NAMESPACE=distribution
+
+# The name of the package under test:
+PACKAGE_NAME=beaker
+
+# The path of the test below the package:
+RELATIVE_PATH=custom_kickstart
+
+# Version of the Test. Used with make tag.
+export TESTVERSION=1.0
+
+# The combined namespace of the test.
+export TEST=/$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
+
+.PHONY: all install build download clean
+
+# executables to be built should be added here, they will be generated on the system under test.
+BUILT_FILES=
+
+# data files, .c files, scripts anything needed to either compile the test and/or run it.
+FILES=$(METADATA) runtest.sh Makefile PURPOSE
+
+run: $(FILES) build
+ ./runtest.sh
+
+build: $(BUILT_FILES)
+
+clean:
+ rm -f *~ *.rpm $(BUILT_FILES)
+
+# Include Common Makefile
+include /usr/share/rhts/lib/rhts-make.include
+
+# Generate the testinfo.desc here:
+$(METADATA): Makefile
+ @touch $(METADATA)
+ @echo "Owner: Dan Callaghan <dcallagh@redhat.com>" > $(METADATA)
+ @echo "Name: $(TEST)" >> $(METADATA)
+ @echo "Path: $(TEST_DIR)" >> $(METADATA)
+ @echo "License: GPLv2" >> $(METADATA)
+ @echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
+ @echo "Description: test Beaker jobs with custom kickstart" >> $(METADATA)
+ @echo "TestTime: 10m" >> $(METADATA)
+ @echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
+ @echo "Requires: $(PACKAGE_NAME)-client" >> $(METADATA)
+
+ rhts-lint $(METADATA)
diff --git a/Tasks/distribution/beaker/custom_kickstart/PURPOSE b/Tasks/distribution/beaker/custom_kickstart/PURPOSE
new file mode 100644
index 0000000..456ca6c
--- /dev/null
+++ b/Tasks/distribution/beaker/custom_kickstart/PURPOSE
@@ -0,0 +1,2 @@
+This test runs a Beaker recipe with a custom kickstart (<kickstart/> element)
+and checks that the resulting kickstart used for provisioning matches.
diff --git a/Tasks/distribution/beaker/custom_kickstart/runtest.sh b/Tasks/distribution/beaker/custom_kickstart/runtest.sh
new file mode 100755
index 0000000..55380ff
--- /dev/null
+++ b/Tasks/distribution/beaker/custom_kickstart/runtest.sh
@@ -0,0 +1,105 @@
+#!/bin/bash
+
+# Copyright (c) 2012 Red Hat, Inc. All rights reserved. This copyrighted material
+# is made available to anyone wishing to use, modify, copy, or
+# redistribute it subject to the terms and conditions of the GNU General
+# Public License v.2.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# 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
+}
+
+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"
+ mkdir ~/.beaker_client
+ cat >~/.beaker_client/config <<EOF
+HUB_URL = "http://$SERVERS/bkr"
+AUTH_METHOD = "password"
+USERNAME = "admin"
+PASSWORD = "testing"
+EOF
+ test_custom_kickstart
+else
+ rhts-run-simple-test $TEST/noop true
+fi