diff options
author | Abhishek Koneru <akoneru@redhat.com> | 2013-11-06 16:08:39 -0500 |
---|---|---|
committer | Abhishek Koneru <akoneru@redhat.com> | 2013-11-10 15:15:37 -0500 |
commit | b9d125a25e7b53cfe1cc9437b6a31a87c324bbe2 (patch) | |
tree | 28434dbf47dbf2ac6711604ac3f8e4c0513dc327 /tests | |
parent | bb20c9ffb38baae7ae89f16737e37569af445bdc (diff) | |
download | pki-b9d125a25e7b53cfe1cc9437b6a31a87c324bbe2.tar.gz pki-b9d125a25e7b53cfe1cc9437b6a31a87c324bbe2.tar.xz pki-b9d125a25e7b53cfe1cc9437b6a31a87c324bbe2.zip |
Provide compose scripts for tests.
Provide a compose script for building the test rpm and
creating the job xml (by updating the job template with custom values
provided in a job xml config file). Also add a new option
--createrepo to the compose_pki_core_package script to create a repository
of the built rpms at the location specified in a config file.
Tickets #657, 722,723,724
Diffstat (limited to 'tests')
-rw-r--r-- | tests/dogtag/beakerjob.rhcs.xml.template (renamed from tests/dogtag/beakerjob.rhcs.x86_64.f19.xml) | 12 | ||||
-rwxr-xr-x | tests/dogtag/make-package.sh | 14 | ||||
-rwxr-xr-x | tests/dogtag/update_beaker_job.py | 52 |
3 files changed, 65 insertions, 13 deletions
diff --git a/tests/dogtag/beakerjob.rhcs.x86_64.f19.xml b/tests/dogtag/beakerjob.rhcs.xml.template index a15417cf5..5ba50d086 100644 --- a/tests/dogtag/beakerjob.rhcs.x86_64.f19.xml +++ b/tests/dogtag/beakerjob.rhcs.xml.template @@ -9,15 +9,12 @@ <packages/> <ks_appends/> <repos> - <repo name="repo1" url="http://mickey.dsdev.sjc.redhat.com/repos/pki/dogtag/10/F19/devel_x86_64/x86_64/"/> - <repo name="repo2" url="http://mickey.dsdev.sjc.redhat.com/repos/pki/dogtag/10/F19/devel_x86_64/noarch/"/> </repos> <distroRequires> <and> - <distro_family op="=" value="Fedora19"/> - <distro_variant op="=" value="Fedora"/> - <distro_name op="=" value="Fedora-19"/> - <distro_arch op="=" value="x86_64"/> + <distro_family op="=" value=""/> + <distro_name op="=" value=""/> + <distro_arch op="=" value=""/> </and> </distroRequires> <hostRequires> @@ -27,7 +24,7 @@ <task name="/distribution/install" role="STANDALONE"> <params/> </task> - <task name="/CoreOS/rhcs/lsunkaras_dir" role="MASTER"> + <task name="/CoreOS/rhcs/PKI_TEST_USER_ID" role="MASTER"> <params> <param name="TEST_ALL" value="TRUE"/> <param name="QUICKINSTALL" value="FALSE"/> @@ -35,6 +32,7 @@ <param name="USER_SHOW_CA" value="FALSE"/> <param name="USER_FIND_CA" value="FALSE"/> <param name="USER_DEL_CA" value="FALSE"/> + <param name="DEV_JAVA_TESTS" value="FALSE"/> </params> </task> <task name="/distribution/reservesys" role="STANDALONE"> diff --git a/tests/dogtag/make-package.sh b/tests/dogtag/make-package.sh index 6e809104a..0ba0018a5 100755 --- a/tests/dogtag/make-package.sh +++ b/tests/dogtag/make-package.sh @@ -1,9 +1,9 @@ #!/bin/sh -### Exit if there is no personalization id specified. -if [ $# -lt 1 ]; +### Exit if there not enough parameters specified. +if [ $# -lt 2 ]; then - echo "Usage: ./make-package.sh <User-ID> <Different_subfolder_for_each_beaker_job_?(Y/N)(Optional)>" + echo "Usage: ./make-package.sh User-ID Job_xml_config_file [Different_subfolder_for_each_beaker_job_?(Y/N)]" exit -1 fi @@ -22,8 +22,6 @@ then fi fi -#rpm_identifier=".$date_time" -echo $user_id ### Replacing the default value with the "user_id/current_number" sed -e "s|PKI_TEST_USER_ID|${user_id}|g" -e "s|_RPM_IDENTIFIER|${rpm_identifier}|g" .Makefile.save >> Makefile @@ -32,8 +30,12 @@ chmod +x Makefile ### Making the rpm make package -### Remove the current rpm and place the original back +### Remove the current makefile and place the original back rm -rf Makefile mv .Makefile.save Makefile + +sed -e "s|PKI_TEST_USER_ID|${user_id}|g" beakerjob.rhcs.xml.template >> beakerjob.rhcs.xml + +python update_beaker_job.py beakerjob.rhcs.xml $2 diff --git a/tests/dogtag/update_beaker_job.py b/tests/dogtag/update_beaker_job.py new file mode 100755 index 000000000..3987e30cd --- /dev/null +++ b/tests/dogtag/update_beaker_job.py @@ -0,0 +1,52 @@ +#! /usr/bin/python + +import sys +from lxml import etree +from ConfigParser import ConfigParser + + +""" Parse the xml template and replace the values with the + values from the configuration file passed. + Usage: py modifybeakerjobxml.py <XML_TEMPLATE_PATH> <CONFIG_FILE_PATH>""" + + +doc = etree.parse(str(sys.argv[1])) + +parser = ConfigParser() +parser.read(str(sys.argv[2])) + +props=parser.defaults() + +repos=props['repos'] + +if repos is not None: + repos = str(repos).split() + repos_element=doc.getroot().find('recipeSet/recipe/repos') + i = 1 + for repo in repos: + new_child = etree.SubElement(repos_element, 'repo', name='repo'+str(i), url=repo) + i = i + 1 + +element = None +distro_family = props['distro_family'] +if distro_family is not None: + element=doc.find('recipeSet/recipe/distroRequires/and/distro_family') + element.attrib['value'] = distro_family + +distro_name = props['distro_name'] +if distro_name is not None: + element=doc.find('recipeSet/recipe/distroRequires/and/distro_name') + element.attrib['value'] = distro_name + +distro_arch = props['distro_arch'] +if distro_arch is not None: + element=doc.find('recipeSet/recipe/distroRequires/and/distro_arch') + element.attrib['value'] = distro_arch + +hostname = props['hostname'] +if distro_family is not None: + element=doc.find('recipeSet/recipe/hostRequires') + etree.SubElement(element, 'hostname', op='=', value=hostname) + +with open(str(sys.argv[1]), 'w') as outfile: + doc.write(outfile) |