1 <?xml version="1.0" encoding="UTF-8"?>
2 <jmeterTestPlan version="1.2" properties="5.0" jmeter="5.0 r1840935">
4 <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Policy API Performance" enabled="true">
5 <stringProp name="TestPlan.comments">Policy API Performance Tests</stringProp>
6 <boolProp name="TestPlan.functional_mode">false</boolProp>
7 <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
8 <boolProp name="TestPlan.serialize_threadgroups">true</boolProp>
9 <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
10 <collectionProp name="Arguments.arguments">
11 <elementProp name="POLICY_API_HOST" elementType="Argument">
12 <stringProp name="Argument.name">POLICY_API_HOST</stringProp>
13 <stringProp name="Argument.value">${__P(host,127.0.0.1)}</stringProp>
14 <stringProp name="Argument.metadata">=</stringProp>
16 <elementProp name="DURATION" elementType="Argument">
17 <stringProp name="Argument.name">DURATION</stringProp>
18 <stringProp name="Argument.value">${__P(duration, 5)}</stringProp>
19 <stringProp name="Argument.metadata">=</stringProp>
21 <elementProp name="USERS" elementType="Argument">
22 <stringProp name="Argument.name">USERS</stringProp>
23 <stringProp name="Argument.value">${__P(users, 1)}</stringProp>
24 <stringProp name="Argument.metadata">=</stringProp>
26 <elementProp name="PORT" elementType="Argument">
27 <stringProp name="Argument.name">PORT</stringProp>
28 <stringProp name="Argument.value">${__P(port, 6969)}</stringProp>
29 <stringProp name="Argument.metadata">=</stringProp>
33 <stringProp name="TestPlan.user_define_classpath"></stringProp>
36 <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Health Check API" enabled="true">
37 <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
38 <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
39 <boolProp name="LoopController.continue_forever">false</boolProp>
40 <intProp name="LoopController.loops">-1</intProp>
42 <stringProp name="ThreadGroup.num_threads">${USERS}</stringProp>
43 <stringProp name="ThreadGroup.ramp_time">1</stringProp>
44 <boolProp name="ThreadGroup.scheduler">true</boolProp>
45 <stringProp name="ThreadGroup.duration">${DURATION}</stringProp>
46 <stringProp name="ThreadGroup.delay">1</stringProp>
49 <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Check Health" enabled="true">
50 <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
51 <collectionProp name="Arguments.arguments"/>
53 <stringProp name="HTTPSampler.domain">${POLICY_API_HOST}</stringProp>
54 <stringProp name="HTTPSampler.port">6969</stringProp>
55 <stringProp name="HTTPSampler.protocol">https</stringProp>
56 <stringProp name="HTTPSampler.contentEncoding"></stringProp>
57 <stringProp name="HTTPSampler.path">policy/api/v1/healthcheck</stringProp>
58 <stringProp name="HTTPSampler.method">GET</stringProp>
59 <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
60 <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
61 <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
62 <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
63 <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
64 <stringProp name="HTTPSampler.connect_timeout"></stringProp>
65 <stringProp name="HTTPSampler.response_timeout"></stringProp>
66 <stringProp name="TestPlan.comments">Basic Health Check</stringProp>
69 <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
70 <collectionProp name="Asserion.test_strings">
71 <stringProp name="49586">200</stringProp>
73 <stringProp name="Assertion.custom_message"></stringProp>
74 <stringProp name="Assertion.test_field">Assertion.response_code</stringProp>
75 <boolProp name="Assertion.assume_success">false</boolProp>
76 <intProp name="Assertion.test_type">1</intProp>
79 <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="true">
80 <stringProp name="scriptLanguage">groovy</stringProp>
81 <stringProp name="parameters"></stringProp>
82 <stringProp name="filename"></stringProp>
83 <stringProp name="cacheKey">true</stringProp>
84 <stringProp name="script">import groovy.json.JsonSlurper;
87 if (prev.getResponseCode() == '200') {
88 def jsonSlurper = new JsonSlurper();
89 res = jsonSlurper.parseText(prev.getResponseDataAsString());
91 assert res instanceof Map;
92 assert res.code == 200;
93 assert res.name == "Policy API";
94 assert res.healthy==true;
95 assert res.message=="alive";
101 <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true">
102 <collectionProp name="HeaderManager.headers">
103 <elementProp name="" elementType="Header">
104 <stringProp name="Header.name">Accept</stringProp>
105 <stringProp name="Header.value">application/json</stringProp>
107 <elementProp name="" elementType="Header">
108 <stringProp name="Header.name">Content-Type</stringProp>
109 <stringProp name="Header.value">application/json</stringProp>
114 <AuthManager guiclass="AuthPanel" testclass="AuthManager" testname="HTTP Authorization Manager" enabled="true">
115 <collectionProp name="AuthManager.auth_list">
116 <elementProp name="" elementType="Authorization">
117 <stringProp name="Authorization.url">https://${POLICY_API_HOST}:6969/policy/api/v1/healthcheck</stringProp>
118 <stringProp name="Authorization.username">healthcheck</stringProp>
119 <stringProp name="Authorization.password">zb!XztG34</stringProp>
120 <stringProp name="Authorization.domain"></stringProp>
121 <stringProp name="Authorization.realm"></stringProp>
124 <boolProp name="AuthManager.clearEachIteration">true</boolProp>
127 <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
128 <boolProp name="ResultCollector.error_logging">false</boolProp>
130 <name>saveConfig</name>
131 <value class="SampleSaveConfiguration">
133 <latency>true</latency>
134 <timestamp>true</timestamp>
135 <success>true</success>
138 <message>true</message>
139 <threadName>true</threadName>
140 <dataType>true</dataType>
141 <encoding>false</encoding>
142 <assertions>true</assertions>
143 <subresults>true</subresults>
144 <responseData>false</responseData>
145 <samplerData>false</samplerData>
147 <fieldNames>true</fieldNames>
148 <responseHeaders>false</responseHeaders>
149 <requestHeaders>false</requestHeaders>
150 <responseDataOnError>false</responseDataOnError>
151 <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
152 <assertionsResultsToSave>0</assertionsResultsToSave>
154 <sentBytes>true</sentBytes>
156 <threadCounts>true</threadCounts>
157 <idleTime>true</idleTime>
158 <connectTime>true</connectTime>
161 <stringProp name="filename">/tmp/api_perf_health.log</stringProp>
165 <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Statistics Check API" enabled="true">
166 <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
167 <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
168 <boolProp name="LoopController.continue_forever">false</boolProp>
169 <intProp name="LoopController.loops">-1</intProp>
171 <stringProp name="ThreadGroup.num_threads">${USERS}</stringProp>
172 <stringProp name="ThreadGroup.ramp_time">1</stringProp>
173 <boolProp name="ThreadGroup.scheduler">true</boolProp>
174 <stringProp name="ThreadGroup.duration">${DURATION}</stringProp>
175 <stringProp name="ThreadGroup.delay">1</stringProp>
178 <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Check Statistics API" enabled="true">
179 <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
180 <collectionProp name="Arguments.arguments"/>
182 <stringProp name="HTTPSampler.domain">${POLICY_API_HOST}</stringProp>
183 <stringProp name="HTTPSampler.port">6969</stringProp>
184 <stringProp name="HTTPSampler.protocol">https</stringProp>
185 <stringProp name="HTTPSampler.contentEncoding"></stringProp>
186 <stringProp name="HTTPSampler.path">policy/api/v1/statistics</stringProp>
187 <stringProp name="HTTPSampler.method">GET</stringProp>
188 <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
189 <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
190 <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
191 <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
192 <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
193 <stringProp name="HTTPSampler.connect_timeout"></stringProp>
194 <stringProp name="HTTPSampler.response_timeout"></stringProp>
195 <stringProp name="TestPlan.comments">Basic Health Check</stringProp>
198 <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
199 <collectionProp name="Asserion.test_strings">
200 <stringProp name="49586">200</stringProp>
202 <stringProp name="Assertion.custom_message"></stringProp>
203 <stringProp name="Assertion.test_field">Assertion.response_code</stringProp>
204 <boolProp name="Assertion.assume_success">false</boolProp>
205 <intProp name="Assertion.test_type">1</intProp>
208 <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="true">
209 <stringProp name="scriptLanguage">groovy</stringProp>
210 <stringProp name="parameters"></stringProp>
211 <stringProp name="filename"></stringProp>
212 <stringProp name="cacheKey">true</stringProp>
213 <stringProp name="script">import groovy.json.JsonSlurper;
216 if (prev.getResponseCode() == '200') {
217 def jsonSlurper = new JsonSlurper();
218 res = jsonSlurper.parseText(prev.getResponseDataAsString());
220 assert res instanceof Map;
221 assert res.code == 200;
222 assert res.totalApiCallCount == 0;
223 assert res.apiCallSuccessCount==0;
224 assert res.apiCallFailureCount==0;
225 assert res.totalPolicyGetCount==0;
226 assert res.totalPolicyPostCount==0;
227 assert res.policyGetSuccessCount==0;
228 assert res.policyGetFailureCount==0;
235 <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true">
236 <collectionProp name="HeaderManager.headers">
237 <elementProp name="" elementType="Header">
238 <stringProp name="Header.name">Accept</stringProp>
239 <stringProp name="Header.value">application/json</stringProp>
241 <elementProp name="" elementType="Header">
242 <stringProp name="Header.name">Content-Type</stringProp>
243 <stringProp name="Header.value">application/json</stringProp>
248 <AuthManager guiclass="AuthPanel" testclass="AuthManager" testname="HTTP Authorization Manager" enabled="true">
249 <collectionProp name="AuthManager.auth_list">
250 <elementProp name="" elementType="Authorization">
251 <stringProp name="Authorization.url">https://${POLICY_API_HOST}:6969/policy/api/v1/statistics</stringProp>
252 <stringProp name="Authorization.username">healthcheck</stringProp>
253 <stringProp name="Authorization.password">zb!XztG34</stringProp>
254 <stringProp name="Authorization.domain"></stringProp>
255 <stringProp name="Authorization.realm"></stringProp>
258 <boolProp name="AuthManager.clearEachIteration">true</boolProp>
261 <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
262 <boolProp name="ResultCollector.error_logging">false</boolProp>
264 <name>saveConfig</name>
265 <value class="SampleSaveConfiguration">
267 <latency>true</latency>
268 <timestamp>true</timestamp>
269 <success>true</success>
272 <message>true</message>
273 <threadName>true</threadName>
274 <dataType>true</dataType>
275 <encoding>false</encoding>
276 <assertions>true</assertions>
277 <subresults>true</subresults>
278 <responseData>false</responseData>
279 <samplerData>false</samplerData>
281 <fieldNames>true</fieldNames>
282 <responseHeaders>false</responseHeaders>
283 <requestHeaders>false</requestHeaders>
284 <responseDataOnError>false</responseDataOnError>
285 <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
286 <assertionsResultsToSave>0</assertionsResultsToSave>
288 <sentBytes>true</sentBytes>
290 <threadCounts>true</threadCounts>
291 <idleTime>true</idleTime>
292 <connectTime>true</connectTime>
295 <stringProp name="filename">/tmp/api_perf_stats.log</stringProp>