Tweak tempest timeouts
[integration/test.git] / csit / libraries / DevstackUtils.robot
1 *** Settings ***
2 Documentation     General Utils library. This library has broad scope, it can be used by any robot system tests.
3 Library           SSHLibrary
4 Library           String
5 Library           DateTime
6 Library           Process
7 Library           Collections
8 Library           RequestsLibrary
9 Library           ./UtilLibrary.py
10 Resource          KarafKeywords.robot
11 Resource          OpenStackOperations.robot
12 Resource          SSHKeywords.robot
13 Variables         ../variables/Variables.py
14
15 *** Variables ***
16 ${default_devstack_prompt_timeout}    10s
17 ${DEVSTACK_SYSTEM_PASSWORD}    \    # set to empty, but provide for others to override if desired
18
19 *** Keywords ***
20 Run Tempest Tests
21     [Arguments]    ${tempest_regex}    ${exclusion_file}=/dev/null    ${tempest_conf}=""    ${tempest_directory}=/opt/stack/tempest    ${timeout}=420s
22     [Documentation]    Execute the tempest tests.
23     Return From Keyword If    "skip_if_${OPENSTACK_BRANCH}" in @{TEST_TAGS}
24     Return From Keyword If    "skip_if_${SECURITY_GROUP_MODE}" in @{TEST_TAGS}
25     ${devstack_conn_id}=    Get ControlNode Connection
26     Switch Connection    ${devstack_conn_id}
27     # There seems to be a bug in the mitaka version of os-testr that does not allow --regex to work in conjunction
28     # with a blacklist-file. Upgrading with pip should resolve this. This can probably go away once mitaka is no
29     # longer tested in this environment. But, while it's being tested the mitaka devstack setup will be bringing
30     # in this broken os-testr, so we manually upgrade here.
31     Write Commands Until Prompt    sudo pip install os-testr --upgrade    timeout=120s
32     Write Commands Until Prompt    source ${DEVSTACK_DEPLOY_PATH}/openrc admin admin
33     Write Commands Until Prompt    cd ${tempest_directory}
34     # From Ocata and moving forward, we can replace 'ostestr' with 'tempest run'
35     ${results}=    Write Commands Until Prompt    ostestr --regex ${tempest_regex} -b ${exclusion_file}    timeout=${timeout}
36     Log    ${results}
37     # Save stdout to file
38     Create File    tempest_output_${tempest_regex}.log    data=${results}
39     # output tempest generated log file which may have different debug levels than what stdout would show
40     # FIXME: having the INFO level tempest logs is helpful as it gives details like the UUIDs of nouns used in the
41     # the tests which can sometimes be tracked in ODL and Openstack logs when debugging. However, this "cat" step
42     # does not even complete for the tempest.api.network tests in under 2min. We need a faster way to get this
43     # info. Probably pulling the log file and storing it on the log server is best. Hopefully someone can get
44     # to this. For now, commenting out this next debug step.
45     # ${output}=    Write Commands Until Prompt    cat ${tempest_directory}/tempest.log    timeout=120s
46     # Log    ${output}
47     Should Contain    ${results}    Failed: 0
48     # TODO: also need to verify some non-zero pass count as well as other results are ok (e.g. skipped, etc)
49
50 Devstack Suite Setup
51     [Arguments]    ${source_pwd}=no    ${odl_ip}=${ODL_SYSTEM_IP}
52     [Documentation]    Login to the Openstack Control Node to run tempest suite
53     Create Session    session    http://${odl_ip}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
54     ${devstack_conn_id}=    SSHLibrary.Open Connection    ${OS_CONTROL_NODE_IP}    prompt=${DEFAULT_LINUX_PROMPT}
55     Set Suite Variable    ${devstack_conn_id}
56     Set Suite Variable    ${source_pwd}
57     Log    ${devstack_conn_id}
58     SSHKeywords.Flexible SSH Login    ${OS_USER}    ${DEVSTACK_SYSTEM_PASSWORD}
59     SSHLibrary.Set Client Configuration    timeout=${default_devstack_prompt_timeout}
60
61 Write Commands Until Prompt
62     [Arguments]    ${cmd}    ${timeout}=${default_devstack_prompt_timeout}
63     [Documentation]    quick wrapper for Write and Read Until Prompt Keywords to make test cases more readable
64     Log    ${cmd}
65     SSHLibrary.Set Client Configuration    timeout=${timeout}
66     SSHLibrary.Read
67     SSHLibrary.Write    ${cmd};echo Command Returns $?
68     ${output}=    SSHLibrary.Read Until Prompt
69     [Return]    ${output}