sunbeam-charms/CONTRIBUTING.md
Samuel Allan 5e40ba7d81
Add func tests for tempest-k8s charm
This is to verify that the tempest-k8s charm deploys successfully
(reaches active/idle, the tempest environment was set up successfully),
and doesn't adversely impact the rest of the sunbeam deployment.

Func tests with this charm have been observed to be unstable
(unexpected errors running certain tests),
so for now only minimal tests are added,
and it has been implemented in its own new test bundle.
This new test bundle is only triggered on changes in tempest-k8s code,
so it shouldn't affect the CI for other charms if it becomes unstable.

We still need to add more tests and debug the issues we were seeing,
but in the interests of time, we aim to implement these tests
and debug the issues in follow up patches.

Change-Id: I548eb07ed1eb9e67c46f62a16d36bfaec83d7040
2024-03-06 09:55:34 +10:30

1.2 KiB

Contributing

Using functional tests

The functional tests can be run locally. You will need microk8s configured, and juju bootstrapped on it. See ./zuul.d/zuul.yaml variables for the current supported versions of microk8s and juju as used for functional tests in CI.

Ensure microk8s is the active controller on juju, and run the tox target, with the appropriate zaza options to select the test config you want to run:

tox -e func -- --smoke --test-directory=tests/core

See the tox.ini file for specifically what is being run.

After running this, the juju model and the tox virtual environment will remain, so you can activate the virtual environment, and directly run zaza commands to re-run tests for debugging, etc.

For example:

source .tox/func/bin/activate

# fix the path to pick up the local test modules
export PYTHONPATH="tests/local:$PYTHONPATH"

# run a zaza command directly
functest-test -m zaza-1537f907eca2 -t zaza.sunbeam.charm_tests.tempest_k8s.tests.TempestK8sTest --test-directory tests/core

Note that you can run juju models to see the generated name for the zaza model used. The PYTHONPATH must also be updated to pick up the tests from ./tests/local/*, which is where the zaza tests are specifically for sunbeam-charms.