Refactor plan scripts 48/73948/4
authorSam Hague <shague@redhat.com>
Wed, 11 Jul 2018 16:47:02 +0000 (12:47 -0400)
committerSam Hague <shague@redhat.com>
Wed, 11 Jul 2018 20:32:14 +0000 (16:32 -0400)
Change-Id: I6c594be8ac9b084f18171dc8ab4605b4062dfd3f
Signed-off-by: Sam Hague <shague@redhat.com>
jjb/defaults.yaml
jjb/integration/common-functions.sh
jjb/integration/integration-configure-clustering.sh
jjb/integration/integration-deploy-controller-run-test.sh
jjb/integration/integration-deploy-openstack-run-test.sh
jjb/integration/integration-macros.yaml
jjb/integration/integration-templates.yaml

index 313595b3b5a0e82c033922fca8f7f163198194f7..80d6d72a240925541e9787ed2222e2297e592e4d 100644 (file)
@@ -7,6 +7,8 @@
     stream: global
     prefix: ''  # A prefix for job names sandbox for example: user-
 
+    scriptplan: '{project}.txt'
+    configplan: '{project}.txt'
     testplan: '{project}-{functionality}.txt'
     streamtestplan: '{project}-{functionality}-{stream}.txt'
     karaf-version: karaf4
index d419d86553f2040c554882a7a16053d9fba47d7a..1f1d2c59ddc87e737dfd4f53ccfe18f113ce7738 100644 (file)
@@ -117,6 +117,41 @@ function configure_karaf_log() {
     cat ${LOGCONF}
 } # function configure_karaf_log()
 
