1 Executing the functest suites
2 =============================
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.
11 The script *run_tests.sh* launches the test in an automated way.
12 Although it is possible to execute the different tests manually, it is
13 recommended to use the previous shell script which makes the call
14 to the actual scripts with the appropriate parameters.
16 It is located in *$repos_dir/functest/docker* and it has
20 Script to trigger the tests automatically.
23 bash run_tests.sh [-h|--help] [-r|--report] [-n|--no-clean] [-t|--test <test_name>]
26 -h|--help show this help text
27 -r|--report push results to database (false by default)
28 -n|--no-clean do not clean up OpenStack resources after test run
29 -s|--serial run tests in one thread
30 -t|--test run specific set of tests
31 <test_name> one or more of the following separated by comma:
32 vping_ssh,vping_userdata,odl,rally,tempest,vims,onos,promise,ovno
36 run_tests.sh --test vping,odl
37 run_tests.sh -t tempest,rally --no-clean
39 The *-r* option is used by the OPNFV Continuous Integration automation mechanisms
40 in order to push the test results into the NoSQL results collection database.
41 This database is read only for a regular user given that it needs special rights
42 and special conditions to push data.
44 The *-t* option can be used to specify the list of a desired test to be launched,
45 by default Functest will launch all the test suites in the following order:
46 vPing, Tempest, vIMS, Rally.
48 A single or set of test may be launched at once using *-t <test_name>* specifying
49 the test name or names separated by commas in the following list:
50 *[vping,vping_userdata,odl,rally,tempest,vims,onos,promise]*.
52 The *-n* option is used for preserving all the possible OpenStack resources created
53 by the tests after their execution.
55 Please note that Functest includes cleaning mechanism in order to remove
56 all the VIM resources except what was present before running any test. The script
57 *$repos_dir/functest/testcases/VIM/OpenStack/CI/libraries/generate_defaults.py*
58 is called once by *prepare_env.sh* when setting up the Functest environment
59 to snapshot all the OpenStack resources (images, networks, volumes, security groups,
60 tenants, users) so that an eventual cleanup does not remove any of this defaults.
62 The *-s* option forces execution of test cases in a single thread. Currently this
63 option affects Tempest test cases only and can be used e.g. for troubleshooting
67 *$repos_dir/functest/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py*
68 is normally called after a test execution if the *-n* is not specified. It
69 is in charge of cleaning the OpenStack resources that are not specified
70 in the defaults file generated previously which is stored in
71 */home/opnfv/functest/conf/os_defaults.yaml* in the docker
74 It is important to mention that if there are new OpenStack resources created
75 manually after preparing the Functest environment, they will be removed if this
76 flag is not specified in the *run_tests.sh* command.
77 The reason to include this cleanup meachanism in Functest is because some
78 test suites such as Tempest or Rally create a lot of resources (users,
79 tenants, networks, volumes etc.) that are not always properly cleaned, so this
80 cleaning function has been set to keep the system as clean as it was before a
81 full Functest execution.
83 Within the Tempest test suite it is possible to define which test cases to execute
84 by editing *test_list.txt* file before executing *run_tests.sh* script. This file
85 is located in *$repos_dir/functest/testcases/VIM/OpenStack/CI/custom_tests/test_list.txt*
87 Although *run_tests.sh* provides an easy way to run any test, it is possible to
88 do a direct call to the desired test script. For example::
89 python $repos_dir/functest/testcases/vPing/vPing.py -d
94 As mentioned in `[1]`, the *prepare-env.sh* and *run_test.sh* can be called within
95 the container from Jenkins. There are 2 jobs that automate all the manual steps
96 explained in the previous section. One job runs all the tests and the other one allows testing
97 test suite by test suite specifying the test name. The user might use one or
98 the other job to execute the desired test suites.
100 One of the most challenging task in the Brahmaputra release consists
101 in dealing with lots of scenarios and installers. Thus, when the tests are
102 automatically started from CI, a basic algorithm has been created in order to
103 detect whether a given test is runnable or not on the given scenario.
104 Some Functest test suites cannot be systematically run (e.g. ODL suite can not
105 be run on an ONOS scenario).
109 CI provides some useful information passed to the container as environment
112 * Installer (apex|compass|fuel|joid), stored in INSTALLER_TYPE
113 * Installer IP of the engine or VM running the actual deployment, stored in INSTALLER_IP
114 * The scenario [controller]-[feature]-[mode], stored in DEPLOY_SCENARIO with
116 * controller = (odl|onos|ocl|nosdn)
117 * feature = (ovs(dpdk)|kvm)
120 The constraints per test case are defined in the Functest configuration file
121 */home/opnfv/functest/config/config_functest.yaml*::
126 scenario: '(ocl)|(odl)|(nosdn)'
129 scenario: '(ocl)|(odl)|(nosdn)'
138 At the end of the Functest environment creation (prepare_env.sh see `[1]`_), a
139 file */home/opnfv/functest/conf/testcase-list.txt* is created with the list of
140 all the runnable tests.
141 Functest considers the static constraints as regular expressions and compare them
142 with the given scenario name.
143 For instance, ODL suite can be run only on an scenario including 'odl' in its name.
145 The order of execution is also described in the Functest configuration file::
159 11: openstack-neutron-bgpvpn-api-extension-tests
163 The tests are executed in the following order:
165 * Basic scenario (vPing_ssh, vPing_userdata, Tempest)
166 * Controller suites: ODL or ONOS or OpenContrail
167 * Feature projects (promise, vIMS)
168 * Rally (benchmark scenario)
170 As explained before, at the end of an automated execution, the OpenStack resources
171 might be eventually removed.