diff --git a/doc/source/user/_prepare_tobiko_test_pod.rst b/doc/source/user/_prepare_tobiko_test_pod.rst new file mode 100644 index 000000000..6981c5cc4 --- /dev/null +++ b/doc/source/user/_prepare_tobiko_test_pod.rst @@ -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 /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 diff --git a/doc/source/user/_run_using_ci_framework.rst b/doc/source/user/_run_using_ci_framework.rst index 77166ddbd..1190418f2 100644 --- a/doc/source/user/_run_using_ci_framework.rst +++ b/doc/source/user/_run_using_ci_framework.rst @@ -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 -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 diff --git a/doc/source/user/run-test-cases.rst b/doc/source/user/run-test-cases.rst index ca77f2100..57ce20080 100644 --- a/doc/source/user/run-test-cases.rst +++ b/doc/source/user/run-test-cases.rst @@ -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 ~~~~~~~~~~~~~~~~~~~~~~~