diff options
Diffstat (limited to 'testsuites/stability/src/main/resources')
8 files changed, 189 insertions, 105 deletions
diff --git a/testsuites/stability/src/main/resources/setup/config/apiParameters.yaml b/testsuites/stability/src/main/resources/setup/config/apiParameters.yaml index e61653ac..7d486ae8 100644 --- a/testsuites/stability/src/main/resources/setup/config/apiParameters.yaml +++ b/testsuites/stability/src/main/resources/setup/config/apiParameters.yaml @@ -2,6 +2,8 @@ server: port: 6969 ssl: enabled: false + servlet: + context-path: /policy/api/v1 spring: security.user: @@ -79,4 +81,6 @@ management: base-path: / exposure: include: health,metrics,prometheus - path-mapping.prometheus: metrics + path-mapping: + -metrics: plain-metrics + -prometheus: metrics
\ No newline at end of file diff --git a/testsuites/stability/src/main/resources/setup/config/papParameters.yaml b/testsuites/stability/src/main/resources/setup/config/papParameters.yaml index 8249edd7..40203653 100644 --- a/testsuites/stability/src/main/resources/setup/config/papParameters.yaml +++ b/testsuites/stability/src/main/resources/setup/config/papParameters.yaml @@ -23,12 +23,18 @@ spring: server: port: 6969 + servlet: + context-path: /policy/pap/v1 ssl: enabled: false pap: name: PapGroup aaf: false + topic: + pdp-pap.name: POLICY-PDP-PAP + notification.name: POLICY-NOTIFICATION + heartbeat.name: POLICY-HEARTBEAT pdpParameters: heartBeatMs: 120000 updateParameters: @@ -37,41 +43,42 @@ pap: stateChangeParameters: maxRetryCount: 1 maxWaitMs: 30000 + savePdpStatisticsInDb: true topicParameterGroup: topicSources: - - topic: POLICY-PDP-PAP - servers: - - message-router - topicCommInfrastructure: dmaap - useHttps: false - fetchTimeout: 15000 - - topic: POLICY-HEARTBEAT - effectiveTopic: POLICY-PDP-PAP - consumerGroup: policy-pap - servers: - - message-router - topicCommInfrastructure: dmaap - useHttps: false - fetchTimeout: 15000 + - topic: POLICY-PDP-PAP + servers: + - message-router + topicCommInfrastructure: dmaap + useHttps: false + fetchTimeout: 15000 + - topic: POLICY-HEARTBEAT + effectiveTopic: POLICY-PDP-PAP + consumerGroup: policy-pap + servers: + - message-router + topicCommInfrastructure: dmaap + useHttps: false + fetchTimeout: 15000 topicSinks: - - topic: POLICY-PDP-PAP - servers: - - message-router - topicCommInfrastructure: dmaap - useHttps: false - - topic: POLICY-NOTIFICATION - servers: - - message-router - topicCommInfrastructure: dmaap - useHttps: false + - topic: POLICY-PDP-PAP + servers: + - message-router + topicCommInfrastructure: dmaap + useHttps: false + - topic: POLICY-NOTIFICATION + servers: + - message-router + topicCommInfrastructure: dmaap + useHttps: false healthCheckRestClientParameters: - - clientName: api - hostname: policy-api - port: 6969 - userName: policyadmin - password: zb!XztG34 - useHttps: false - basePath: policy/api/v1/healthcheck + - clientName: api + hostname: policy-api + port: 6969 + userName: policyadmin + password: zb!XztG34 + useHttps: false + basePath: policy/api/v1/healthcheck management: endpoints: @@ -79,4 +86,6 @@ management: base-path: / exposure: include: health, metrics, prometheus - path-mapping.prometheus: metrics + path-mapping: + -metrics: plain-metrics + -prometheus: metrics
\ No newline at end of file diff --git a/testsuites/stability/src/main/resources/setup/distribution/bin/policy-dist.sh b/testsuites/stability/src/main/resources/setup/distribution/bin/policy-dist.sh index 2d781ea1..13924ce1 100755 --- a/testsuites/stability/src/main/resources/setup/distribution/bin/policy-dist.sh +++ b/testsuites/stability/src/main/resources/setup/distribution/bin/policy-dist.sh @@ -20,7 +20,7 @@ # ============LICENSE_END========================================================= # -JAVA_HOME=/usr/lib/jvm/java-11-openjdk/ +JAVA_HOME=/usr/lib/jvm/java-17-openjdk/ KEYSTORE="${POLICY_HOME}/etc/ssl/policy-keystore" KEYSTORE_PASSWD="Pol1cy_0nap" TRUSTSTORE="${POLICY_HOME}/etc/ssl/policy-truststore" diff --git a/testsuites/stability/src/main/resources/setup/docker-compose.yml b/testsuites/stability/src/main/resources/setup/docker-compose.yml index 48d1851e..2fd77d7b 100644 --- a/testsuites/stability/src/main/resources/setup/docker-compose.yml +++ b/testsuites/stability/src/main/resources/setup/docker-compose.yml @@ -1,5 +1,5 @@ # ============LICENSE_START======================================================= -# Copyright (C) 2021-2022 Nordix Foundation. +# Copyright (C) 2021-2023 Nordix Foundation. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,9 +45,9 @@ services: - ./config/wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro entrypoint: /opt/app/policy/bin/wait_for_port.sh command: [ - '-c', - '/opt/app/policy/bin/db_migrator_policy_init.sh', - 'mariadb', '3306' + '-c', + '/opt/app/policy/bin/db_migrator_policy_init.sh', + 'mariadb', '3306' ] simulator: image: nexus3.onap.org:10001/onap/policy-models-simulator:${POLICY_MODELS_SIMULATOR} @@ -83,9 +83,9 @@ services: - ./config/wait_for_port.sh:/opt/app/policy/api/bin/wait_for_port.sh:ro entrypoint: /opt/app/policy/api/bin/wait_for_port.sh command: [ - '-c', './policy-api.sh', - 'mariadb', '3306', - 'policy-db-migrator', '6824' + '-c', './policy-api.sh', + 'mariadb', '3306', + 'policy-db-migrator', '6824' ] policy-pap: image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION} @@ -103,10 +103,10 @@ services: - ./config/jsonConfigs/papGroups.json:/opt/app/policy/pap/etc/mounted/groups.json:ro entrypoint: /opt/app/policy/pap/bin/wait_for_port.sh command: [ - '-c', './policy-pap.sh', - 'mariadb', '3306', - 'message-router', '3904', - 'policy-api', '6969' + '-c', './policy-pap.sh', + 'mariadb', '3306', + 'message-router', '3904', + 'policy-api', '6969' ] policy-dist: image: nexus3.onap.org:10001/onap/policy-distribution:${POLICY_DIST_VERSION} @@ -119,12 +119,14 @@ services: expose: - 6969 - 9090 + ports: + - 9090:9090 container_name: policy-distribution entrypoint: /opt/app/policy/bin/wait_for_port.sh command: [ - '-c', './policy-dist.sh', - 'mariadb', '3306', - 'message-router', '3904', - 'policy-api', '6969', - 'policy-pap', '6969' + '-c', './policy-dist.sh', + 'mariadb', '3306', + 'message-router', '3904', + 'policy-api', '6969', + 'policy-pap', '6969' ] diff --git a/testsuites/stability/src/main/resources/setup/start.sh b/testsuites/stability/src/main/resources/setup/start.sh index 765c5b64..e227eaff 100755 --- a/testsuites/stability/src/main/resources/setup/start.sh +++ b/testsuites/stability/src/main/resources/setup/start.sh @@ -1,6 +1,6 @@ #!/bin/bash # ============LICENSE_START======================================================= -# Copyright (c) 2021-2022 Nordix Foundation. +# Copyright (c) 2021-2023 Nordix Foundation. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ # ============LICENSE_END========================================================= # load up all the image version -source "$(pwd)"/versions.sh +source "$(pwd)"/stability/src/main/resources/setup/versions.sh DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" WORK_DIR=$(mktemp -d -p "$DIR") @@ -33,7 +33,7 @@ if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then fi # bring down maven -curl -s -S https://dlcdn.apache.org/maven/maven-3/3.8.5/binaries/apache-maven-3.8.5-bin.tar.gz > apache-maven.tar.gz +curl -s -S https://dlcdn.apache.org/maven/maven-3/3.9.5/binaries/apache-maven-3.9.5-bin.tar.gz > apache-maven.tar.gz mkdir -p apache-maven && tar -xzvf apache-maven.tar.gz -C apache-maven --strip-components 1 MAVEN="${WORK_DIR}"/apache-maven/bin/mvn @@ -42,10 +42,14 @@ echo "" # clone oparent for maven settings and models for building pdp/simulator git clone http://gerrit.onap.org/r/oparent -git clone --depth 1 https://gerrit.onap.org/r/policy/models -b master +docker pull nexus3.onap.org:10001/onap/policy-jre-alpine:${POLICY_DB_MIGRATOR} +docker tag nexus3.onap.org:10001/onap/policy-jre-alpine:${POLICY_DB_MIGRATOR} onap/policy-jre-alpine:${POLICY_DB_MIGRATOR} + +git clone --depth 1 https://gerrit.onap.org/r/policy/models -b master cd models/models-sim/policy-models-sim-pdp || exit $MAVEN clean install -DskipTests --settings "${WORK_DIR}"/oparent/settings.xml + bash ./src/main/package/docker/docker_build.sh cd "$DIR" || exit diff --git a/testsuites/stability/src/main/resources/setup/versions.sh b/testsuites/stability/src/main/resources/setup/versions.sh index 1ac71df5..f19f8398 100755 --- a/testsuites/stability/src/main/resources/setup/versions.sh +++ b/testsuites/stability/src/main/resources/setup/versions.sh @@ -1,6 +1,6 @@ #!/bin/bash # ============LICENSE_START======================================================= -# Copyright (c) 2021 Nordix Foundation. +# Copyright (c) 2021-2023 Nordix Foundation. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,13 +17,104 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= -# update versions here -export POLICY_MARIADB_VER=10.5.8 -export POLICY_DB_MIGRATOR=2.4-SNAPSHOT-latest -export POLICY_API_VERSION=2.6-SNAPSHOT-latest -export POLICY_PAP_VERSION=2.6-SNAPSHOT-latest -export POLICY_MODELS_SIMULATOR=2.6-SNAPSHOT-latest -export POLICY_DIST_VERSION=2.7-SNAPSHOT-latest +if [ -z "${WORKSPACE}" ]; then + WORKSPACE=$(git rev-parse --show-toplevel) + export WORKSPACE +fi + +GERRIT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' \ + "${WORKSPACE}"/.gitreview) + +echo GERRIT_BRANCH="${GERRIT_BRANCH}" + +export POLICY_MARIADB_VER=10.10.2 +echo POLICY_MARIADB_VER=${POLICY_MARIADB_VER} + +export POLICY_POSTGRES_VER=11.1 +echo POLICY_POSTGRES_VER=${POLICY_POSTGRES_VER} + +function getDockerVersion +{ + REPO=${1} + DEFAULT_DOCKER_IMAGE_NAME=${2:-} + DEFAULT_DOCKER_IMAGE_VERSION=${3:-} + + REPO_RELEASE_DATA=$( + curl -qL --silent \ + "https://github.com/onap/policy-parent/raw/$GERRIT_BRANCH/integration/src/main/resources/release/pf_release_data.csv" | + grep "^policy/$REPO" + ) + + # shellcheck disable=SC2034 + read -r repo \ + latest_released_tag \ + latest_snapshot_tag \ + changed_files \ + docker_images \ + <<< "$(echo "$REPO_RELEASE_DATA" | tr ',' ' ' )" + + if [[ -z "$docker_images" ]] + then + if [[ -z "$DEFAULT_DOCKER_IMAGE_NAME" ]] + then + echo "repo $REPO does not produce a docker image, execution terminated" + exit 1 + else + docker_images="$DEFAULT_DOCKER_IMAGE_NAME" + fi + fi + + # docker_image_version=$(echo "$latest_snapshot_tag" | awk -F \. '{print $1"."$2"-SNAPSHOT-latest"}') + docker_image_version=$latest_snapshot_tag + docker_image_name=$(echo "$docker_images" | sed -e "s/^.*://" -e "s/^.//" -e "s/.$//") + + if \ + curl -qL --silent \ + "https://nexus3.onap.org/service/rest/repository/browse/docker.snapshot/v2/onap/$docker_image_name/tags/" | + grep -q "$docker_image_version" + then + echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\"" + return + fi + + docker_image_version="$latest_released_tag" + if \ + curl -qL --silent \ + "https://nexus3.onap.org/service/rest/repository/browse/docker.release/v2/onap/$docker_image_name/tags/" | + grep -q "$docker_image_version" + then + echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\"" + return + fi + + docker_image_version="$DEFAULT_DOCKER_IMAGE_VERSION" + if \ + curl -qL --silent \ + "https://nexus3.onap.org/service/rest/repository/browse/docker.release/v2/onap/$docker_image_name/tags/" | + grep -q "$docker_image_version" + then + echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\"" + return + else + echo "docker image \"$docker_image_name:$docker_image_version\" not found for repo \"$repo\"" + exit 1 + fi +} + +getDockerVersion docker +export POLICY_DB_MIGRATOR="$docker_image_version" + +getDockerVersion models "'policy-models-simulator'" 3.0.1 +export POLICY_MODELS_SIMULATOR="$docker_image_version" + +getDockerVersion api +export POLICY_API_VERSION="$docker_image_version" + +getDockerVersion pap +export POLICY_PAP_VERSION="$docker_image_version" + +getDockerVersion distribution +export POLICY_DIST_VERSION="$docker_image_version" echo " MariaDB Version: ${POLICY_MARIADB_VER}" echo " Policy DB Migrator Version: ${POLICY_DB_MIGRATOR}" @@ -31,4 +122,4 @@ echo " Policy API Version: ${POLICY_API_VERSION}" echo " Policy PAP Version: ${POLICY_PAP_VERSION}" echo "Policy Models Simulator Version: ${POLICY_MODELS_SIMULATOR}" echo " Policy Distribution Version: ${POLICY_DIST_VERSION}" -echo "" +echo ""
\ No newline at end of file diff --git a/testsuites/stability/src/main/resources/testplans/run_test.sh b/testsuites/stability/src/main/resources/testplans/run_test.sh index edef48b6..195f78aa 100755 --- a/testsuites/stability/src/main/resources/testplans/run_test.sh +++ b/testsuites/stability/src/main/resources/testplans/run_test.sh @@ -1,6 +1,6 @@ #!/bin/bash # ============LICENSE_START======================================================= -# Copyright (c) 2021-2022 Nordix Foundation. +# Copyright (c) 2021-2023 Nordix Foundation. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,16 +17,23 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= +if [ $# -ne 1 ]; then + echo "Usage: $0 <duration>" + exit 1 +fi + +duration="$1" + echo "Starting stability test against distribution component..." DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -JMETER_HOME=~/jmeter/apache-jmeter-5.4.1 +JMETER_HOME=~/jmeter/apache-jmeter-5.5 POLICY_API_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' policy-api) POLICY_PAP_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' policy-pap) POLICY_DISTRIBUTION_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' policy-distribution) -${JMETER_HOME}/bin/jmeter -n -t "${DIR}"/stability.jmx -Jduration=259200 \ +${JMETER_HOME}/bin/jmeter -n -t "${DIR}"/stability.jmx -Jduration="${duration}" \ -Japihost="${POLICY_API_IP}" \ -Jpaphost="${POLICY_PAP_IP}" \ -Jdisthost="${POLICY_DISTRIBUTION_IP}" -l distribution_stability.jtl & diff --git a/testsuites/stability/src/main/resources/testplans/stability.jmx b/testsuites/stability/src/main/resources/testplans/stability.jmx index 75810c04..9ac51700 100644 --- a/testsuites/stability/src/main/resources/testplans/stability.jmx +++ b/testsuites/stability/src/main/resources/testplans/stability.jmx @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.4.1"> +<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.5" xmlns="http://jakarta.apache.org/jmeter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jakarta.apache.org/jmeter jmeter.xsd"> <hashTree> <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="stability test plan" enabled="true"> <stringProp name="TestPlan.comments"></stringProp> @@ -187,7 +187,7 @@ <hashTree/> </hashTree> </hashTree> - <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="HealthCheck/Statistics" enabled="true"/> + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="HealthCheck" enabled="true"/> <hashTree> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Healthcheck" enabled="true"> <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> @@ -219,36 +219,6 @@ </ResponseAssertion> <hashTree/> </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Statistics" enabled="true"> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - <stringProp name="HTTPSampler.domain">${DISTRIBUTION_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${DISTRIBUTION_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">http</stringProp> - <stringProp name="HTTPSampler.contentEncoding"></stringProp> - <stringProp name="HTTPSampler.path">statistics</stringProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.follow_redirects">true</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">true</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <stringProp name="HTTPSampler.embedded_url_re"></stringProp> - <stringProp name="HTTPSampler.connect_timeout"></stringProp> - <stringProp name="HTTPSampler.response_timeout"></stringProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - </ResponseAssertion> - <hashTree/> - </hashTree> </hashTree> <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Metrics" enabled="true"/> <hashTree> @@ -437,7 +407,7 @@ <stringProp name="HTTPSampler.port">${PAP_PORT}</stringProp> <stringProp name="HTTPSampler.protocol">http</stringProp> <stringProp name="HTTPSampler.contentEncoding"></stringProp> - <stringProp name="HTTPSampler.path">/policy/pap/v1/policies/status/</stringProp> + <stringProp name="HTTPSampler.path">/policy/pap/v1/policies/status</stringProp> <stringProp name="HTTPSampler.method">GET</stringProp> <boolProp name="HTTPSampler.follow_redirects">true</boolProp> <boolProp name="HTTPSampler.auto_redirects">false</boolProp> @@ -449,13 +419,10 @@ </HTTPSamplerProxy> <hashTree> <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="2914">[]</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">2</intProp> + <intProp name="Assertion.test_type">2</intProp> <!-- "Equals" test type --> + <stringProp name="Assertion.test_string">[]</stringProp> <!-- Expected response content --> </ResponseAssertion> <hashTree/> </hashTree> @@ -573,4 +540,4 @@ </hashTree> </hashTree> </hashTree> -</jmeterTestPlan> +</jmeterTestPlan>
\ No newline at end of file |