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,bgpvpn
44 run_tests.sh --test vping_ssh,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, SDNVPN)
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/utils/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 Although **run_tests.sh** provides an easy way to run any test, it is possible to
102 do a direct call to the desired test script. For example:
104 python $repos_dir/functest/testcases/vPing/vPing_ssh.py -d
109 As mentioned previously, the **prepare-env.sh** and **run_test.sh** can be called within
110 the container from Jenkins. There are 2 jobs that automate all the manual steps
111 explained in the previous section. One job runs all the tests and the other one allows testing
112 test suite by test suite specifying the test name. The user might use one or
113 the other job to execute the desired test suites.
115 One of the most challenging task in the Brahmaputra release consists
116 in dealing with lots of scenarios and installers. Thus, when the tests are
117 automatically started from CI, a basic algorithm has been created in order to
118 detect whether a given test is runnable or not on the given scenario.
119 Some Functest test suites cannot be systematically run (e.g. ODL suite can not
120 be run on an ONOS scenario).
122 CI provides some useful information passed to the container as environment
125 * Installer (apex|compass|fuel|joid), stored in INSTALLER_TYPE
126 * Installer IP of the engine or VM running the actual deployment, stored in INSTALLER_IP
127 * The scenario [controller]-[feature]-[mode], stored in DEPLOY_SCENARIO with
129 * controller = (odl|onos|ocl|nosdn)
130 * feature = (ovs(dpdk)|kvm|sfc|bgpvpn)
133 The constraints per test case are defined in the Functest configuration file
134 */home/opnfv/functest/config/config_functest.yaml*::
139 scenario: '(ocl)|(odl)|(nosdn)'
142 scenario: '(ocl)|(odl)|(nosdn)'
151 At the end of the Functest environment creation, a file
152 */home/opnfv/functest/conf/testcase-list.txt* is created with the list of
153 all the runnable tests.
154 Functest considers the static constraints as regular expressions and compare them
155 with the given scenario name.
156 For instance, ODL suite can be run only on an scenario including 'odl' in its name.
158 The order of execution is also described in the Functest configuration file::
172 #11: openstack-neutron-bgpvpn-api-extension-tests
176 The tests are executed in the following order:
180 3) SDN controller suites
181 4) Feature project tests cases (Promise, Doctor, BGPVPN...)
185 As explained before, at the end of an automated execution, the OpenStack resources
186 might be eventually removed.