1 .. This work is licensed under a
2 .. Creative Commons Attribution 4.0 International License.
3 .. http://creativecommons.org/licenses/by/4.0
7 Policy Framework CSIT Testing
8 #############################
13 The Continuous System and Integration Testing suites are run normally as a Jenkins job to assert
14 that common usage of Policy Framework services are running as expected.
16 This article provides the steps to run CSIT tests in a local environment, most commonly after a
17 significant code change.
20 If building images locally, follow the instructions :ref:`here <building-pf-docker-images-label>`
23 First, clone policy/docker repo from gerrit:
27 git clone "https://gerrit.onap.org/r/policy/docker"
29 On this whole article, it's assumed the base folder for policy-docker repository is
32 Under the folder `~/git/policy/docker/csit`, there are two main scripts to run the tests:
38 Running CSIT in Docker environment
39 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
41 If not familiar with the PF Docker structure, the detailed information can be found :ref:`here <docker-label>`
43 Running tests to validate code changes
44 --------------------------------------
46 After building image(s) locally, the compose file needs to be edited to use the local image when
47 bringing up the container. Open file `~/git/policy/docker/compose/docker-compose.yml` and remove the
48 tag `${CONTAINER_LOCATION}` from the image variable in the service description.
49 If change is GUI related, then `docker-compose.gui.yml` might need to be edited as well, although
50 there are no GUI related test suites.
52 For example, if testing against a PAP change, a new onap/policy-pap image with latest and
53 x.y.z-SNAPSHOT versions is available. When editing the docker-compose file, the following change
61 image: ${CONTAINER_LOCATION}onap/policy-pap:${POLICY_PAP_VERSION}
62 container_name: policy-pap
70 image: onap/policy-pap:latest
71 container_name: policy-pap
75 Make sure to do the same changes to any other components that are using locally built images.
78 After finished with edits in compose file, then use the `run-project-csit.sh` script to run the
84 cd ~/git/policy/docker
85 ./csit/run-project-csit.sh <component>
88 The <component> input is any of the policy components available:
99 Keep in mind that after the Robot executions, logs from docker-compose are printed and
100 test logs might not be available on console and the containers are teared down. The tests results
101 are available under `~/git/policy/docker/csit/archives/<component>/` folder.
104 Running tests for learning PF usage
105 -----------------------------------
107 In that case, no changes required on docker-compose files, but commenting the tear down of docker
108 containers might be required. For that, edit the file `run-project-csit.sh` script and comment the
113 # source_safely ${WORKSPACE}/compose/stop-compose.sh (currently line 36)
116 This way, the docker containers are still up and running for more investigation.
118 To tear them down, execute the `stop-compose.sh` script:
122 cd ~/git/policy/docker/compose
126 Running CSIT in Micro K8S environment
127 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
129 The microk8s version of Policy Framework was brought up for integration test in PF as whole, such
130 as Stability and Performance tests, but can be used for CSIT validation as well. The helm charts
131 are under `~/git/policy/docker/helm` folder.
134 Running tests or installing one PF component
135 --------------------------------------------
137 If needed to install or run tests for an specific PF component, the `run-k8s-csit.sh` script can be
138 used to run the test suite or installation with the proper arguments.
143 cd ~/git/policy/docker
144 ./csit/run-k8s-csit.sh install <component>
147 The <component> input is any of the policy components available:
158 Different from Docker usage, the microk8s installation is not removed when tests finish.
161 Installing all available PF components
162 --------------------------------------
164 Use the `run-k8s-csit.sh` script to install PF components with Prometheus server available.
168 cd ~/git/policy/docker
169 ./csit/run-k8s-csit.sh install
172 In this case, no tests are executed and the environment can be used for other integration tests
173 such as Stability and Performance, Smoke tests or manual test.
176 Uninstall and clean up
177 ----------------------
179 If running the CSIT tests with microk8s environment, docker images for the tests suites are created.
180 To clean them up, user `docker prune <https://docs.docker.com/config/pruning/>`_ command.
182 To uninstall policy helm deployment and/or the microk8s cluster, use `run-k8s-csit.sh`
187 cd ~/git/policy/docker
189 # to uninstall deployment
190 ./csit/run-k8s-csit.sh uninstall
193 ./csit/run-k8s-csit.sh clean