Policy Framework CSIT Testing

The Continuous System and Integration Testing suites are run normally as a Jenkins job to assert that common usage of Policy Framework services are running as expected.

This article provides the steps to run CSIT tests in a local environment, most commonly after a significant code change.

Note

Both environments described in this page are for test or learning purposes only. For real deployment environment, use ONAP Operations Manager

Note

If building images locally, follow the instructions here

First, clone policy/docker repo from gerrit:

git clone "https://gerrit.onap.org/r/policy/docker"

On this whole article, it’s assumed the base folder for policy-docker repository is ~/git/policy/docker

Under the folder ~/git/policy/docker/csit, there are two main scripts to run the tests:

  • run-k8s-csit.sh

  • run-project-csit.sh

Running CSIT in Docker environment

If not familiar with the PF Docker structure, the detailed information can be found here

Running tests to validate code changes

For local images, run the script with the –local flag.

Note

Make sure to do the same changes to any other components that are using locally built images.

Then use the run-project-csit.sh script to run the test suite.

cd ~/git/policy/docker
./csit/run-project-csit.sh <component> --local

The <component> input is any of the policy components available:

  • api

  • pap

  • apex-pdp

  • distribution

  • drools-pdp

  • drools-applications

  • xacml-pdp

  • clamp

  • opa-pdp

Keep in mind that after the Robot executions, logs from docker-compose are printed and test logs might not be available on console and the containers are teared down. The tests results are available under ~/git/policy/docker/csit/archives/<component>/ folder.

Running tests for learning PF usage

In that case, no changes required on docker-compose files, but commenting the tear down of docker containers might be required. For that, run the run-project-csit.sh script with –no-exit flag:

cd ~/git/policy/docker
./csit/run-project-csit.sh <component> --local --no-exit
# or
./csit/run-project-csit.sh <component> --no-exit # will download images from nexus3 server

This way, the docker containers are still up and running for more investigation.

To tear them down, execute the stop-compose.sh script:

cd ~/git/policy/docker/compose
./stop-compose.sh

Running CSIT in Micro K8S environment

The microk8s version of Policy Framework was brought up for integration test in PF as whole, such as Stability and Performance tests, but can be used for CSIT validation as well. The helm charts are under ~/git/policy/docker/helm folder.

Running tests or installing one PF component

If needed to install or run tests for an specific PF component, the run-k8s-csit.sh script can be used to run the test suite or installation with the proper arguments.

cd ~/git/policy/docker
./csit/run-k8s-csit.sh install <component>

The <component> input is any of the policy components available:

  • api

  • pap

  • apex-pdp

  • distribution

  • drools-pdp

  • xacml-pdp

  • clamp

  • opa-pdp

Different from Docker usage, the microk8s installation is not removed when tests finish.

Installing all available PF components

Use the cluster_setup.sh script to install PF components with Prometheus server available.

cd ~/git/policy/docker/csit/resources/scripts
./cluster_setup.sh install

In this case, no tests are executed and the environment can be used for other integration tests such as Stability and Performance, Smoke tests or manual test.

Uninstall and clean up

If running the CSIT tests with microk8s environment, docker images for the tests suites are created. To clean them up, user docker prune command.

To uninstall policy helm deployment and/or the microk8s cluster, use cluster_setup.sh

cd ~/git/policy/docker

# to uninstall deployment
./csit/resources/scripts/cluster_setup.sh uninstall

# to remove cluster
./csit/resources/scripts/cluster_setup.sh clean

End of document