diff options
Diffstat (limited to 's3p/stability.jmx')
-rw-r--r-- | s3p/stability.jmx | 341 |
1 files changed, 341 insertions, 0 deletions
diff --git a/s3p/stability.jmx b/s3p/stability.jmx new file mode 100644 index 00000000..00a94b24 --- /dev/null +++ b/s3p/stability.jmx @@ -0,0 +1,341 @@ +<?xml version="1.0" encoding="UTF-8"?> +<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.0 r1840935"> + <hashTree> + <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="stability test plan" enabled="true"> + <stringProp name="TestPlan.comments"></stringProp> + <boolProp name="TestPlan.functional_mode">false</boolProp> + <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp> + <boolProp name="TestPlan.serialize_threadgroups">false</boolProp> + <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="PDP_HOST" elementType="Argument"> + <stringProp name="Argument.name">PDP_HOST</stringProp> + <stringProp name="Argument.value">${__P(host,10.239.40.43)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="CSAR_DIR" elementType="Argument"> + <stringProp name="Argument.name">CSAR_DIR</stringProp> + <stringProp name="Argument.value">${__P(csardir, /tmp/policy_distribution/csar)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="SCRIPT_DIR" elementType="Argument"> + <stringProp name="Argument.name">SCRIPT_DIR</stringProp> + <stringProp name="Argument.value">${__BeanShell(import org.apache.jmeter.services.FileServer; FileServer.getFileServer().getBaseDir();)}${__BeanShell(File.separator,)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="DURATION" elementType="Argument"> + <stringProp name="Argument.name">DURATION</stringProp> + <stringProp name="Argument.value">${__P(duration, 30)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="rescode" elementType="Argument"> + <stringProp name="Argument.name">rescode</stringProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="RETRY" elementType="Argument"> + <stringProp name="Argument.name">RETRY</stringProp> + <stringProp name="Argument.value">${__P(retry, 10)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="RETRY_WAIT" elementType="Argument"> + <stringProp name="Argument.name">RETRY_WAIT</stringProp> + <stringProp name="Argument.value">${__P(wait, 1000)}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="counter" elementType="Argument"> + <stringProp name="Argument.name">counter</stringProp> + <stringProp name="Argument.value">0</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="TestPlan.user_define_classpath"></stringProp> + </TestPlan> + <hashTree> + <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true"> + <stringProp name="ThreadGroup.on_sample_error">continue</stringProp> + <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true"> + <boolProp name="LoopController.continue_forever">false</boolProp> + <intProp name="LoopController.loops">-1</intProp> + </elementProp> + <stringProp name="ThreadGroup.num_threads">1</stringProp> + <stringProp name="ThreadGroup.ramp_time">1</stringProp> + <boolProp name="ThreadGroup.scheduler">true</boolProp> + <stringProp name="ThreadGroup.duration">${DURATION}</stringProp> + <stringProp name="ThreadGroup.delay">1</stringProp> + </ThreadGroup> + <hashTree> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="GET_POLICY_HTTP_HEADER" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Content-Type</stringProp> + <stringProp name="Header.value">application/json</stringProp> + </elementProp> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Accept</stringProp> + <stringProp name="Header.value">application/json</stringProp> + </elementProp> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">ClientAuth</stringProp> + <stringProp name="Header.value">cHl0aG9uOnRlc3Q=</stringProp> + </elementProp> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Authorization</stringProp> + <stringProp name="Header.value">Basic dGVzdHBkcDphbHBoYTEyMw==</stringProp> + </elementProp> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Environment</stringProp> + <stringProp name="Header.value">TEST</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + <RandomVariableConfig guiclass="TestBeanGUI" testclass="RandomVariableConfig" testname="Random Variable" enabled="true"> + <stringProp name="maximumValue">100000000</stringProp> + <stringProp name="minimumValue">1</stringProp> + <stringProp name="outputFormat">00000000</stringProp> + <boolProp name="perThread">false</boolProp> + <stringProp name="randomSeed"></stringProp> + <stringProp name="variableName">RESID</stringProp> + </RandomVariableConfig> + <hashTree/> + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="check if existing policy" enabled="true"/> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="list_policy" enabled="true"> + <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> + <collectionProp name="Arguments.arguments"> + <elementProp name="" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">false</boolProp> + <stringProp name="Argument.value">{"policyName": "oofCasablanca.*s3p_${RESID}.*"}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain">${PDP_HOST}</stringProp> + <stringProp name="HTTPSampler.port">8081</stringProp> + <stringProp name="HTTPSampler.protocol">https</stringProp> + <stringProp name="HTTPSampler.contentEncoding"></stringProp> + <stringProp name="HTTPSampler.path">/pdp/api/listConfig</stringProp> + <stringProp name="HTTPSampler.method">POST</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> + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="JSR223 PostProcessor" enabled="true"> + <stringProp name="scriptLanguage">groovy</stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="script">import groovy.json.JsonSlurper; + +def to_delete = []; +if (prev.getResponseCode() == '200') { + def jsonSlurper = new JsonSlurper(); + to_delete = jsonSlurper.parseText(prev.getResponseDataAsString()); +} +vars.putObject('to_delete', to_delete); +</stringProp> + </JSR223PostProcessor> + <hashTree/> + </hashTree> + <WhileController guiclass="WhileControllerGui" testclass="WhileController" testname="While Controller" enabled="true"> + <stringProp name="WhileController.condition">${__groovy(vars.getObject('to_delete').size() > 0)}</stringProp> + </WhileController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="delete_policy_pdp" enabled="true"> + <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> + <collectionProp name="Arguments.arguments"> + <elementProp name="" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">false</boolProp> + <stringProp name="Argument.value">{
 + "pdpGroup": "default",
 + "policyComponent": "PDP",
 + "policyType": "Optimization",
 + "policyName": "${policyname}"
 +}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain">${PDP_HOST}</stringProp> + <stringProp name="HTTPSampler.port">8081</stringProp> + <stringProp name="HTTPSampler.protocol">https</stringProp> + <stringProp name="HTTPSampler.contentEncoding"></stringProp> + <stringProp name="HTTPSampler.path">/pdp/api/deletePolicy</stringProp> + <stringProp name="HTTPSampler.method">DELETE</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> + <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="JSR223 PreProcessor" enabled="true"> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="script">def to_delete = vars.getObject('to_delete'); +def policyname = to_delete.pop() +vars.put('policyname', policyname.toString()); +vars.putObject('to_delete', to_delete); +</stringProp> + <stringProp name="scriptLanguage">groovy</stringProp> + </JSR223PreProcessor> + <hashTree/> + </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="delete_policy_pap" enabled="true"> + <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> + <collectionProp name="Arguments.arguments"> + <elementProp name="" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">false</boolProp> + <stringProp name="Argument.value">{
 + "deleteCondition":"ALL",
 + "policyComponent": "PAP",
 + "policyType": "Optimization",
 + "policyName": "${policyname}"
 +}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain">${PDP_HOST}</stringProp> + <stringProp name="HTTPSampler.port">8081</stringProp> + <stringProp name="HTTPSampler.protocol">https</stringProp> + <stringProp name="HTTPSampler.contentEncoding"></stringProp> + <stringProp name="HTTPSampler.path">/pdp/api/deletePolicy</stringProp> + <stringProp name="HTTPSampler.method">DELETE</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/> + </hashTree> + </hashTree> + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="generate random csar" enabled="true"/> + <hashTree> + <SystemSampler guiclass="SystemSamplerGui" testclass="SystemSampler" testname="Generate_CSAR" enabled="true"> + <boolProp name="SystemSampler.checkReturnCode">true</boolProp> + <stringProp name="SystemSampler.expectedReturnCode">0</stringProp> + <stringProp name="SystemSampler.command">${SCRIPT_DIR}generate.sh</stringProp> + <elementProp name="SystemSampler.arguments" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> + <collectionProp name="Arguments.arguments"> + <elementProp name="" elementType="Argument"> + <stringProp name="Argument.name"></stringProp> + <stringProp name="Argument.value">${CSAR_DIR}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + <elementProp name="" elementType="Argument"> + <stringProp name="Argument.name"></stringProp> + <stringProp name="Argument.value">${RESID}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <elementProp name="SystemSampler.environment" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="SystemSampler.directory"></stringProp> + </SystemSampler> + <hashTree/> + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Reset Loop" enabled="true"> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="script">vars.put("rescode", "0"); +vars.put('counter', '0');</stringProp> + <stringProp name="scriptLanguage">groovy</stringProp> + </JSR223Sampler> + <hashTree/> + </hashTree> + <WhileController guiclass="WhileControllerGui" testclass="WhileController" testname="WC" enabled="true"> + <stringProp name="WhileController.condition">${__javaScript(${counter} < ${RETRY} && "${rescode}" != "200")}</stringProp> + </WhileController> + <hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Get_Policy" enabled="true"> + <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> + <collectionProp name="Arguments.arguments"> + <elementProp name="" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">false</boolProp> + <stringProp name="Argument.value">{"policyName": "oofCasablanca.*s3p_${RESID}.*"}</stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain">${PDP_HOST}</stringProp> + <stringProp name="HTTPSampler.port">8081</stringProp> + <stringProp name="HTTPSampler.protocol">https</stringProp> + <stringProp name="HTTPSampler.contentEncoding"></stringProp> + <stringProp name="HTTPSampler.path">/pdp/api/getConfig</stringProp> + <stringProp name="HTTPSampler.method">POST</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> + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="JSR223 PostProcessor" enabled="true"> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="script">def rescode = prev.getResponseCode(); +vars.put('rescode', rescode);</stringProp> + <stringProp name="scriptLanguage">groovy</stringProp> + </JSR223PostProcessor> + <hashTree/> + <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer" enabled="true"> + <stringProp name="ConstantTimer.delay">${RETRY_WAIT}</stringProp> + </ConstantTimer> + <hashTree/> + <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="true"> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="script">def counter=vars.get('counter').toInteger(); +def retry=vars.get('RETRY').toInteger(); +def rescode = prev.getResponseCode(); + +if (counter >= retry && rescode !='200') { + //log.info('counter: ' + counter); + //log.info('retry: ' + retry); + AssertionResult.setFailure(true); + AssertionResult.setFailureMessage('get policy failed for resource ' + vars.get('RESID')); +} +</stringProp> + <stringProp name="scriptLanguage">groovy</stringProp> + </JSR223Assertion> + <hashTree/> + </hashTree> + <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Counter" enabled="true"> + <stringProp name="CounterConfig.start">1</stringProp> + <stringProp name="CounterConfig.end"></stringProp> + <stringProp name="CounterConfig.incr">1</stringProp> + <stringProp name="CounterConfig.name">counter</stringProp> + <stringProp name="CounterConfig.format"></stringProp> + <boolProp name="CounterConfig.per_user">true</boolProp> + <boolProp name="CounterConfig.reset_on_tg_iteration">true</boolProp> + </CounterConfig> + <hashTree/> + </hashTree> + </hashTree> + </hashTree> + </hashTree> +</jmeterTestPlan> |