adding tempest test cases to existing openstack related jobs
[integration/test.git] / csit / libraries / DevstackUtils.robot
index 71be69da92a7dea938d9903daa9399b485f9b767..3762a081cbabe2f87f376239845f0627dd1b4bb8 100644 (file)
@@ -8,6 +8,7 @@ Library           Collections
 Library           RequestsLibrary
 Library           ./UtilLibrary.py
 Resource          KarafKeywords.robot
+Resource          OpenStackOperations.robot
 Variables         ../variables/Variables.py
 
 *** Variables ***
@@ -23,13 +24,18 @@ ${CLEAN_DEVSTACK_HOST}    False
 
 *** Keywords ***
 Run Tempest Tests
-    [Arguments]    ${tempest_regex}    ${timeout}=600s
-    [Documentation]    Execute the tempest tests
-    Write Commands Until Prompt    cd /opt/stack/new/tempest
-    Write Commands Until Prompt    sudo rm -rf /opt/stack/new/tempest/.testrepository
-    Write Commands Until Prompt    sudo testr init
-    ${results}=    Write Commands Until Prompt    sudo -E testr run ${tempest_regex} --subunit | subunit-trace --no-failure-debug -f    timeout=${timeout}
-    Create File    ${WORKSPACE}/tempest_output.log    data=${results}
+    [Arguments]    ${tempest_regex}    ${tempest_exclusion_regex}=""    ${tempest_conf}=""    ${tempest_directory}=/opt/stack/tempest    ${timeout}=600s
+    [Documentation]    Execute the tempest tests.
+    Write Commands Until Prompt    source ${DEVSTACK_DEPLOY_PATH}/openrc admin admin
+    Write Commands Until Prompt    cd ${tempest_directory}
+    Write Commands Until Prompt    sudo rm -rf ${tempest_directory}/.testrepository
+    Write Commands Until Prompt    sudo testr list-tests | egrep ${tempest_regex} | egrep -v ${tempest_exclusion_regex} > tests_to_execute.txt
+    ${tests_to_execute}=    Write Commands Until Prompt    sudo cat tests_to_execute.txt
+    Log    ${tests_to_execute}
+    # run_tempests.sh is a wrapper to testr, and we are providing the config file
+    ${results}=    Write Commands Until Prompt    sudo -E ./run_tempest.sh -C ${tempest_conf} -N ${tempest_regex} -- --load-list tests_to_execute.txt    timeout=${timeout}
+    Log    ${results}
+    Create File    tempest_output_${tempest_regex}.log    data=${results}
     Should Contain    ${results}    Failed: 0
     # TODO: also need to verify some non-zero pass count as well as other results are ok (e.g. skipped, etc)