Support only Fluorine+ distributions
[integration/test.git] / csit / libraries / Tempest.robot
index 8794e3e994f980014a612f908ace7550a6813b4e..4992c424cae55eac0e88f6aa0d62c320e758a408 100644 (file)
@@ -1,19 +1,24 @@
 *** Settings ***
-Documentation     General Utils library. This library has broad scope, it can be used by any robot system tests.
-Library           SSHLibrary
-Resource          DevstackUtils.robot
-Resource          OpenStackOperations.robot
-Resource          SSHKeywords.robot
-Resource          ../variables/Variables.robot
+Documentation       General Utils library. This library has broad scope, it can be used by any robot system tests.
+
+Library             SSHLibrary
+Resource            DevstackUtils.robot
+Resource            OpenStackOperations.robot
+Resource            SSHKeywords.robot
+Resource            ../variables/Variables.robot
+
 
 *** Variables ***
-@{stable/queens_EXCLUSION_REGEXES}    ${EMPTY}
-@{master_EXCLUSION_REGEXES}    ${EMPTY}
-${BLACKLIST_FILE}    /tmp/blacklist.txt
-${TEMPEST_DIR}    /opt/stack/tempest
-${TEMPEST_CONFIG_FILE}    ${TEMPEST_DIR}/etc/tempest.conf
+@{stable/queens_EXCLUSION_REGEXES}      ${EMPTY}
+@{stable/rocky_EXCLUSION_REGEXES}       ${EMPTY}
+@{stable/stein_EXCLUSION_REGEXES}       ${EMPTY}
+@{master_EXCLUSION_REGEXES}             ${EMPTY}
+${BLACKLIST_FILE}                       /tmp/blacklist.txt
+${TEMPEST_DIR}                          /opt/stack/tempest
+${TEMPEST_CONFIG_FILE}                  ${TEMPEST_DIR}/etc/tempest.conf
 # Parameter values below are based on releng/builder - changing them requires updates in releng/builder as well
-${TEMPEST_TIMEOUT}    420s
+${TEMPEST_TIMEOUT}                      420s
+
 
 *** Keywords ***
 Suite Setup
@@ -22,18 +27,24 @@ Suite Setup
 
 Run Tempest Tests
     [Arguments]    ${tempest_regex}    ${timeout}=${TEMPEST_TIMEOUT}    ${debug}=False
-    BuiltIn.Run Keyword If    "${debug}" == "False"    Tempest.Run Tempest Tests Without Debug    ${tempest_regex}    timeout=${timeout}
-    BuiltIn.Run Keyword If    "${debug}" == "True"    Tempest.Run Tempest Tests With Debug    ${tempest_regex}    timeout=${timeout}
-    BuiltIn.Run Keyword If    "${debug}" != "True" and "${debug}" != "False"    Fail    debug argument must be True or False
+    IF    "${debug}" == "False"
+        Tempest.Run Tempest Tests Without Debug    ${tempest_regex}    timeout=${timeout}
+    END
+    IF    "${debug}" == "True"
+        Tempest.Run Tempest Tests With Debug    ${tempest_regex}    timeout=${timeout}
+    END
+    IF    "${debug}" != "True" and "${debug}" != "False"
+        Fail    debug argument must be True or False
+    END
 
 Run Tempest Tests Without Debug
-    [Arguments]    ${tempest_regex}    ${TEMPEST_DIRectory}=${TEMPEST_DIR}    ${timeout}=${TEMPEST_TIMEOUT}
     [Documentation]    Using ostestr will allow us to (by default) run tests in paralllel.
     ...    Because of the parallel fashion, we must ensure there is no pause on teardown so that flag in tempest.conf is
     ...    explicitly set to False.
-    BuiltIn.Return From Keyword If    "skip_if_${OPENSTACK_BRANCH}" in @{TEST_TAGS}
-    BuiltIn.Return From Keyword If    "skip_if_${SECURITY_GROUP_MODE}" in @{TEST_TAGS}
-    BuiltIn.Return From Keyword If    "skip_if_${ODL_SNAT_MODE}" in @{TEST_TAGS}
+    [Arguments]    ${tempest_regex}    ${TEMPEST_DIRectory}=${TEMPEST_DIR}    ${timeout}=${TEMPEST_TIMEOUT}
+    IF    "skip_if_${OPENSTACK_BRANCH}" in @{TEST_TAGS}    RETURN
+    IF    "skip_if_${SECURITY_GROUP_MODE}" in @{TEST_TAGS}    RETURN
+    IF    "skip_if_${ODL_SNAT_MODE}" in @{TEST_TAGS}    RETURN
     ${tempest_conn_id} =    SSHLibrary.Open Connection    ${OS_CNTL_IP}    prompt=${DEFAULT_LINUX_PROMPT_STRICT}
     SSHKeywords.Flexible SSH Login    ${OS_USER}    ${DEVSTACK_SYSTEM_PASSWORD}
     DevstackUtils.Write Commands Until Prompt    source ${DEVSTACK_DEPLOY_PATH}/openrc admin admin
