diff options
-rwxr-xr-x | scripts/compose_pki_test_package | 25 | ||||
-rwxr-xr-x | scripts/create_beaker_job | 42 | ||||
-rwxr-xr-x | scripts/run_tests | 28 | ||||
-rw-r--r-- | tests/dogtag/README | 58 | ||||
-rw-r--r-- | tests/dogtag/beakerjob.dogtag.xml.template | 4 | ||||
-rwxr-xr-x | tests/dogtag/make-package.sh | 9 |
6 files changed, 88 insertions, 78 deletions
diff --git a/scripts/compose_pki_test_package b/scripts/compose_pki_test_package index 879c48a92..517a54040 100755 --- a/scripts/compose_pki_test_package +++ b/scripts/compose_pki_test_package @@ -23,17 +23,17 @@ check_for_dependencies() check_for_dependencies -if [ $# -lt 2 ]; +if [ $# -lt 1 ]; then - echo "Usage: $0 User-ID_for_personalization Job_xml_config_file [--runtests]" + echo "Usage: $0 unique_identifier [--submit-tests]" exit -1 fi RUN_TESTS='N' -if [ $# -gt 2 ]; +if [ $# -gt 1 ]; then - if [ $3 = "--runtests" ] + if [ $2 = "--submit-tests" ] then RUN_TESTS='Y' fi @@ -53,12 +53,14 @@ WORK_DIR=`cd $COMPOSE_DIR/../..;pwd` BUILD_DIR="$WORK_DIR/package.tests" -rm -rf $BUILD_DIR - -mkdir $BUILD_DIR +if [ ! -d $BUILD_DIR ] ; then + mkdir $BUILD_DIR +fi cd $BUILD_DIR +rm -rf *.rpm + cp -r "$PKI_SOURCE_DIR/tests" . ### Compile the java test source ### @@ -79,16 +81,13 @@ cd .. ### Passing the keyword for personalizing and an option ### to maintain a seperate folder for each beaker job (Optional) -./make-package.sh $1 $2 +./make-package.sh $1 mv *.rpm ../../ -mv *.xml ../../ - +cd ../.. ### Running the tasks -cd $COMPOSE_DIR - if [ $RUN_TESTS = "Y" ] ; then - ./run_tests + bkr task-add *.rpm fi diff --git a/scripts/create_beaker_job b/scripts/create_beaker_job new file mode 100755 index 000000000..5184d4883 --- /dev/null +++ b/scripts/create_beaker_job @@ -0,0 +1,42 @@ +#! /bin/bash + +### Exit if there not enough parameters specified. +if [ $# -lt 2 ]; +then + echo "Usage: ./create-beaker-job-xml unique_identifier Job_xml_config_file [--submit-job]" + exit -1 +fi + +user_id=$1 +### Directory with all the compose scripts +COMPOSE_DIR=`dirname $0 | cd ; pwd` + +PKI_SOURCE_DIR=`cd $COMPOSE_DIR/..; pwd` + +WORK_DIR=`cd $COMPOSE_DIR/../..;pwd` + +BUILD_DIR="$WORK_DIR/package.tests" + +if [ ! -d $BUILD_DIR ] ; then + mkdir $BUILD_DIR +fi + +cd $BUILDDIR + +cp -r $PKI_SOURCE_DIR/tests . + +cd tests/dogtag + +sed -e "s|PKI_TEST_USER_ID|${user_id}|g" beakerjob.dogtag.xml.template >> beakerjob.dogtag.xml + +python update_beaker_job.py beakerjob.dogtag.xml $2 + +if [ $# -gt 2 ]; +then + if [ $3 = "--submit-job" ] + then + bkr job-submit beakerjob.dogtag.xml + fi +fi + +mv beakerjob.dogtag.xml ../../ diff --git a/scripts/run_tests b/scripts/run_tests deleted file mode 100755 index 8e4d65e9f..000000000 --- a/scripts/run_tests +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -WAIT_FOR_RESULT='N' -if [ $# -ge 1 ] ; then - if [ "$1" = "--wait-on-beaker-job" ] ; then - WAIT_FOR_RESULT="Y" - else - echo "Unrecognized option. Usage: ./runtests --wait-on-beaker-job(Optional)" - fi -fi -COMPOSE_PWD=`dirname $0 | cd; pwd` - -TEST_PACKAGE=`cd $COMPOSE_PWD/../../package.tests; pwd` - -if [ ! -d $TEST_PACKAGE ] ; then - echo "Cannot run tests on beaker. Please compose the test rpms." - exit -1 -fi - -cd $TEST_PACKAGE - -bkr task-add *.rpm - -if [ "$WAIT_FOR_RESULT" = "Y" ] ; then - bkr job-submit --wait *.xml -else - bkr job-submit *.xml -fi diff --git a/tests/dogtag/README b/tests/dogtag/README index c9679bea0..1b31abf82 100644 --- a/tests/dogtag/README +++ b/tests/dogtag/README @@ -95,8 +95,6 @@ This sets up the machine as a beaker client, on which new task rpms can be built and new jobs submitted to the beaker server. - A beaker job is an XML file. The template used to create a job is in - tests/dogtag/beakerjob.dogtag.xml.template. 1.2.2 Building the beaker task rpm and submitting a beaker job. @@ -120,46 +118,48 @@ 1.2.2.2 Building the task rpm and submitting the job to a beaker server is done by executing the compose script in pki/scripts: - ./compose_pki_test_package unique_identifier beaker_job_config [--runtests] + ./compose_pki_test_package unique_identifier [--submit-tests] The builds are done in <pki_source_root>/../package.tests/ folder. - -- The unique_identifier is for personalizing the rpm. - - This path at which the test source is extracted from the rpm on the - beaker server is specified by the TEST variable in the - Makefile (pki/tests/dogtag/Makefile). + -- The unique_identifier is for personalizing the rpm. - So another rpm with the same to-be-extracted path overwrites - the existing test code. - In order to prevent it, a unique id is asked to personalize the rpm - to provide a unique to-be-extracted path for every test rpm of - dogtag tests (especially at a user level). + This path at which the test source is extracted from the rpm on the + beaker server is specified by the TEST variable in the + Makefile (pki/tests/dogtag/Makefile). - -- beaker_job_config (the absolute path of the file from /) - - to configure the recipe of a job. + So another rpm with the same to-be-extracted path overwrites + the existing test code. + In order to prevent it, a unique id is asked to personalize the rpm + to provide a unique to-be-extracted path for every test rpm of + dogtag tests (especially at a user level). - A sample configuration file is at tests/conf/beaker-job.cfg. + -- The optional --submit-tests option. + This option submits the test rpm to the beaker server. - The repos parameter should point to the URL's to access the dogtag - rpms. The hostname means the hostname of a specific beaker test - machine. The distro_* are the details of the distribution on the - beaker server, that has to be installed on the test machine. + ./create_beaker_job unique_identifier beaker_job_config [--submit-job] - -- The optional --runtests option. - Without the --runtests options the task rpm and the job xml are - not submitted to the beaker server. + The unique_identifier has the same functionality as the one used in the + compose_pki_test_rpm command. - ** An already built rpm/job (built without the --runtests option above) - can be submitted to a beaker server by: + The "beaker_job_config" (the absolute path of the file from /) + is for configuring the recipe of a job. - ./run_tests [--wait-on-beaker-job] + A sample configuration file is at tests/conf/beaker-job.cfg. - -- The run_tests just submits the task rpm and job xml to beaker. - But specifying --wait-on-beaker-job option, the process is - blocked until the job is completed. + The repos parameter should point to the URL's to access the dogtag + rpms. The hostname means the hostname of a specific beaker test + machine. The distro_* are the details of the distribution on the + beaker server, that has to be installed on the test machine. + The optional --submit-job command submits the job to the beaker server. +**Note- A beaker job is an XML file. The template used to create a job is in + tests/dogtag/beakerjob.dogtag.xml.template. + The task /distribution/reservesys is commented. On uncommenting this + task in the template, the beaker test machine is reserved for a certain + period of time after the tests are run. This option can be used to + debug any tests that are failing. **Note- In the case of creating a repository on a remote machine, the remote machine must be a known_host to the local machine. diff --git a/tests/dogtag/beakerjob.dogtag.xml.template b/tests/dogtag/beakerjob.dogtag.xml.template index 5358da4d4..2b86bd3f8 100644 --- a/tests/dogtag/beakerjob.dogtag.xml.template +++ b/tests/dogtag/beakerjob.dogtag.xml.template @@ -35,9 +35,9 @@ <param name="DEV_JAVA_TESTS" value="FALSE"/> </params> </task> - <task name="/distribution/reservesys" role="STANDALONE"> + <!-- <task name="/distribution/reservesys" role="STANDALONE"> <params/> - </task> + </task> --> </recipe> </recipeSet> </job> diff --git a/tests/dogtag/make-package.sh b/tests/dogtag/make-package.sh index fd3265730..207bdd50b 100755 --- a/tests/dogtag/make-package.sh +++ b/tests/dogtag/make-package.sh @@ -1,9 +1,9 @@ #!/bin/sh ### Exit if there not enough parameters specified. -if [ $# -lt 2 ]; +if [ $# -lt 1 ]; then - echo "Usage: ./make-package.sh User-ID Job_xml_config_file [Different_subfolder_for_each_beaker_job_?(Y/N)]" + echo "Usage: ./make-package.sh unique_identifier [--use-different-folders]" exit -1 fi @@ -15,7 +15,7 @@ date_time="`date -u +%Y%m%d%H%M%S`" rpm_identifier=".$date_time" if [ $# -gt 1 ]; then - if [ $2 = 'Y' -o $2 = 'y' ]; + if [ $2 = '--use-different-folders' ]; then user_id="$1/$date_time" rpm_identifier="" @@ -36,6 +36,3 @@ rm -rf Makefile mv .Makefile.save Makefile -sed -e "s|PKI_TEST_USER_ID|${user_id}|g" beakerjob.dogtag.xml.template >> beakerjob.dogtag.xml - -python update_beaker_job.py beakerjob.dogtag.xml $2 |