Update docs for distribution s3ps
[policy/parent.git] / docs / development / devtools / testing / s3p / distribution-s3p.rst
1 .. This work is licensed under a
2 .. Creative Commons Attribution 4.0 International License.
3 .. http://creativecommons.org/licenses/by/4.0
4
5 .. _distribution-s3p-label:
6
7 Policy Distribution component
8 #############################
9
10 72h Stability and 4h Performance Tests of Distribution
11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
12
13 Common Setup
14 ------------
15
16 The common setup for performance and stability tests is now automated - being carried out by a script in- **testsuites/run-sc3-test.sh**.
17
18 Clone the policy-distribution repo to access the test scripts
19
20 .. code-block:: bash
21
22     git clone https://gerrit.onap.org/r/policy/distribution
23
24 **The following common steps are carried out by the scripts**
25
26 * Updates the repo package lists for apt
27 * Installs Java 17 open jdk
28 * Installs docker
29 * Installs docker-compose
30 * Retrieves version information in environment variables from th release info file
31 * Builds relevant images including the pdp simulator
32 * Triggers docker compose to bring up containers required for the testing
33 * Installs jmeter
34 * Installs visualvm (and starts it in a GUI environment)
35 * Configures permissions for monitoring
36 * Starts jstatd
37 * Waits for containers to come up
38 * Runs either stability or performance tests for a specified duration depending on the arguments specified
39
40 For example, the below runs performance tests for 2 hours. Start from the root directory of policy distribution
41
42 .. code-block:: bash
43
44     cd testsuites
45     ./run-s3p-test.sh performance 7200
46
47 .. note::
48     The containers on this docker-compose are running with HTTP configuration. For HTTPS, ports
49     and configurations will need to be changed, as well certificates and keys must be generated
50     for security.
51
52 The script will load up the visualvm GUI on your virtual machine. You will need to manually connect
53 it to the distribution JMX port.
54
55 Connect to Distribution JMX Port.
56
57     1. On the visualvm toolbar, click on "Add JMX Connection"
58     2. Enter localhost as the IP address and Port 9090. This is the JMX port exposed by the
59        distribution container
60     3. Double click on the newly added nodes under "Local" to start monitoring CPU, Memory & GC.
61
62 Example Screenshot of visualVM
63
64 .. image:: distribution-s3p-results/distribution-visualvm-snapshot.png
65
66 Teardown Docker
67
68 Once the testing is finished, you can tear down the docker setup from **./testsuites** with:
69
70 .. code-block:: bash
71
72     docker-compose -f stability/src/main/resources/setup/docker-compose.yml down
73
74 Stability Test of Policy Distribution
75 +++++++++++++++++++++++++++++++++++++
76
77 Introduction
78 ------------
79
80 The 72 hour Stability Test for policy distribution has the goal of introducing a steady flow of
81 transactions initiated from a test client server running JMeter. The policy distribution is
82 configured with a special FileSystemReception plugin to monitor a local directory for newly added
83 csar files to be processed by itself. The input CSAR will be added/removed by the test client
84 (JMeter) and the result will be pulled from the backend (PAP and PolicyAPI) by the test client
85 (JMeter).
86
87 The test will be performed in an environment where Jmeter will continuously add/remove a test csar
88 into the special directory where policy distribution is monitoring and will then get the processed
89 results from PAP and PolicyAPI to verify the successful deployment of the policy. The policy will
90 then be undeployed and the test will loop continuously until 72 hours have elapsed.
91
92
93 Test Plan Sequence
94 ------------------
95
96 The 72h stability test will run the following steps sequentially in a single threaded loop.
97
98 - **Delete Old CSAR** - Checks if CSAR already exists in the watched directory, if so it deletes it
99 - **Add CSAR** - Adds CSAR to the directory that distribution is watching
100 - **Get Healthcheck** - Ensures Healthcheck is returning 200 OK
101 - **Get Metrics** - Ensures Metrics is returning 200 OK
102 - **Assert PDP Group Query** - Checks that PDPGroupQuery contains the deployed policy
103 - **Assert PoliciesDeployed** - Checks that the policy is deployed
104 - **Undeploy/Delete Policy** - Undeploys and deletes the Policy for the next loop
105 - **Assert PDP Group Query for Deleted Policy** - Ensures the policy has been removed and does not exist
106
107 The following steps can be used to configure the parameters of the test plan.
108
109 - **HTTP Authorization Manager** - used to store user/password authentication details.
110 - **HTTP Header Manager** - used to store headers which will be used for making HTTP requests.
111 - **User Defined Variables** -  used to store following user defined parameters.
112
113 ==========  ===============================================
114  **Name**    **Description**
115 ==========  ===============================================
116  PAP_HOST     IP Address or host name of PAP component
117  PAP_PORT     Port number of PAP for making REST API calls
118  API_HOST     IP Address or host name of API component
119  API_PORT     Port number of API for making REST API calls
120  DURATION     Duration of Test
121 ==========  ===============================================
122
123 Screenshot of Distribution stability test plan
124
125 .. image:: distribution-s3p-results/distribution-jmeter-testcases.png
126
127
128 Running the Test Plan
129 ---------------------
130
131 The main script takes care of everything. To run the 72 hour stability tests do as follows
132
133 .. code-block:: bash
134
135     cd testsuites
136     ./run-s3p-test.sh stability 259200
137
138 * visualvm produces the monitor and threads - we can screenshot those and add them to the test results
139 * A jmeter .jtl file is produced by the run - it is called distribution-stability.jtl
140 * The file can be imported into the jmeter GUI to view statistics
141 * The application performance index table can be produced with jmeter on the cli as below:ls
142
143 .. code-block:: bash
144
145     jmeter -n -t your_test_plan.jmx -l test_results.jtl -e -o report_directory
146
147 Test Results
148 ------------
149
150 **Summary**
151
152 - Stability test plan was triggered for 72 hours.
153 - No errors were reported
154
155 **Test Statistics**
156
157 .. image:: distribution-s3p-results/stability-statistics.png
158 .. image:: distribution-s3p-results/stability-threshold.png
159
160 **VisualVM Screenshots**
161
162 .. image:: distribution-s3p-results/stability-monitor.png
163 .. image:: distribution-s3p-results/stability-threads.png
164
165
166 Performance Test of Policy Distribution
167 +++++++++++++++++++++++++++++++++++++++
168
169 Introduction
170 ------------
171
172 The 4h Performance Test of Policy Distribution has the goal of testing the min/avg/max processing
173 time and rest call throughput for all the requests when the number of requests are large enough to
174 saturate the resource and find the bottleneck.
175
176 It also tests that distribution can handle multiple policy CSARs and that these are deployed within
177 60 seconds consistently.
178
179
180 Setup Details
181 -------------
182
183 The performance test is based on the same setup as the distribution stability tests. This setup is done by the main
184 **run-s3p-test.sh** script
185
186
187 Test Plan Sequence
188 ------------------
189
190 Performance test plan is different from the stability test plan.
191
192 - Instead of handling one policy csar at a time, multiple csar's are deployed within the watched
193   folder at the exact same time.
194 - We expect all policies from these csar's to be deployed within 60 seconds.
195 - There are also multithreaded tests running towards the healthcheck and statistics endpoints of
196   the distribution service.
197
198
199 Running the Test Plan
200 ---------------------
201
202 The main script takes care of everything. To run the 4 hour performance tests do as follows
203
204 .. code-block:: bash
205
206     cd testsuites
207     ./run-s3p-test.sh performance 14400
208
209 * visualvm produces the monitor and threads - we can screenshot those and add them to the test results
210 * A jmeter .jtl file is produced by the run - it is called distribution-performance.jtl
211 * The file can be imported into the jmeter GUI to view statistics
212 * The application performance index table can be produced with jmeter on the cli as below:
213
214 .. code-block:: bash
215
216     jmeter -n -t your_test_plan.jmx -l test_results.jtl -e -o report_directory
217
218 This produced html pages where statistics tables can be seen and added to the results.
219
220 Test Results
221 ------------
222
223 **Summary**
224
225 - Performance test plan was triggered for 4 hours.
226 - No errors were reported
227
228 **Test Statistics**
229
230 .. image:: distribution-s3p-results/performance-statistics.png
231 .. image:: distribution-s3p-results/performance-threshold.png
232
233 **VisualVM Screenshots**
234
235 .. image:: distribution-s3p-results/performance-monitor.png
236 .. image:: distribution-s3p-results/performance-threads.png
237
238 End of document