+function run_plan() {
+    local -r type=$1
+
+    case ${type} in
+    script)
+        plan=$SCRIPTPLAN
+        ;;
+    config|*)
+        plan=$CONFIGPLAN
+        ;;
+    esac
+
+    printf "Locating ${type} plan to use...\n"
+    plan_filepath="${WORKSPACE}/test/csit/${type}plans/$plan"
+    if [ ! -f "${plan_filepath}" ]; then
+        plan_filepath="${WORKSPACE}/test/csit/${type}plans/${STREAMTESTPLAN}"
+        if [ ! -f "${plan_filepath}" ]; then
+            plan_filepath="${WORKSPACE}/test/csit/${type}plans/${TESTPLAN}"
+        fi
+    fi
+
+    if [ -f "${plan_filepath}" ]; then
+        printf "${type} plan exists!!!\n"
+        printf "Changing the ${type} plan path...\n"
+        cat ${plan_filepath} | sed "s:integration:${WORKSPACE}:" > ${type}plan.txt
+        cat ${type}plan.txt
+        for line in $( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' ${type}plan.txt ); do
+            printf "Executing ${line}...\n"
+            # shellcheck source=${line} disable=SC1091
+            source ${line}
+        done
+    fi
+    printf "Finished running ${type} plans\n"
+} # function run_plan()
+
 # convert commas in csv strings to spaces (ssv)
 function csv2ssv() {
     local csv=$1
index 42a2d8696633655f6e63c6db275f771967fae490..8f7a8080461b2f09cab8064ef397293abc475c91 100644 (file)
@@ -42,6 +42,8 @@ nodes_list=$(join "${nodes[@]}")
 
 echo ${nodes_list}
 
+run_plan "script"
+
 # Run script plan in case it exists
 if [ -f ${WORKSPACE}/test/csit/scriptplans/${TESTPLAN} ]; then
     echo "scriptplan exists!!!"
@@ -139,22 +141,7 @@ do
     ssh ${!CONTROLLERIP} "bash /tmp/configuration-script.sh ${i}"
 done
 
-# Run config plan in case it exists
-configplan_filepath="${WORKSPACE}/test/csit/configplans/${STREAMTESTPLAN}"
-if [ ! -f "${configplan_filepath}" ]; then
-    configplan_filepath="${WORKSPACE}/test/csit/configplans/${TESTPLAN}"
-fi
-
-if [ -f ${configplan_filepath} ]; then
-    echo "configplan exists!!!"
-    echo "Reading the configplan:"
-    cat ${configplan_filepath} | sed "s:integration:${WORKSPACE}:" > configplan.txt
-    cat configplan.txt
-    for line in $( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' configplan.txt ); do
-        echo "Executing ${line}..."
-        source ${line}
-    done
-fi
+run_plan "config"
 
 # Copy over the startup script to each controller and execute it.
 for i in `seq 1 ${NUM_ODL_SYSTEM}`
index 83e5adb9f4fca7c30c44debd8b860cd2ed5ad203..6f43a35e5a1d57aa5650441c3457921030f7a5d9 100644 (file)
@@ -30,17 +30,7 @@ echo "ACTUALFEATURES: ${ACTUALFEATURES}"
 SPACE_SEPARATED_FEATURES=$(echo "${ACTUALFEATURES}" | tr ',' ' ')
 echo "SPACE_SEPARATED_FEATURES: ${SPACE_SEPARATED_FEATURES}"
 
-if [ -f "${WORKSPACE}/test/csit/scriptplans/${TESTPLAN}" ]; then
-    echo "scriptplan exists!!!"
-    echo "Changing the scriptplan path..."
-    cat ${WORKSPACE}/test/csit/scriptplans/${TESTPLAN} | sed "s:integration:${WORKSPACE}:" > scriptplan.txt
-    cat scriptplan.txt
-    for line in $( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' scriptplan.txt ); do
-        echo "Executing ${line}..."
-        # shellcheck source=${line} disable=SC1091
-        source ${line}
-    done
-fi
+run_plan "script"
 
 cat > ${WORKSPACE}/configuration-script.sh <<EOF
 set -x
@@ -223,23 +213,7 @@ do
     done
 done
 
-echo "Locating config plan to use..."
-configplan_filepath="${WORKSPACE}/test/csit/configplans/${STREAMTESTPLAN}"
-if [ ! -f "${configplan_filepath}" ]; then
-    configplan_filepath="${WORKSPACE}/test/csit/configplans/${TESTPLAN}"
-fi
-
-if [ -f "${configplan_filepath}" ]; then
-    echo "configplan exists!!!"
-    echo "Changing the configplan path..."
-    cat ${configplan_filepath} | sed "s:integration:${WORKSPACE}:" > configplan.txt
-    cat configplan.txt
-    for line in $( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' configplan.txt ); do
-        echo "Executing ${line}..."
-        # shellcheck source=${line} disable=SC1091
-        source ${line}
-    done
-fi
+run_plan "config"
 
 # Copy over the startup script to controller and execute it.
 for i in `seq 1 ${NUM_ODL_SYSTEM}`
index 2b6f7fde741071053a94a1f3508835e04973331f..ae92c3407a2b31933c82fbff9d64c3ba8c9b9c25 100644 (file)
@@ -57,6 +57,9 @@ DISTROSTREAM: ${DISTROSTREAM}
 BUNDLE_URL: ${BUNDLE_URL}
 CONTROLLERFEATURES: ${CONTROLLERFEATURES}
 CONTROLLERDEBUGMAP: ${CONTROLLERDEBUGMAP}
+SCRIPTPLAN: ${SCRIPTPLAN}
+CONFIGPLAN: ${CONFIGPLAN}
+STREAMTESTPLAN: ${STREAMTESTPLAN}
 TESTPLAN: ${TESTPLAN}
 SUITES: ${SUITES}
 PATCHREFSPEC: ${PATCHREFSPEC}
index 36479f2fdeaf6ebc63048ed3ec9db8e6838d074d..b6102760a2851a9f251836b47e602c2590ff05bf 100644 (file)
           default: '{stream}'
           description: 'Distribution stream string, for suites to know which behavior to expect'
 
+- parameter:
+    name: integration-script-plan
+    parameters:
+      - string:
+          name: SCRIPTPLAN
+          default: '{script-plan}'
+          description: 'Script plan we will run before downloading and un-archiving am ODL distribution'
+
+- parameter:
+    name: integration-config-plan
+    parameters:
+      - string:
+          name: CONFIGPLAN
+          default: '{config-plan}'
+          description: 'Config plan we will run after un-archiving and starting an ODL distribution'
+
 - parameter:
     name: integration-stream-test-plan
     parameters:
index dcd3a29df70aff80cd99bf6355433aacaeaeb6e4..becacd07e4b69df9b2ff7c96470825f14b834d7e 100644 (file)
           controller-debug-map: '{debug-map}'
       - integration-test-options:
           test-options: '{robot-options}'
+      - integration-script-plan:
+          script-plan: '{scriptplan}'
+      - integration-config-plan:
+          config-plan: '{configplan}'
       - integration-test-plan:
           test-plan: '{testplan}'
       - integration-test-suites:
           controller-debug-map: '{debug-map}'
       - integration-test-options:
           test-options: '{robot-options}'
+      - integration-script-plan:
+          script-plan: '{scriptplan}'
+      - integration-config-plan:
+          config-plan: '{configplan}'
       - integration-test-plan:
           test-plan: '{testplan}'
       - integration-test-suites: