Add test for scheduled CBS configuration refresh in PRH
Change-Id: Ib90594b6e854d6f576fe3f3ce3b1f7e839bcf3f6
Issue-ID: DCAEGEN2-1544
Signed-off-by: grabinsk <maciej.grabinski@nokia.com>
diff --git a/tests/dcaegen2/prh-testcases/prh_tests.robot b/tests/dcaegen2/prh-testcases/prh_tests.robot
index 9334d63..43d3188 100644
--- a/tests/dcaegen2/prh-testcases/prh_tests.robot
+++ b/tests/dcaegen2/prh-testcases/prh_tests.robot
@@ -70,4 +70,9 @@
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
+ 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 f8472a5..2ca2c8d 100644
--- a/tests/dcaegen2/prh-testcases/resources/docker-compose.yml
+++ b/tests/dcaegen2/prh-testcases/resources/docker-compose.yml
@@ -54,6 +54,7 @@
image: consul:1.0.6
restart: on-failure
command: ["kv", "put", "-http-addr=http://consul:8500", "dcae-prh", '{
+ "cbs.updates-interval": 0,
"logging.level.org.onap.dcaegen2.services.prh": "debug",
"logging.level.org.onap.dcaegen2.services.sdk": "debug",
"dmaap.dmaapConsumerConfiguration.dmaapUserName":"admin",
diff --git a/tests/dcaegen2/prh-testcases/resources/prh_config_tests.robot b/tests/dcaegen2/prh-testcases/resources/prh_config_tests.robot
index 54c58f2..9044185 100644
--- a/tests/dcaegen2/prh-testcases/resources/prh_config_tests.robot
+++ b/tests/dcaegen2/prh-testcases/resources/prh_config_tests.robot
@@ -6,7 +6,7 @@
*** Keywords ***
Verify PRH configuration forced refresh
- ${some_random_value} evaluate random.randint(sys.maxint/10, sys.maxint) modules=random,sys
+ ${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}
@@ -34,3 +34,20 @@
should be equal as integers ${env_response.status_code} 200
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
+
+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