diff options
author | grabinsk <maciej.grabinski@nokia.com> | 2019-06-21 15:08:21 +0200 |
---|---|---|
committer | grabinsk <maciej.grabinski@nokia.com> | 2019-06-21 15:17:11 +0200 |
commit | ad1421e482283b8ec6b197a9cb04dccfa0daee1f (patch) | |
tree | fb17650320a62b16f5cb218cc3a97ed4e921573b /tests/dcaegen2/prh-testcases/resources | |
parent | a287903f5870abe40efbbe764a55d8e11d4df475 (diff) |
Add test for logging level change in PRH based on configuration from CBS
Extracting config related tests to separate suit since they do not share common setup and teardown.
Small improvements in existing test for ad-hoc logging level change using rest endpoint.
Change-Id: I0b81680cc68cd210aad01b87f84856200cb4b88b
Issue-ID: DCAEGEN2-1544
Signed-off-by: grabinsk <maciej.grabinski@nokia.com>
Diffstat (limited to 'tests/dcaegen2/prh-testcases/resources')
-rw-r--r-- | tests/dcaegen2/prh-testcases/resources/docker-compose.yml | 1 | ||||
-rw-r--r-- | tests/dcaegen2/prh-testcases/resources/prh_config_library.robot (renamed from tests/dcaegen2/prh-testcases/resources/prh_config_tests.robot) | 20 | ||||
-rw-r--r-- | tests/dcaegen2/prh-testcases/resources/prh_library.robot | 22 | ||||
-rw-r--r-- | tests/dcaegen2/prh-testcases/resources/prh_sessions.robot | 6 |
4 files changed, 25 insertions, 24 deletions
diff --git a/tests/dcaegen2/prh-testcases/resources/docker-compose.yml b/tests/dcaegen2/prh-testcases/resources/docker-compose.yml index 2ca2c8d5..ca94dfb2 100644 --- a/tests/dcaegen2/prh-testcases/resources/docker-compose.yml +++ b/tests/dcaegen2/prh-testcases/resources/docker-compose.yml @@ -57,6 +57,7 @@ services: "cbs.updates-interval": 0, "logging.level.org.onap.dcaegen2.services.prh": "debug", "logging.level.org.onap.dcaegen2.services.sdk": "debug", + "logging.level.org.onap.dcaegen2.services.prh.controllers.AppInfoController": "off", "dmaap.dmaapConsumerConfiguration.dmaapUserName":"admin", "dmaap.dmaapConsumerConfiguration.dmaapUserPassword":"admin", "dmaap.dmaapConsumerConfiguration.dmaapContentType": "application/json", diff --git a/tests/dcaegen2/prh-testcases/resources/prh_config_tests.robot b/tests/dcaegen2/prh-testcases/resources/prh_config_library.robot index 9044185d..26a62704 100644 --- a/tests/dcaegen2/prh-testcases/resources/prh_config_tests.robot +++ b/tests/dcaegen2/prh-testcases/resources/prh_config_library.robot @@ -1,16 +1,10 @@ *** Settings *** -Documentation Tests and keywords related to updating PRH app config based on CBS config +Documentation Keywords related to checking and updating PRH app config based on CBS config Library RequestsLibrary Library Collections *** Keywords *** -Verify PRH configuration forced refresh - ${some_random_value}= Generate random value - 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 @@ -35,19 +29,15 @@ Check key-value in PRH app environment log ${env_response.content} should be equal ${env_response.json()["property"]["value"]} ${expected_value} -Verify scheduled CBS config updates - Set scheduled CBS updates interval 1s - ${some_random_value}= Generate random value - Put key-value to consul spam_${some_random_value} ham_${some_random_value} - wait until keyword succeeds 20x 500ms - ... Check key-value in PRH app environment spam_${some_random_value} ham_${some_random_value} - [Teardown] Set scheduled CBS updates interval 0 - Set scheduled CBS updates interval [Arguments] ${cbs_updates_interval} Put key-value to consul cbs.updates-interval ${cbs_updates_interval} Force PRH config refresh +Set logging level in CBS + [Arguments] ${logger} ${level} + Put key-value to consul logging.level.${logger} ${level} + Generate random value ${some_random_value} evaluate random.randint(sys.maxint/10, sys.maxint) modules=random,sys [Return] ${some_random_value}
\ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/resources/prh_library.robot b/tests/dcaegen2/prh-testcases/resources/prh_library.robot index b52b27c3..c00f012f 100644 --- a/tests/dcaegen2/prh-testcases/resources/prh_library.robot +++ b/tests/dcaegen2/prh-testcases/resources/prh_library.robot @@ -2,7 +2,6 @@ Library RequestsLibrary Library Collections Library PrhLibrary.py -Library OperatingSystem Resource ../../../common.robot *** Keywords *** @@ -151,20 +150,25 @@ Reset DMaaP simulator Verify change logging level - Change logging level TRACE + ${logger}= Set Variable org.onap.dcaegen2.services.prh.controllers.AppInfoController + Change logging level ${logger} TRACE + Verify logging level ${logger} TRACE Verify logs with heartbeat - Change logging level INFO + [Teardown] Change logging level ${logger} INFO Change logging level - [Arguments] ${expected_log_level} - Run curl -i -X POST -H 'Content-Type: application/json' -d '{"configuredLevel": "${expected_log_level}"}' http://localhost:8100/actuator/loggers/org.onap.dcaegen2.services.prh + [Arguments] ${logger} ${log_level} + ${request_body}= Create Dictionary configuredLevel=${log_level} + ${resp}= Post Request prh_session /actuator/loggers/${logger} json=${request_body} + Should Be Equal As Integers ${resp.status_code} 204 Verify logging level - [Arguments] ${expected_log_level} - ${resp}= Get Request prh_session /actuator/loggers/org.onap.dcaegen2.services.prh - Should Be Equal As JSON ${resp.content} ${expected_log_level} + [Arguments] ${logger} ${expected_log_level} + ${resp}= Get Request prh_session /actuator/loggers/${logger} + Should Be Equal As Integers ${resp.status_code} 200 + Log ${resp.content} + Should Be Equal As Strings ${resp.json()["configuredLevel"]} ${expected_log_level} ignore_case=true Verify logs with heartbeat - Verify logging level ${TRACE_LOG_LEVEL_CONF} 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 index a7955129..2fadbbae 100644 --- a/tests/dcaegen2/prh-testcases/resources/prh_sessions.robot +++ b/tests/dcaegen2/prh-testcases/resources/prh_sessions.robot @@ -2,6 +2,12 @@ Library RequestsLibrary Library Collections +*** Variables *** +${DMAAP_SIMULATOR_SETUP_URL} http://${DMAAP_SIMULATOR_SETUP} +${AAI_SIMULATOR_SETUP_URL} http://${AAI_SIMULATOR_SETUP} +${CONSUL_SETUP_URL} http://${CONSUL_SETUP} +${PRH_SETUP_URL} http://${PRH_SETUP} + *** Keywords *** Create sessions Create Session dmaap_session ${DMAAP_SIMULATOR_SETUP_URL} |