Hunter release documentation
[doctor.git] / docs / development / overview / testing.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3
4 ==============
5 Testing Doctor
6 ==============
7
8 You have two options to test Doctor functions with the script developed
9 for doctor CI.
10
11 You need to install OpenStack and other OPNFV components except Doctor Sample
12 Inspector, Sample Monitor and Sample Consumer, as these will be launched in
13 this script. You are encouraged to use OPNFV official installers, but you can
14 also deploy all components with other installers such as devstack or manual
15 operation. In those cases, the versions of all components shall be matched with
16 the versions of them in OPNFV specific release.
17
18 Run Test Script
19 ===============
20
21 Doctor project has own testing script under `doctor/doctor_tests`_. This test script
22 can be used for functional testing agained an OPNFV deployment.
23
24 .. _doctor/doctor_tests: https://git.opnfv.org/doctor/tree/doctor_tests
25
26 Before running this script, make sure OpenStack env parameters are set properly
27 (See e.g. `OpenStackClient Configuration`_), so that Doctor Inspector can operate
28 OpenStack services.
29
30 .. _OpenStackClient Configuration: https://docs.openstack.org/python-openstackclient/latest/configuration/index.html
31
32 Doctor now supports different test cases and for that you might want to
33 export TEST_CASE with different values:
34
35 .. code-block:: bash
36
37     #Fault management (default)
38     export TEST_CASE='fault_management'
39     #Maintenance (requires 3 compute nodes)
40     export TEST_CASE='maintenance'
41     #Use Fenix in maintenance testing instead of sample admin_tool
42     export ADMIN_TOOL_TYPE='fenix'
43     #Run both tests cases
44     export TEST_CASE='all'
45
46 Run Python Test Script
47 ~~~~~~~~~~~~~~~~~~~~~~
48
49 You can run the python script as follows:
50
51 .. code-block:: bash
52
53     git clone https://gerrit.opnfv.org/gerrit/doctor
54     cd doctor && tox
55
56 You can see all the configurations with default values in sample configuration
57 file `doctor.sample.conf`_. And you can also modify the file to meet your
58 environment and then run the test.
59
60 .. _doctor.sample.conf: https://git.opnfv.org/doctor/tree/etc/doctor.sample.conf
61
62 In OPNFV Apex jumphost you can run Doctor testing as follows using tox:
63
64 .. code-block:: bash
65
66     source overcloudrc
67     export INSTALLER_IP=${INSTALLER_IP}
68     export INSTALLER_TYPE=${INSTALLER_TYPE}
69     git clone https://gerrit.opnfv.org/gerrit/doctor
70     cd doctor
71     sudo -E tox
72
73 Run Functest Suite
74 ==================
75
76 Functest supports Doctor testing by triggering the test script above in a
77 Functest container. You can run the Doctor test with the following steps:
78
79 .. code-block:: bash
80
81     DOCKER_TAG=latest
82     docker pull docker.io/opnfv/functest-features:${DOCKER_TAG}
83     docker run --privileged=true -id \
84         -e INSTALLER_TYPE=${INSTALLER_TYPE} \
85         -e INSTALLER_IP=${INSTALLER_IP} \
86         -e INSPECTOR_TYPE=sample \
87         docker.io/opnfv/functest-features:${DOCKER_TAG} /bin/bash
88     docker exec <container_id> functest testcase run doctor-notification
89
90 See `Functest Userguide`_ for more information.
91
92 .. _Functest Userguide: :doc:`<functest:testing/user/userguide>`
93
94
95 For testing with stable version, change DOCKER_TAG to 'stable' or other release
96 tag identifier.
97
98 Tips
99 ====