Merge "Add script to generate the OpenStack defaults"
[functest.git] / docs / userguide / runfunctest.rst
1 Executing the functest suites
2 =============================
3
4 Manual testing
5 --------------
6
7 Once the Functest docker container is running and Functest environment ready
8 (through /home/opnfv/repos/functest/docker/prepare_env.sh script), the system is
9 ready to run the tests.
10
11 The script *run_tests.sh* is located in $repos_dir/functest/docker and it has
12 several options::
13
14     ./run_tests.sh -h
15     Script to trigger the tests automatically.
16
17     usage:
18         bash run_tests.sh [--offline] [-h|--help] [-t <test_name>]
19
20     where:
21         -h|--help         show this help text
22         -r|--report       push results to database (false by default)
23         -n|--no-clean     do not clean up OpenStack resources after test run
24         -t|--test         run specific set of tests
25           <test_name>     one or more of the following: vping,vping_userdata,odl,rally,tempest,vims,onos,promise. Separated by comma.
26
27     examples:
28         run_tests.sh
29         run_tests.sh --test vping,odl
30         run_tests.sh -t tempest,rally --no-clean
31
32 The *-r* option is used by the Continuous Integration in order to push the test
33 results into a test collection database, see in next section for details.
34 In manual mode, you must not use it, your try will be anyway probably rejected
35 as your POD must be declared in the database to collect the data.
36
37 The *-n* option is used for preserving all the existing OpenStack resources after
38 execution test cases.
39
40 The *-t* option can be used to specify the list of test you want to launch, by
41 default Functest will try to launch all its test suites in the following order
42 vPing, odl, Tempest, vIMS, Rally.
43 You may launch only one single test by using *-t <the test you want to launch>*.
44
45 Within Tempest test suite you can define which test cases you want to execute in
46 your environment by editing test_list.txt file before executing *run_tests.sh*
47 script.
48
49 Please note that Functest includes cleaning mechanism in order to remove
50 everything except what was present after a fresh install.
51 If you create your own VMs, tenants, networks etc. and then launch Functest,
52 they all will be deleted after executing the tests. Use the *--no-clean* option with
53 run_test.sh in order to preserve all the existing resources.
54 However, be aware that Tempest and Rally create of lot of resources (users,
55 tenants, networks, volumes etc.) that are not always properly cleaned, so this
56 cleaning function has been set to keep the system as clean as possible after a
57 full Functest run.
58
59 You may also add you own test by adding a section into the function run_test().
60
61
62 Automated testing
63 -----------------
64
65 As mentioned in `[1]`, the *prepare-env.sh* and *run_test.sh* can be executed within
66 the container from jenkins.
67 2 jobs have been created, one to run all the test and one that allows testing
68 test suite by test suite.
69 You thus just have to launch the acurate jenkins job on the target lab, all the
70 tests shall be automatically run.
71
72 When the tests are automatically started from CI, a basic algorithm has been
73 created in order to detect whether the test is runnable or not on the given
74 scenario.
75 In fact, one of the most challenging task in Brahmaputra consists in dealing
76 with lots of scenario and installers.
77 Functest test suites cannot be systematically run (e.g. run the ODL suite on an
78 ONOS scenario).
79
80 CI provides several information:
81
82  * The installer (apex|compass|fuel|joid)
83  * The scenario [controller]-[feature]-[mode] with
84
85    * controller = (odl|onos|ocl|nosdn)
86    * feature = (ovs(dpdk)|kvm)
87    * mode = (ha|noha)
88
89 Constraints per test case are defined in the Functest configuration file
90 /home/opnfv/functest/config/config_functest.yaml::
91
92  test-dependencies:
93     functest:
94         vims:
95             scenario: '(ocl)|(odl)|(nosdn)'
96         vping:
97         vping_userdata:
98             scenario: '(ocl)|(odl)|(nosdn)'
99         tempest:
100         rally:
101         odl:
102             scenario: 'odl'
103         onos:
104             scenario: 'onos'
105         ....
106
107 At the end of the Functest environment creation (prepare_env.sh see `[1]`_), a
108 file (/home/opnfv/functest/conf/testcase-list.txt) is created with the list of
109 all the runnable tests.
110 We consider the static constraints as regex and compare them with the scenario.
111 For instance, odl can be run only on scenario including odl in its name.
112
113 The order of execution is also described in the Functest configuration file::
114
115  test_exec_priority:
116
117     1: vping
118     2: vping_userdata
119     3: tempest
120     4: odl
121     5: onos
122     6: ovno
123     7: doctor
124     8: promise
125     9: odl-vpnservice
126     10: bgpvpn
127     11: openstack-neutron-bgpvpn-api-extension-tests
128     12: vims
129     13: rally
130
131 The tests are executed as follow:
132
133  * Basic scenario (vPing, vPing_userdata, Tempest)
134  * Controller suites: ODL or ONOS or OpenContrail
135  * Feature projects
136  * vIMS
137  * Rally (benchmark scenario)
138
139 At the end of an automated execution, everything is cleaned.
140 We keep only the users/networks that have been statically declared in 'https://git.opnfv.org/cgit/functest/tree/testcases/VIM/OpenStack/CI/libraries/os_defaults.yaml'_