From 56f97facd9f275ee0be4e0ac54963234266a614a Mon Sep 17 00:00:00 2001 From: Bilal A Date: Thu, 14 Feb 2019 14:49:44 -0500 Subject: Adds basic stability tests for Policy API Includes 1) Basic health check test 2) Statistics API test Change-Id: Iccf20bfc4aae7496a0fad1dcb0e9e8378d94b47a Issue-ID: POLICY-1458 Signed-off-by: Bilal A --- testsuites/pom.xml | 32 ++ testsuites/stability/pom.xml | 50 ++++ testsuites/stability/src/assembly/assembly.xml | 42 +++ .../src/main/resources/testplans/stability.jmx | 322 +++++++++++++++++++++ 4 files changed, 446 insertions(+) create mode 100644 testsuites/pom.xml create mode 100644 testsuites/stability/pom.xml create mode 100644 testsuites/stability/src/assembly/assembly.xml create mode 100644 testsuites/stability/src/main/resources/testplans/stability.jmx (limited to 'testsuites') diff --git a/testsuites/pom.xml b/testsuites/pom.xml new file mode 100644 index 00000000..7978315a --- /dev/null +++ b/testsuites/pom.xml @@ -0,0 +1,32 @@ + + + 4.0.0 + + org.onap.policy.api + policy-api + 2.0.0-SNAPSHOT + + testsuites + pom + + stability + + \ No newline at end of file diff --git a/testsuites/stability/pom.xml b/testsuites/stability/pom.xml new file mode 100644 index 00000000..1d612f3f --- /dev/null +++ b/testsuites/stability/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + + org.onap.policy.api + testsuites + 2.0.0-SNAPSHOT + + stability + + + + org.apache.maven.plugins + maven-assembly-plugin + + + create-distribution + package + + single + + + + src/assembly/assembly.xml + + + + + + + + \ No newline at end of file diff --git a/testsuites/stability/src/assembly/assembly.xml b/testsuites/stability/src/assembly/assembly.xml new file mode 100644 index 00000000..4f1c027d --- /dev/null +++ b/testsuites/stability/src/assembly/assembly.xml @@ -0,0 +1,42 @@ + + + stability + + zip + + /policy-api/stability + + + ${project.basedir}/src/main/resources/testplans/ + tests/testplans + + *.jmx + *.sh + + unix + 0644 + true + + + diff --git a/testsuites/stability/src/main/resources/testplans/stability.jmx b/testsuites/stability/src/main/resources/testplans/stability.jmx new file mode 100644 index 00000000..84095e38 --- /dev/null +++ b/testsuites/stability/src/main/resources/testplans/stability.jmx @@ -0,0 +1,322 @@ + + + + + + Policy API Stability Tests + false + true + false + + + + POLICY_API_HOST + ${__P(host,10.12.6.93)} + = + + + DURATION + ${__P(duration, 5)} + = + + + USERS + ${__P(users, 1)} + = + + + PORT + ${__P(port, 6969)} + = + + + + + + + + continue + + false + -1 + + ${USERS} + 1 + true + ${DURATION} + 1 + + + + + + + ${POLICY_API_HOST} + 6969 + https + + healthcheck + GET + true + false + true + false + + + + Basic Health Check + + + + + 200 + + + Assertion.response_code + false + 1 + + + + groovy + + + true + import groovy.json.JsonSlurper; + +def res = []; +if (prev.getResponseCode() == '200') { + def jsonSlurper = new JsonSlurper(); + res = jsonSlurper.parseText(prev.getResponseDataAsString()); + + assert res instanceof Map; + assert res.code == 200; + assert res.name == "Policy API"; + assert res.healthy==true; + assert res.message=="alive"; + +} + + + + + + + Accept + application/json + + + Content-Type + application/json + + + + + + + + https://${POLICY_API_HOST}:6969/healthcheck + healthcheck + zb!XztG34 + + + + + true + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + + continue + + false + -1 + + ${USERS} + 1 + true + ${DURATION} + 1 + + + + + + + ${POLICY_API_HOST} + 6969 + https + + statistics + GET + true + false + true + false + + + + Basic Health Check + + + + + 200 + + + Assertion.response_code + false + 1 + + + + groovy + + + true + import groovy.json.JsonSlurper; + +def res = []; +if (prev.getResponseCode() == '200') { + def jsonSlurper = new JsonSlurper(); + res = jsonSlurper.parseText(prev.getResponseDataAsString()); + + assert res instanceof Map; + assert res.code == 200; + assert res.totalApiCallCount == 0; + assert res.apiCallSuccessCount==0; + assert res.apiCallFailureCount==0; + assert res.totalPolicyGetCount==0; + assert res.totalPolicyPostCount==0; + assert res.totalTemplateGetCount ==0; + assert res.totalTemplatePostCount==0; + assert res.policyGetSuccessCount==0; + assert res.policyGetFailureCount==0; + + +} + + + + + + + Accept + application/json + + + Content-Type + application/json + + + + + + + + https://${POLICY_API_HOST}:6969/statistics + healthcheck + zb!XztG34 + + + + + true + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + + + -- cgit 1.2.3-korg