diff options
author | grabinsk <maciej.grabinski@nokia.com> | 2019-06-19 12:36:42 +0200 |
---|---|---|
committer | grabinsk <maciej.grabinski@nokia.com> | 2019-06-19 12:36:42 +0200 |
commit | c68c2eefd7980e797c6c4d913d1db4e0b685f48a (patch) | |
tree | 9571d4b3ce28dde24f305db7cd7a72588a1ed788 /tests/dcaegen2 | |
parent | 9c7d8f024060f441ba25c14a04fd841f2e9e16bf (diff) |
Add test for forcing CBS configuration refresh in PRH
Change-Id: Ie1d8659d4aaa82338c6986f68e47443dc6679b0e
Issue-ID: DCAEGEN2-1544
Signed-off-by: grabinsk <maciej.grabinski@nokia.com>
Diffstat (limited to 'tests/dcaegen2')
4 files changed, 74 insertions, 26 deletions
diff --git a/tests/dcaegen2/prh-testcases/prh_tests.robot b/tests/dcaegen2/prh-testcases/prh_tests.robot index 88e17121..9334d634 100644 --- a/tests/dcaegen2/prh-testcases/prh_tests.robot +++ b/tests/dcaegen2/prh-testcases/prh_tests.robot @@ -6,8 +6,9 @@ Test Teardown Reset Simulators Test Timeout 2 minutes Library resources/PrhLibrary.py +Resource resources/prh_sessions.robot Resource resources/prh_library.robot -Resource ../../common.robot +Resource resources/prh_config_tests.robot *** Variables *** ${TEST_CASES_DIR} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets @@ -64,4 +65,9 @@ BBS case event - Re-registration PRH logging level change [Documentation] PRH logging level change from WARN to TRACE [Tags] PRH logging level - Verify change logging level
\ No newline at end of file + Verify change logging level + +CBS configuration forced refresh + [Documentation] It should be possible to force refresh PRH configuration from CBS + [Tags] PRH coniguration + Verify PRH configuration forced refresh
\ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/resources/prh_config_tests.robot b/tests/dcaegen2/prh-testcases/resources/prh_config_tests.robot new file mode 100644 index 00000000..54c58f2b --- /dev/null +++ b/tests/dcaegen2/prh-testcases/resources/prh_config_tests.robot @@ -0,0 +1,36 @@ +*** Settings *** +Documentation Tests and keywords related to updating PRH app config based on CBS config +Library RequestsLibrary +Library Collections + +*** Keywords *** + +Verify PRH configuration forced refresh + ${some_random_value} evaluate random.randint(sys.maxint/10, sys.maxint) modules=random,sys + Put key-value to consul foo_${some_random_value} bar_${some_random_value} + Force PRH config refresh + Check key-value in PRH app environment foo_${some_random_value} bar_${some_random_value} + +Put key-value to consul + [Arguments] ${key} ${value} + ${prh_config}= Get PRH config from consul + set to dictionary ${prh_config} ${key} ${value} + put request consul_session /v1/kv/dcae-prh json=${prh_config} + Get PRH config from consul prh config in consul after update + +Get PRH config from consul + [Arguments] ${logMessage}=prh config in consul + ${phr_config_response}= get request consul_session /v1/kv/dcae-prh?raw + log ${logMessage}: ${phr_config_response.content} + [Return] ${phr_config_response.json()} + +Force PRH config refresh + ${refresh_response}= post request prh_session /actuator/refresh + should be equal as integers ${refresh_response.status_code} 200 + +Check key-value in PRH app environment + [Arguments] ${key} ${expected_value} + ${env_response}= get request prh_session /actuator/env/${key} + should be equal as integers ${env_response.status_code} 200 + log ${env_response.content} + should be equal ${env_response.json()["property"]["value"]} ${expected_value} diff --git a/tests/dcaegen2/prh-testcases/resources/prh_library.robot b/tests/dcaegen2/prh-testcases/resources/prh_library.robot index ce5b65bf..b52b27c3 100644 --- a/tests/dcaegen2/prh-testcases/resources/prh_library.robot +++ b/tests/dcaegen2/prh-testcases/resources/prh_library.robot @@ -70,27 +70,27 @@ Verify PNF re registration #Wait Until Keyword Succeeds 10x 3000ms Check created PNF_UPDATE notification ${expected_pnf_update_event} Check CBS ready - ${resp}= Get Request ${consul_setup_session} /v1/catalog/services + ${resp}= Get Request ${consul_session} /v1/catalog/services Should Be Equal As Strings ${resp.status_code} 200 Log Service Catalog response: ${resp.content} Dictionary Should Contain Key ${resp.json()} cbs |Consul service catalog should contain CBS entry Check created PNF_READY notification [Arguments] ${expected_event_pnf_ready_in_dpaap} - ${resp}= Get Request ${dmaap_setup_session} /verify/pnf_ready headers=${suite_headers} + ${resp}= Get Request ${dmaap_session} /verify/pnf_ready headers=${suite_headers} Should Be Equal As Strings ${resp.status_code} 200 Should Be Equal As JSON ${resp.content} ${expected_event_pnf_ready_in_dpaap} Check created PNF_UPDATE notification [Arguments] ${expected_event_pnf_update_in_dpaap} - ${resp}= Get Request ${dmaap_setup_session} /verify/pnf_update headers=${suite_headers} + ${resp}= Get Request ${dmaap_session} /verify/pnf_update headers=${suite_headers} Log Response from DMaaP: ${resp.content} Should Be Equal As Strings ${resp.status_code} 200 #Should Be Equal As JSON ${resp.content} ${expected_event_pnf_ready_in_dpaap} Check created Logical Link [Arguments] ${expected_logical_link_in_aai} - ${resp}= Get Request ${aai_setup_session} /verify/created_logical_link headers=${suite_headers} + ${resp}= Get Request ${aai_session} /verify/created_logical_link headers=${suite_headers} Should Be Equal As Strings ${resp.status_code} 200 Should Be Equal As JSON ${resp.content} ${expected_logical_link_in_aai} @@ -114,19 +114,19 @@ Add PNF entry in AAI [Arguments] ${pnf_entry} ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Log AAI url ${AAI_SIMULATOR_SETUP_URL} - ${resp}= Put Request ${aai_setup_session} /setup/add_pnf_entry headers=${suite_headers} data=${pnf_entry} + ${resp}= Put Request ${aai_session} /setup/add_pnf_entry headers=${suite_headers} data=${pnf_entry} Should Be Equal As Strings ${resp.status_code} 200 Add service instance entry in AAI [Arguments] ${aai_service_instance} ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Log AAI url ${AAI_SIMULATOR_SETUP_URL} - ${resp}= Put Request ${aai_setup_session} /setup/add_service_instace headers=${suite_headers} data=${aai_service_instance} + ${resp}= Put Request ${aai_session} /setup/add_service_instace headers=${suite_headers} data=${aai_service_instance} Should Be Equal As Strings ${resp.status_code} 200 Set VES event in DMaaP [Arguments] ${ves_event} - ${resp}= Put Request ${dmaap_setup_session} /setup/ves_event headers=${suite_headers} data=${ves_event} + ${resp}= Put Request ${dmaap_session} /setup/ves_event headers=${suite_headers} data=${ves_event} Should Be Equal As Strings ${resp.status_code} 200 Should Be Equal As JSON @@ -137,31 +137,18 @@ Should Be Equal As JSON ${actual_json}= Evaluate json.loads("""${actual}""") json Should Be Equal ${actual_json} ${expected_json} -Create sessions - Create Session dmaap_setup_session ${DMAAP_SIMULATOR_SETUP_URL} - Set Suite Variable ${dmaap_setup_session} dmaap_setup_session - Create Session aai_setup_session ${AAI_SIMULATOR_SETUP_URL} - Set Suite Variable ${aai_setup_session} aai_setup_session - Create Session consul_setup_session ${CONSUL_SETUP_URL} - Set Suite Variable ${consul_setup_session} consul_setup_session - Create Session prh_setup_session ${PRH_SETUP_URL} - Set Suite Variable ${prh_setup_session} prh_setup_session - Reset Simulators Reset AAI simulator Reset DMaaP simulator Reset AAI simulator - ${resp}= Post Request ${aai_setup_session} /reset + ${resp}= Post Request ${aai_session} /reset Should Be Equal As Strings ${resp.status_code} 200 Reset DMaaP simulator - ${resp}= Post Request ${dmaap_setup_session} /reset + ${resp}= Post Request ${dmaap_session} /reset Should Be Equal As Strings ${resp.status_code} 200 -Create headers - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - Set Suite Variable ${suite_headers} ${headers} Verify change logging level Change logging level TRACE @@ -174,10 +161,10 @@ Change logging level Verify logging level [Arguments] ${expected_log_level} - ${resp}= Get Request prh_setup_session /actuator/loggers/org.onap.dcaegen2.services.prh + ${resp}= Get Request prh_session /actuator/loggers/org.onap.dcaegen2.services.prh Should Be Equal As JSON ${resp.content} ${expected_log_level} Verify logs with heartbeat Verify logging level ${TRACE_LOG_LEVEL_CONF} - Get Request prh_setup_session /heartbeat + Get Request prh_session /heartbeat Check PRH log Heartbeat request received
\ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/resources/prh_sessions.robot b/tests/dcaegen2/prh-testcases/resources/prh_sessions.robot new file mode 100644 index 00000000..a7955129 --- /dev/null +++ b/tests/dcaegen2/prh-testcases/resources/prh_sessions.robot @@ -0,0 +1,19 @@ +*** Settings *** +Library RequestsLibrary +Library Collections + +*** Keywords *** +Create sessions + Create Session dmaap_session ${DMAAP_SIMULATOR_SETUP_URL} + Set Suite Variable ${dmaap_session} dmaap_session + Create Session aai_session ${AAI_SIMULATOR_SETUP_URL} + Set Suite Variable ${aai_session} aai_session + Create Session consul_session ${CONSUL_SETUP_URL} + Set Suite Variable ${consul_session} consul_session + Create Session prh_session ${PRH_SETUP_URL} + Set Suite Variable ${prh_session} prh_session + + +Create headers + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + Set Suite Variable ${suite_headers} ${headers}
\ No newline at end of file |