@@ -44,19 +55,21 @@ Run Tempest Tests Without Debug
     # There are tons of deprecation error messages when we use ostestr in our CSIT environment (openstack via devstack)
     # The robot log files are very large and one culprit is all these deprecation warnings. If we redirect stderr to
     # /dev/null we should be able to ignore them. We will miss any other errors, however.
-    ${output} =    DevstackUtils.Write Commands Until Prompt And Log    ostestr --regex ${tempest_regex}    timeout=${timeout}
+    ${output} =    DevstackUtils.Write Commands Until Prompt And Log
+    ...    ostestr --regex ${tempest_regex}
+    ...    timeout=${timeout}
     SSHLibrary.Close Connection
     BuiltIn.Should Contain    ${output}    Failed: 0
 
 Run Tempest Tests With Debug
-    [Arguments]    ${tempest_regex}    ${TEMPEST_DIRectory}=${TEMPEST_DIR}    ${timeout}=${TEMPEST_TIMEOUT}
     [Documentation]    After setting pause_teardown=True in tempest.conf, use the python -m testtools.run module to execute
     ...    a single tempest test case. We need to run only one tempest test case at a time as there will
     ...    be potentional for an unkown number of debug pdb() prompts to catch and continue if we are running multiple
     ...    test cases with a single command. Essentially, this keyword only handles one breakpoint at a single teardown.
-    BuiltIn.Return From Keyword If    "skip_if_${OPENSTACK_BRANCH}" in @{TEST_TAGS}
-    BuiltIn.Return From Keyword If    "skip_if_${SECURITY_GROUP_MODE}" in @{TEST_TAGS}
-    BuiltIn.Return From Keyword If    "skip_if_${ODL_SNAT_MODE}" in @{TEST_TAGS}
+    [Arguments]    ${tempest_regex}    ${TEMPEST_DIRectory}=${TEMPEST_DIR}    ${timeout}=${TEMPEST_TIMEOUT}
+    IF    "skip_if_${OPENSTACK_BRANCH}" in @{TEST_TAGS}    RETURN
+    IF    "skip_if_${SECURITY_GROUP_MODE}" in @{TEST_TAGS}    RETURN
+    IF    "skip_if_${ODL_SNAT_MODE}" in @{TEST_TAGS}    RETURN
     ${tempest_conn_id} =    SSHLibrary.Open Connection    ${OS_CNTL_IP}    prompt=${DEFAULT_LINUX_PROMPT_STRICT}
     SSHKeywords.Flexible SSH Login    ${OS_USER}    ${DEVSTACK_SYSTEM_PASSWORD}
     DevstackUtils.Write Commands Until Prompt    source ${DEVSTACK_DEPLOY_PATH}/openrc admin admin
@@ -86,8 +99,14 @@ Log In To Tempest Executor And Setup Test Environment
     ...    and pushed to the tempest executor.
     Tempest.Create Blacklist File
     # Tempest tests need an existing external network in order to create routers.
-    OpenStackOperations.Create Network    ${EXTERNAL_NET_NAME}    --external --default --provider-network-type flat --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK}
-    OpenStackOperations.Create Subnet    ${EXTERNAL_NET_NAME}    ${EXTERNAL_SUBNET_NAME}    ${EXTERNAL_SUBNET}    --gateway ${EXTERNAL_GATEWAY} --allocation-pool ${EXTERNAL_SUBNET_ALLOCATION_POOL}
+    OpenStackOperations.Create Network
+    ...    ${EXTERNAL_NET_NAME}
+    ...    --external --default --provider-network-type flat --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK}
+    OpenStackOperations.Create Subnet
+    ...    ${EXTERNAL_NET_NAME}
+    ...    ${EXTERNAL_SUBNET_NAME}
+    ...    ${EXTERNAL_SUBNET}
+    ...    --gateway ${EXTERNAL_GATEWAY} --allocation-pool ${EXTERNAL_SUBNET_ALLOCATION_POOL}
     OpenStackOperations.List Networks
     ${control_node_conn_id} =    SSHLibrary.Open Connection    ${OS_CNTL_IP}    prompt=${DEFAULT_LINUX_PROMPT_STRICT}
     SSHKeywords.Flexible SSH Login    ${OS_USER}
@@ -101,35 +120,62 @@ Log In To Tempest Executor And Setup Test Environment
     Tempest.Tempest Conf Add External Network And Floating Network Name    ${net_id}
 
 Tempest Conf Add External Network And Floating Network Name
-    [Arguments]    ${external_network_id}
     [Documentation]    Tempest will be run with a config file - this function will add the
     ...    given external network ID to the configuration file.
-    Tempest.Modify Config In File On Existing SSH Connection    ${TEMPEST_CONFIG_FILE}    set    network    public_network_id    ${external_network_id}
-    Tempest.Modify Config In File On Existing SSH Connection    ${TEMPEST_CONFIG_FILE}    set    DEFAULT    debug    False
-    Tempest.Modify Config In File On Existing SSH Connection    ${TEMPEST_CONFIG_FILE}    set    DEFAULT    log_level    INFO
-    Tempest.Modify Config In File On Existing SSH Connection    ${TEMPEST_CONFIG_FILE}    set    network    floating_network_name    ${EXTERNAL_NET_NAME}
+    [Arguments]    ${external_network_id}
+    Tempest.Modify Config In File On Existing SSH Connection
+    ...    ${TEMPEST_CONFIG_FILE}
+    ...    set
+    ...    network
+    ...    public_network_id
+    ...    ${external_network_id}
+    Tempest.Modify Config In File On Existing SSH Connection
+    ...    ${TEMPEST_CONFIG_FILE}
+    ...    set
+    ...    DEFAULT
+    ...    debug
+    ...    False
+    Tempest.Modify Config In File On Existing SSH Connection
+    ...    ${TEMPEST_CONFIG_FILE}
+    ...    set
+    ...    DEFAULT
+    ...    log_level
+    ...    INFO
+    Tempest.Modify Config In File On Existing SSH Connection
+    ...    ${TEMPEST_CONFIG_FILE}
+    ...    set
+    ...    network
+    ...    floating_network_name
+    ...    ${EXTERNAL_NET_NAME}
     DevstackUtils.Write Commands Until Prompt    sudo cat ${TEMPEST_CONFIG_FILE}
     DevstackUtils.Write Commands Until Prompt    sudo chmod 777 ${TEMPEST_CONFIG_FILE}
 
 Tempest Conf Modify Pause On Test Teardown
-    [Arguments]    ${pause_flag}
     [Documentation]    Sets the DEFAULT section flag for pausing the test teardown. If True the tempest test case
     ...    being executed will break to a pdb() debug shell when it hits it's teardown() function.
-    Tempest.Modify Config In File On Existing SSH Connection    ${TEMPEST_CONFIG_FILE}    set    DEFAULT    pause_teardown    ${pause_flag}
+    [Arguments]    ${pause_flag}
+    Tempest.Modify Config In File On Existing SSH Connection
+    ...    ${TEMPEST_CONFIG_FILE}
+    ...    set
+    ...    DEFAULT
+    ...    pause_teardown
+    ...    ${pause_flag}
 
 Modify Config In File On Existing SSH Connection
-    [Arguments]    ${config_file}    ${modifier}    ${config_section}    ${config_key}    ${config_value}=${EMPTY}
     [Documentation]    uses crudini to populate oslo cofg file.
+    [Arguments]    ${config_file}    ${modifier}    ${config_section}    ${config_key}    ${config_value}=${EMPTY}
     # this keyword is only one line so seems like extra overhead, but this may be a good candidate to move
     # to a library at some point, when/if other suites need to use it, so wanted to make it generic.
-    DevstackUtils.Write Commands Until Prompt    sudo -E crudini --${modifier} ${config_file} ${config_section} ${config_key} ${config_value}
+    DevstackUtils.Write Commands Until Prompt
+    ...    sudo -E crudini --${modifier} ${config_file} ${config_section} ${config_key} ${config_value}
 
 Create Blacklist File
     [Documentation]    For each exclusion regex in the required @{${OPENSTACK_BRANCH}_EXCLUSION_REGEXES} list a new
     ...    line will be created in the required ${BLACKLIST_FILE} location. This file is pushed to the OS_CONTROL_NODE
     ...    which is assumed to be the tempest executor.
     OperatingSystem.Create File    ${BLACKLIST_FILE}
-    : FOR    ${exclusion}    IN    @{${OPENSTACK_BRANCH}_EXCLUSION_REGEXES}
-    \    OperatingSystem.Append To File    ${BLACKLIST_FILE}    ${exclusion}\n
+    FOR    ${exclusion}    IN    @{${OPENSTACK_BRANCH}_EXCLUSION_REGEXES}
+        OperatingSystem.Append To File    ${BLACKLIST_FILE}    ${exclusion}\n
+    END
     OperatingSystem.Log File    ${BLACKLIST_FILE}
     SSHKeywords.Copy File To Remote System    ${OS_CNTL_IP}    ${BLACKLIST_FILE}    ${BLACKLIST_FILE}