Merge "Add initial CSIT case for DCAE-DS"
[integration/csit.git] / tests / dcaegen2 / prh-testcases / resources / prh_config_library.robot
1 *** Settings ***
2 Documentation     Keywords related to checking and updating PRH app config based on CBS config
3 Library           RequestsLibrary
4 Library           Collections
5
6 *** Keywords ***
7
8 Put key-value to consul
9    [Arguments]    ${key}    ${value}
10    ${prh_config}=    Get PRH config from consul
11    set to dictionary    ${prh_config}    ${key}    ${value}
12    put request    consul_session    /v1/kv/dcae-prh    json=${prh_config}
13    Get PRH config from consul    prh config in consul after update
14
15 Get PRH config from consul
16     [Arguments]    ${logMessage}=prh config in consul
17     ${phr_config_response}=    get request    consul_session    /v1/kv/dcae-prh?raw
18     log    ${logMessage}: ${phr_config_response.content}
19     [Return]    ${phr_config_response.json()}
20
21 Force PRH config refresh
22     ${refresh_response}=    post request    prh_session    /actuator/refresh
23     should be equal as integers    ${refresh_response.status_code}    200
24
25 Check key-value in PRH app environment
26     [Arguments]    ${key}    ${expected_value}
27     ${env_response}=    get request    prh_session    /actuator/env/${key}
28     should be equal as integers    ${env_response.status_code}    200
29     log    ${env_response.content}
30     should be equal    ${env_response.json()["property"]["value"]}    ${expected_value}
31
32 Set scheduled CBS updates interval
33     [Arguments]    ${cbs_updates_interval}
34     Put key-value to consul    cbs.updates-interval    ${cbs_updates_interval}
35     Force PRH config refresh
36
37 Set logging level in CBS
38     [Arguments]    ${logger}   ${level}
39     Put key-value to consul    logging.level.${logger}    ${level}
40
41 Generate random value
42     ${some_random_value}     evaluate    random.randint(sys.maxint/10, sys.maxint)    modules=random,sys
43     [Return]    ${some_random_value}