1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
4 Executing the functest suites
5 =============================
10 This section assumes the following:
11 * The Functest Docker container is running
12 * The docker prompt is shown
13 * The Functest environment is ready (prepare_env.sh has been executed)
15 If any of the above steps is missing please refer to the Functest Config Guide
16 as they are a prerequisite and all the commands explained in this section **must** be
17 performed **inside the container**.
19 The script **run_tests.sh** launches the test in an automated way.
20 Although it is possible to execute the different tests manually, it is
21 recommended to use the previous shell script which makes the call
22 to the actual scripts with the appropriate parameters.
24 It is located in *$repos_dir/functest/docker* and it has
28 Script to trigger the tests automatically.
31 bash run_tests.sh [-h|--help] [-r|--report] [-n|--no-clean] [-t|--test <test_name>]
34 -h|--help show this help text
35 -r|--report push results to database (false by default)
36 -n|--no-clean do not clean up OpenStack resources after test run
37 -s|--serial run tests in one thread
38 -t|--test run specific set of tests
39 <test_name> one or more of the following separated by comma:
40 vping_ssh,vping_userdata,odl,onos,tempest,rally,vims,promise,doctor
44 run_tests.sh --test vping,odl
45 run_tests.sh -t tempest,rally --no-clean
47 The *-r* option is used by the OPNFV Continuous Integration automation mechanisms
48 in order to push the test results into the NoSQL results collection database.
49 This database is read only for a regular user given that it needs special rights
50 and special conditions to push data.
52 The *-t* option can be used to specify the list of a desired test to be launched,
53 by default Functest will launch all the test suites in the following order:
57 3) SDN controller suites
58 4) Feature project tests cases (Promise, Doctor, ...)
62 Please note that for some scenarios some test cases might not be launched.
63 Functest calculates automatically which test can be executed and which cannot given
64 the environment variable **DEPLOY_SCENARIO** to the docker container.
66 A single or set of test may be launched at once using *-t <test_name>* specifying
67 the test name or names separated by commas in the following list:
68 *[vping_ssh,vping_userdata,odl,onos,rally,tempest,vims,promise,doctor]*.
70 Functest includes cleaning mechanism in order to remove
71 all the OpenStack resources except what was present before running any test. The script
72 *$repos_dir/functest/testcases/VIM/OpenStack/CI/libraries/generate_defaults.py*
73 is called once by *prepare_env.sh* when setting up the Functest environment
74 to snapshot all the OpenStack resources (images, networks, volumes, security groups,
75 tenants, users) so that an eventual cleanup does not remove any of this defaults.
77 The *-n* option is used for preserving all the possible OpenStack resources created
78 by the tests after their execution.
80 The *-s* option forces execution of test cases in a single thread. Currently this
81 option affects Tempest test cases only and can be used e.g. for troubleshooting
84 The script **clean_openstack.py** which is located in
85 *$repos_dir/functest/testcases/VIM/OpenStack/CI/libraries/*
86 is normally called after a test execution if the *-n* is not specified. It
87 is in charge of cleaning the OpenStack resources that are not specified
88 in the defaults file generated previously which is stored in
89 */home/opnfv/functest/conf/os_defaults.yaml* in the docker
92 It is important to mention that if there are new OpenStack resources created
93 manually after preparing the Functest environment, they will be removed if this
94 flag is not specified in the *run_tests.sh* command.
95 The reason to include this cleanup meachanism in Functest is because some
96 test suites such as Tempest or Rally create a lot of resources (users,
97 tenants, networks, volumes etc.) that are not always properly cleaned, so this
98 function has been set to keep the system as clean as it was before a
99 full Functest execution.
101 Within the Tempest test suite it is possible to define which test cases to execute
102 by editing **test_list.txt** file before executing **run_tests.sh** script. This file
103 is located in *$repos_dir/functest/testcases/VIM/OpenStack/CI/custom_tests/test_list.txt*
105 Although **run_tests.sh** provides an easy way to run any test, it is possible to
106 do a direct call to the desired test script. For example:
108 python $repos_dir/functest/testcases/vPing/vPing_ssh.py -d
113 As mentioned previously, the **prepare-env.sh** and **run_test.sh** can be called within
114 the container from Jenkins. There are 2 jobs that automate all the manual steps
115 explained in the previous section. One job runs all the tests and the other one allows testing
116 test suite by test suite specifying the test name. The user might use one or
117 the other job to execute the desired test suites.
119 One of the most challenging task in the Brahmaputra release consists
120 in dealing with lots of scenarios and installers. Thus, when the tests are
121 automatically started from CI, a basic algorithm has been created in order to
122 detect whether a given test is runnable or not on the given scenario.
123 Some Functest test suites cannot be systematically run (e.g. ODL suite can not
124 be run on an ONOS scenario).
126 CI provides some useful information passed to the container as environment
129 * Installer (apex|compass|fuel|joid), stored in INSTALLER_TYPE
130 * Installer IP of the engine or VM running the actual deployment, stored in INSTALLER_IP
131 * The scenario [controller]-[feature]-[mode], stored in DEPLOY_SCENARIO with
133 * controller = (odl|onos|ocl|nosdn)
134 * feature = (ovs(dpdk)|kvm)
137 The constraints per test case are defined in the Functest configuration file
138 */home/opnfv/functest/config/config_functest.yaml*::
143 scenario: '(ocl)|(odl)|(nosdn)'
146 scenario: '(ocl)|(odl)|(nosdn)'
155 At the end of the Functest environment creation, a file
156 */home/opnfv/functest/conf/testcase-list.txt* is created with the list of
157 all the runnable tests.
158 Functest considers the static constraints as regular expressions and compare them
159 with the given scenario name.
160 For instance, ODL suite can be run only on an scenario including 'odl' in its name.
162 The order of execution is also described in the Functest configuration file::
176 11: openstack-neutron-bgpvpn-api-extension-tests
180 The tests are executed in the following order:
184 3) SDN controller suites
185 4) Feature project tests cases (Promise, Doctor, ...)
189 As explained before, at the end of an automated execution, the OpenStack resources
190 might be eventually removed.