From: emaclee Date: Fri, 18 Aug 2023 13:14:49 +0000 (+0100) Subject: Create plots for cps performance tests X-Git-Url: https://gerrit.nordix.org/gitweb?a=commitdiff_plain;h=5bbdfca3856793e6f01bbefde26c6c2ee3f5bb0f;p=infra%2Fcicd.git Create plots for cps performance tests Issue-ID: CPS-1777 Signed-off-by: emaclee Change-Id: I93a6ea568e67edeb65cb3f20c5f9fbf86d3f7aaf --- diff --git a/jjb/onap/cps/cps-performance-test-jobs.yaml b/jjb/onap/cps/cps-performance-test-jobs.yaml index d08f4f8e..8e1ce699 100644 --- a/jjb/onap/cps/cps-performance-test-jobs.yaml +++ b/jjb/onap/cps/cps-performance-test-jobs.yaml @@ -34,3 +34,11 @@ jobs: - 'onap-{project-name}-{stream}-performance-test-java' + +- project: + name: cps-tests-plots + project: cps + project-name: cps + + jobs: + - 'onap-{project-name}-performance-tests-plots' \ No newline at end of file diff --git a/jjb/onap/cps/prepare-performance-tests-data.sh b/jjb/onap/cps/prepare-performance-tests-data.sh new file mode 100644 index 00000000..c305cdd9 --- /dev/null +++ b/jjb/onap/cps/prepare-performance-tests-data.sh @@ -0,0 +1,76 @@ +#!/bin/bash +cd $WORKSPACE + +data_file="results.txt" +data_file_headers="Creating openroadm anchors with large data,Read datatrees using openroadm root,Update 100 data nodes,Batch delete 100 whole lists" + +if [[ ! -f "$data_file" ]]; then + echo "Creating $data_file" + touch "$data_file" + echo "$data_file_headers" > $data_file +else + echo "$data_file already exists" +fi + +echo "-----------------------------------------------------------------------------------" +echo "-----------------------------------------------------------------------------------" +# Extracting data results from performance job +JENKINS_JOB_URL="https://jenkins.nordix.org/job/onap-cps-master-performance-test-java" +latest_build=$(curl -s "${JENKINS_JOB_URL}/lastBuild/api/json" | jq -r '.number') +echo "latest build is $latest_build" + +# Get the latest build status +latest_build_status=$(curl -s "${JENKINS_JOB_URL}/api/json" | jq -r '.color') +echo "latest build status is $latest_build_status" + +# Construct the URL for getting the console text +CONSOLE_URL="${JENKINS_JOB_URL}/${latest_build}/consoleText" + +# Get the console text +console_text=$(curl -s "$CONSOLE_URL") + +echo "-----------------------------------------------------------------------------------" +echo "-----------------------------------------------------------------------------------" + +# Text patterns to match in console log +creating_bookstore_pattern="^.*Creating openroadm anchors with large.*" +read_datatreees_pattern="^.*Read datatrees using openroadm root.*" +update_datanodes_pattern="^.*Update 100 data nodes.*" +batch_delete_pattern="^.*Batch delete 100 whole lists.*" + +all_patterns=("$creating_bookstore_pattern" "$read_datatreees_pattern" "$update_datanodes_pattern" "$batch_delete_pattern") +new_data="" + +# Extract numerical values as data results +for pattern in "${all_patterns[@]}"; do + if matched_line=$(echo "$console_text" | grep -o -P "$pattern"); then + echo "Matched line: $matched_line" + limit_value=$(echo "$matched_line" | grep -o -P 'limit\s*\K\d+(,\d+)?' | tr -cd '[:digit:]') + took_value=$(echo "$matched_line" | grep -o -P 'took\s*\K\d+(,\d+)?' | tr -cd '[:digit:]') + percentage=$((took_value * 100 / limit_value)) + + echo "Limit value: $limit_value" + echo "Took value: $took_value" + echo "Percentage: $percentage" + + if [ -z "$new_data" ]; then + new_data="$percentage" + else + new_data+=",$percentage" + fi + echo "New data: $new_data" + + else + echo "No match found." + fi +done +echo "-----------------------------------------------------------------------------------" +echo "-----------------------------------------------------------------------------------" + + +# Publish results in file for building plot +if [ -z "$new_data" ]; then + echo "No new data" +else + echo "$new_data" >> $data_file +fi \ No newline at end of file diff --git a/jjb/onap/global-templates-onap-java.yaml b/jjb/onap/global-templates-onap-java.yaml index 8902f57a..3132f956 100644 --- a/jjb/onap/global-templates-onap-java.yaml +++ b/jjb/onap/global-templates-onap-java.yaml @@ -68,7 +68,7 @@ - shell: !include-raw-escape: ./verify-jobs.sh -# A job to perform CSIT on policy components +# A job to perform CSIT on policy components - job-template: name: 'onap-{project-name}-{stream}-policy-csit-verify-java' disabled_job_var: false @@ -115,7 +115,7 @@ - string: name: CSIT_NAME default: '{csit-name}' - description: The name of the csit-test to run + description: The name of the csit-test to run - string: name: SUBDIRECTORY default: '{subdirectory}' @@ -144,6 +144,31 @@ !include-raw-escape: ./verify-jobs.sh - shell: !include-raw-escape: ./verify-policy-csit.sh + +- job-template: + name: 'onap-{project-name}-performance-tests-plots' + disabled_job_var: false + node: onap-ubuntu1804 + + builders: + - shell: + !include-raw-escape: ./cps/prepare-performance-tests-data.sh + + publishers: + - plot: + - title: "performance" + group: "performance" + csvFileName: "results.txt" + style: line + exclude-zero-yaxis: true + num-builds: '30' + series: + - file: + url: 'results.txt' + inclusion-flag: 'off' + display-table: false + format: csv + - job-template: name: 'onap-{project-name}-{stream}-performance-test-java' disabled_job_var: false @@ -224,6 +249,8 @@ - shell: !include-raw-escape: ./verify-jobs.sh + post-build: + - project: onap-cps-performance-tests-plots # csits for diferent projects are different so need to have special handling - job-template: