Updated workflow for csit changes 80/140580/2
authorsrinivasyanamadala <srinivas.yanamadala@techmahindra.com>
Thu, 27 Mar 2025 10:55:00 +0000 (11:55 +0100)
committersrinivasyanamadala <srinivas.yanamadala@techmahindra.com>
Thu, 27 Mar 2025 13:22:41 +0000 (14:22 +0100)
Issue-ID: POLICY-5225
Change-Id: I5e234f2c5ad2eed11b64b6c086532792362a81e0
Signed-off-by: srinivasyanamadala <srinivas.yanamadala@techmahindra.com>
.github/workflows/gerrit-opa-performance-test.yaml
.github/workflows/gerrit-opa-stability-test.yaml
testsuites/run-s3p-test.sh

index b105f0b..54855dd 100755 (executable)
@@ -70,7 +70,7 @@ on:
   # Run everyday at 16:30 UTC
   schedule:
     - cron: '30 16 * * *'
+
 jobs:
   run-s3p-tests:
     runs-on: ubuntu-22.04
@@ -80,7 +80,7 @@ jobs:
 
       - name: Run S3P script
         working-directory: ${{ github.workspace }}/testsuites
-        run: sudo bash ./run-s3p-test.sh run performance
+        run: sudo bash ./run-s3p-test.sh performance
 
       - name: Archive result jtl
         uses: actions/upload-artifact@v4
index 65e269d..09db4c5 100755 (executable)
@@ -70,7 +70,7 @@ on:
   # Run everyday at 16:30 UTC
   schedule:
     - cron: '30 16 * * *'
+
 jobs:
   run-s3p-tests:
     runs-on: ubuntu-22.04
@@ -80,7 +80,7 @@ jobs:
 
       - name: Run S3P script
         working-directory: ${{ github.workspace }}/testsuites
-        run: sudo bash ./run-s3p-test.sh run stability
+        run: sudo bash ./run-s3p-test.sh stability
 
       - name: Archive result jtl
         uses: actions/upload-artifact@v4
index 85b9f08..5cf9267 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 #  ============LICENSE_START=======================================================
-#   Copyright (C) 2024 Deutsche Telekom Intellectual Property. All rights reserved.
+#   Copyright (C) 2024-2025 Deutsche Telekom Intellectual Property. All rights reserved.
 #  ================================================================================
 #  Licensed under the Apache License, Version 2.0 (the "License");
 #  you may not use this file except in compliance with the License.
@@ -22,28 +22,43 @@ if [ -z "${WORKSPACE}" ]; then
     export WORKSPACE=$(git rev-parse --show-toplevel)
 fi
 
+export PROJECT="opa"
 export TESTDIR=${WORKSPACE}/testsuites
 export OPA_PERF_TEST_FILE=$TESTDIR/performance/src/main/resources/testplans/perf.jmx
 export OPA_STAB_TEST_FILE=$TESTDIR/stability/src/main/resources/testplans/stability.jmx
 
-if [ $1 == "run" ]
-then
-
-  mkdir automate-s3p-test;cd automate-s3p-test;
-  git clone "https://gerrit.onap.org/r/policy/docker"
-  cd docker/csit
-
-  if [ $2 == "performance" ]
-  then
-    bash start-s3p-tests.sh run $OPA_PERF_TEST_FILE opa-pdp;
-  elif [ $2 == "stability" ]
-  then
-    bash start-s3p-tests.sh run $OPA_STAB_TEST_FILE opa-pdp;
-  else
-    echo "echo Invalid arguments provided. Usage: $0 [option..] {performance | stability}"
-  fi
-
-else
-  echo "Invalid arguments provided. Usage: $0 [option..] {run | uninstall}"
-fi
+function run_tests() {
+    local test_file=$1
+
+    mkdir -p automate-s3p-test
+    cd automate-s3p-test || exit 1
+    git clone "https://gerrit.onap.org/r/policy/docker"
+    cd docker/csit || exit 1
+
+    bash run-s3p-tests.sh test "$test_file" $PROJECT
+}
+
+function clean() {
+    cd $TESTDIR/automate-s3p-test/docker/csit
+    bash run-s3p-tests.sh clean
+}
+
+echo "================================="
+echo "Triggering S3P test for: $PROJECT"
+echo "================================="
 
+case $1 in
+    performance)
+        run_tests "$OPA_PERF_TEST_FILE"
+        ;;
+    stability)
+        run_tests "$OPA_STAB_TEST_FILE"
+        ;;
+    clean)
+        clean
+        ;;
+    *)
+        echo "Invalid arguments provided. Usage: $0 {performance | stability | clean}"
+        exit 1
+        ;;
+esac