add log level change test
Change-Id: Ie4fb5192a86e4433df865c8913ea212d25acc00b
Issue-ID: INT-1107
Signed-off-by: micdzied <michal.1.dziedzic@nokia.com>
diff --git a/tests/dcaegen2/prh-testcases/prh_tests.robot b/tests/dcaegen2/prh-testcases/prh_tests.robot
index 9914a7e..88e1712 100644
--- a/tests/dcaegen2/prh-testcases/prh_tests.robot
+++ b/tests/dcaegen2/prh-testcases/prh_tests.robot
@@ -15,6 +15,9 @@
${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}
+${TRACE_LOG_LEVEL_CONF} {"configuredLevel":"TRACE","effectiveLevel":"TRACE"}
+${WARN_LOG_LEVEL_CONF} {"configuredLevel":"WARN","effectiveLevel":"WARN"}
*** Test Cases ***
BBS case event - attachment point
@@ -56,4 +59,9 @@
[Documentation] After regitered PNF, PRH reads another one PRH event with registration event
[Tags] PRH Valid event Re registraiton
[Template] Verify PNF re registration
- ${TEST_CASES_DIR}/re-registration
\ No newline at end of file
+ ${TEST_CASES_DIR}/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
diff --git a/tests/dcaegen2/prh-testcases/resources/prh_library.robot b/tests/dcaegen2/prh-testcases/resources/prh_library.robot
index 007caf3..ce5b65b 100644
--- a/tests/dcaegen2/prh-testcases/resources/prh_library.robot
+++ b/tests/dcaegen2/prh-testcases/resources/prh_library.robot
@@ -2,6 +2,7 @@
Library RequestsLibrary
Library Collections
Library PrhLibrary.py
+Library OperatingSystem
Resource ../../../common.robot
*** Keywords ***
@@ -143,6 +144,8 @@
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
@@ -158,4 +161,23 @@
Create headers
${headers}= Create Dictionary Accept=application/json Content-Type=application/json
- Set Suite Variable ${suite_headers} ${headers}
\ No newline at end of file
+ Set Suite Variable ${suite_headers} ${headers}
+
+Verify change logging level
+ Change logging level TRACE
+ Verify logs with heartbeat
+ Change logging level 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
+
+Verify logging level
+ [Arguments] ${expected_log_level}
+ ${resp}= Get Request prh_setup_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
+ Check PRH log Heartbeat request received
\ No newline at end of file