a4b9ffa64c9f60d4c38a12fcb98fa47557aa5bdf
[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     #Run both tests cases
42     export TEST_CASE='all'
43
44 Run Python Test Script
45 ~~~~~~~~~~~~~~~~~~~~~~
46
47 You can run the python script as follows:
48
49 .. code-block:: bash
50
51     git clone https://gerrit.opnfv.org/gerrit/doctor
52     cd doctor && tox
53
54 You can see all the configurations with default values in sample configuration
55 file `doctor.sample.conf`_. And you can also modify the file to meet your
56 environment and then run the test.
57
58 .. _doctor.sample.conf: https://git.opnfv.org/doctor/tree/etc/doctor.sample.conf
59
60 In OPNFV Apex jumphost you can run Doctor testing as follows using tox:
61
62 .. code-block:: bash
63
64     #Before Gambia: overcloudrc.v3
65     source overcloudrc
66     export INSTALLER_IP=${INSTALLER_IP}
67     export INSTALLER_TYPE=${INSTALLER_TYPE}
68     git clone https://gerrit.opnfv.org/gerrit/doctor
69     cd doctor
70     sudo -E tox
71
72 Run Functest Suite
73 ==================
74
75 Functest supports Doctor testing by triggering the test script above in a
76 Functest container. You can run the Doctor test with the following steps:
77
78 .. code-block:: bash
79
80     DOCKER_TAG=latest
81     docker pull docker.io/opnfv/functest-features:${DOCKER_TAG}
82     docker run --privileged=true -id \
83         -e INSTALLER_TYPE=${INSTALLER_TYPE} \
84         -e INSTALLER_IP=${INSTALLER_IP} \
85         -e INSPECTOR_TYPE=sample \
86         docker.io/opnfv/functest-features:${DOCKER_TAG} /bin/bash
87     docker exec <container_id> functest testcase run doctor-notification
88
89 See `Functest Userguide`_ for more information.
90
91 .. _Functest Userguide: :doc:`<functest:testing/user/userguide>`
92
93
94 For testing with stable version, change DOCKER_TAG to 'stable' or other release
95 tag identifier.
96
97 Tips
98 ====