update the docs of testing
[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 offcial 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/tests`_. This test script
22 can be used for functional testing agained an OPNFV deployment.
23
24 .. _doctor/tests: https://gerrit.opnfv.org/gerrit/gitweb?p=doctor.git;a=tree;f=tests;
25
26 Before running this script, make sure OpenStack env parameters are set properly
27 following `OpenStack CLI manual`_, so that Doctor Inspector can operate
28 OpenStack services.
29
30 .. _OpenStack CLI manual: https://docs.openstack.org/user-guide/common/cli-set-environment-variables-using-openstack-rc.html
31
32 Run Bash Test Script
33 ~~~~~~~~~~~~~~~~~~~~
34
35 You can run the bash script as follows:
36
37 .. code-block:: bash
38
39     git clone https://gerrit.opnfv.org/gerrit/doctor
40     cd doctor/tests
41     export INSTALLER_TYPE=local
42     export INSPECTOR_TYPE=sample
43     ./run.sh
44
45 INSTALLER_TYPE can be 'apex', 'fuel', 'joid' and 'local'(default). If you are
46 not using OPNFV installers in this option, chose 'local'.
47 INSPECTOR_TYPE can be specified either 'sample'(default) or 'congress'.
48
49 For testing with stable version, checkout stable branch of doctor repo before
50 './run.sh'.
51
52 The bash test script will be deprecated(only bug fixes) after E Release.
53
54 Run Python Test Script
55 ~~~~~~~~~~~~~~~~~~~~~~
56
57 You can run the python script as follows:
58
59 .. code-block:: bash
60
61     git clone https://gerrit.opnfv.org/gerrit/doctor
62     cd doctor && tox
63
64 You can see all the configurations with default values in sample configuration
65 file `doctor.sample.conf`_. And you can also modify the file to meet your
66 environment and then run the test.
67
68 .. _doctor.sample.conf: https://git.opnfv.org/doctor/tree/etc/doctor.sample.conf
69
70 Run Functest Suite
71 ==================
72
73 Functest supports Doctor testing by triggering the test script above in a
74 Functest container. You can run the Doctor test with the following steps:
75
76 .. code-block:: bash
77
78     DOCKER_TAG=latest
79     docker pull docker.io/opnfv/functest-features:${DOCKER_TAG}
80     docker run --privileged=true -id \
81         -e INSTALLER_TYPE=${INSTALLER_TYPE} \
82         -e INSTALLER_IP=${INSTALLER_IP} \
83         -e INSPECTOR_TYPE=sample \
84         docker.io/opnfv/functest-features:${DOCKER_TAG} /bin/bash
85     docker exec <container_id> functest env prepare
86     docker exec <container_id> functest testcase run doctor-notification
87
88 See `Functest Userguide`_ for more information.
89
90 .. _Functest Userguide: http://docs.opnfv.org/en/latest/submodules/functest/docs/testing/user/userguide/index.html
91
92 For testing with stable version, change DOCKER_TAG to 'stable' or other release
93 tag identifier.
94
95 Tips
96 ====