Extend guide for running Tobiko using ci-framework

Change-Id: I11a4b98061208339472a688c50b055c5337536a3
This commit is contained in:
jmarcian
2025-04-22 05:13:20 +03:00
committed by Julia Mariano
parent ae4ac161c2
commit 8bb99bc67e
3 changed files with 86 additions and 1 deletions

View File

@@ -0,0 +1,57 @@
Prepare tobiko test pod to run tobiko tests
You may want to run tests from the tobiko test pod. To enable that, some more steps are required:
Log in to the tobiko test pod::
$ oc rsh <tobiko-test pod name> /bin/bash
bash-5.1$ cd ~
bash-5.1$ pwd
/var/lib/tobiko
bash-5.1$ cd tobiko/
Export the OS_CLOUD value::
$ export OS_CLOUD=default
To run tests dedicated for podified environment you will need to authenticate the openshift cluster from the tobiko pod before running them::
$ cp /var/lib/tobiko/.kube/config /tmp/kubeconfig
$ sudo chmod a+w /tmp/kubeconfig
$ export KUBECONFIG=/tmp/kubeconfig
$ oc login -u kubeadmin -p ...
Now, when the pod is ready to run tobiko, you can modify the code and test it locally.
For example::
$ tox -e scenario
$ tox -e sanity -- tobiko/tests/sanity/nova/test_server.py::CrateDeleteServerStackTest::test_1_create_server
$ tox -e podified_ha_faults -- tobiko/tests/faults/podified/ha/test_cloud_recovery.py::DisruptPodifiedNodesTest::test_remove_one_grastate_galera
To monitor the progress of the tests, log in the test pod from another terminal window and run::
$ cd ~/tobiko
$ tail -F tobiko.log
Tip:
You may want to test your tobiko code locally using ipython.
To install ipython, first, create tox virtual environment::
$ cd ~/tobiko/
$ tox -e py3 -- notests
Then, install and run ipython::
$ .tox/py3/bin/pip install ipython
$ .tox/py3/bin/ipython
Tip
You can use the openstack client binary that is installed under the tobiko tox virtual environment::
$ .tox/py3/bin/openstack --insecure service list
Or, in more common way, by accessing the openstackclient pod::
$ oc exec openstackclient -- openstack server list

View File

@@ -15,7 +15,7 @@ Install required ansible-galaxy dependencies::
$ cd ci-framework
$ ansible-galaxy install -r requirements.yml
Additonally create directory where ci-framework and Test-operator will store
Additionally create directory where ci-framework and Test-operator will store
some data. In the example below it is `/tmp/ci-fmw`::
$ mkdir /tmp/ci-fmw
@@ -47,3 +47,26 @@ There is also ``cifmw_test_operator_tobiko_debug`` which if set to `True` will
prevent Tobiko POD to be deleted. After tests will finish, POD will still be
there and it will be possible to connect to it and run or even modify Tobiko
tests as needed.
Now you can run tobiko tests using the `08-run-tests.yml` playbook::
$ ansible-playbook -i <ci-framework inventory file> -vv \
-e @custom/tobiko_vars.yaml
playbooks/08-run-tests.yml --flush-cache $@
And watch tobiko test pod being created::
$ watch 'oc get pods -A | grep "tobiko\|test-operator"'
Test results should be found under::
{{ ansible_user_dir }}/ci-framework-data/tests/test-operator/ directory
Cleanup:
If ``cifmw_test_operator_cleanup`` was set to ``false``, you may want to clean up all the resources created by the test
operator, before you run tobiko tests again::
$ oc -n openstack delete tempest/tempest-tests-tempest
$ oc -n openstack delete tobiko/tobiko-tests-tobiko # Continue for other test resources (e. g. horizon), if deployed.
$ oc -n openstack get pods -o name | grep test-operator-logs-pod | xargs -r oc -n openstack delete

View File

@@ -73,6 +73,11 @@ Running Tobiko Test Cases in the Podified environment using ci-framework
.. include:: _run_using_ci_framework.rst
Prepare Tobiko Test Pod to run Tobiko
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. include:: _prepare_tobiko_test_pod.rst
Test Cases Report Files
~~~~~~~~~~~~~~~~~~~~~~~