From abd92e42ee2c00fc0cc336527202ac1876926dd7 Mon Sep 17 00:00:00 2001 From: Bilal A Date: Tue, 5 Mar 2019 13:18:49 -0500 Subject: Adds basic stability tests for XACML PDP Includes 1) Basic health check test 2) Statistics API test Change-Id: I41156007dfb70702822d50f5bb32dbaae36bc610 Issue-ID: POLICY-1461 Signed-off-by: Bilal A --- pom.xml | 1 + testsuites/pom.xml | 32 +++ testsuites/stability/pom.xml | 50 ++++ testsuites/stability/src/assembly/assembly.xml | 42 +++ .../src/main/resources/testplans/stability.jmx | 319 +++++++++++++++++++++ 5 files changed, 444 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 diff --git a/pom.xml b/pom.xml index 03d633f3..5934a4f4 100644 --- a/pom.xml +++ b/pom.xml @@ -51,6 +51,7 @@ main packages + testsuites diff --git a/testsuites/pom.xml b/testsuites/pom.xml new file mode 100644 index 00000000..0da7d466 --- /dev/null +++ b/testsuites/pom.xml @@ -0,0 +1,32 @@ + + + 4.0.0 + + org.onap.policy.xacml-pdp + policy-xacml-pdp + 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..8fffd9d2 --- /dev/null +++ b/testsuites/stability/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + + org.onap.policy.xacml-pdp + 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..caf0bcb7 --- /dev/null +++ b/testsuites/stability/src/assembly/assembly.xml @@ -0,0 +1,42 @@ + + + stability + + zip + + /policy-xacml-pdp/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..9a3ad6be --- /dev/null +++ b/testsuites/stability/src/main/resources/testplans/stability.jmx @@ -0,0 +1,319 @@ + + + + + + Policy XACML PDP Stability Tests + false + true + false + + + + POLICY_XACML_PDP_HOST + ${__P(host,127.0.0.1)} + = + + + DURATION + ${__P(duration, 5)} + = + + + USERS + ${__P(users, 1)} + = + + + PORT + ${__P(port, 6969)} + = + + + + + + + + continue + + false + -1 + + ${USERS} + 1 + true + ${DURATION} + 1 + + + + + + + ${POLICY_XACML_PDP_HOST} + 6969 + http + + policy/pdpx/v1/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 Xacml PDP"; + assert res.healthy==true; + assert res.message=="alive"; + +} + + + + + + + Accept + application/json + + + Content-Type + application/json + + + + + + + + http://${POLICY_XACML_PDP_HOST}:6969/policy/pdpx/v1/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_XACML_PDP_HOST} + 6969 + http + + policy/pdpx/v1/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.totalPoliciesCount == 0; + assert res.permitDecisionsCount == 0; + assert res.denyDecisionsCount == 0; + assert res.indeterminantDecisionsCount == 0; + assert res.notApplicableDecisionsCount == 0; + + + +} + + + + + + + Accept + application/json + + + Content-Type + application/json + + + + + + + + http://${POLICY_XACML_PDP_HOST}:6969/policy/pdpx/v1/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