aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dcaegen2/prh-testcases
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dcaegen2/prh-testcases')
-rw-r--r--tests/dcaegen2/prh-testcases/prh_config_tests.robot33
-rw-r--r--tests/dcaegen2/prh-testcases/prh_tests.robot20
-rw-r--r--tests/dcaegen2/prh-testcases/resources/docker-compose.yml1
-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.robot22
-rw-r--r--tests/dcaegen2/prh-testcases/resources/prh_sessions.robot6
6 files changed, 59 insertions, 43 deletions
diff --git a/tests/dcaegen2/prh-testcases/prh_config_tests.robot b/tests/dcaegen2/prh-testcases/prh_config_tests.robot
new file mode 100644
index 00000000..144504d1
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/prh_config_tests.robot
@@ -0,0 +1,33 @@
+*** Settings ***
+Documentation Tests related to updating PRH app config based on CBS config
+Suite Setup Run keywords Create sessions
+Resource resources/prh_sessions.robot
+Resource resources/prh_config_library.robot
+Resource resources/prh_library.robot
+Test Timeout 15 seconds
+
+*** Test Cases ***
+CBS configuration forced refresh
+ [Documentation] It should be possible to force refresh PRH configuration from CBS
+ [Tags] PRH coniguration
+ ${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}
+
+CBS configuration scheduled refresh
+ [Documentation] PRH should pull for CBS configuration updates according to schedule
+ [Tags] PRH coniguration
+ 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
+
+PRH log level change based on CBS config
+ [Documentation] It should be possible to change logging levels in PRH based on entries in CBS
+ [Tags] PRH coniguration logging
+ Set logging level in CBS org.onap.dcaegen2.services.prh.foo WARN
+ Force PRH config refresh
+ Verify logging level org.onap.dcaegen2.services.prh.foo WARN \ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/prh_tests.robot b/tests/dcaegen2/prh-testcases/prh_tests.robot
index 43d31885..4e387b91 100644
--- a/tests/dcaegen2/prh-testcases/prh_tests.robot
+++ b/tests/dcaegen2/prh-testcases/prh_tests.robot
@@ -8,18 +8,10 @@ Test Timeout 2 minutes
Library resources/PrhLibrary.py
Resource resources/prh_sessions.robot
Resource resources/prh_library.robot
-Resource resources/prh_config_tests.robot
*** Variables ***
${TEST_CASES_DIR} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets
-${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
[Documentation] PRH get from DMaaP valid event with valid attachment point
@@ -63,16 +55,6 @@ BBS case event - Re-registration
${TEST_CASES_DIR}/re-registration
PRH logging level change
- [Documentation] PRH logging level change from WARN to TRACE
+ [Documentation] ad-hoc PRH logging level change using rest endpoint
[Tags] PRH logging level
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
-
-CBS configuration scheduled refresh
- [Documentation] PRH should pull for CBS configuration updates according to schedule
- [Tags] PRH coniguration
- Verify scheduled CBS config updates \ No newline at end of file
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 baf3a8c5..3ed377c7 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 ***
@@ -152,20 +151,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}