aboutsummaryrefslogtreecommitdiffstats
path: root/hv-collector-main/src/test
diff options
context:
space:
mode:
authorJakub Dudycz <jakub.dudycz@nokia.com>2018-06-15 16:09:41 +0200
committerPiotr Jaszczyk <piotr.jaszczyk@nokia.com>2018-08-02 10:27:38 +0200
commit553154ae42e5362dacab6c190b8cf1e1388f5b87 (patch)
tree9f78fdd5da58082883724ead537dd5368c2cf940 /hv-collector-main/src/test
parent69f43f2532106b9d2d4c64fabbf4ea092e4dbf4a (diff)
Change Consul configuration update policy
- At startup default config is applied - Configuration is updated in intervals given at VES-HV service startup to allow dynamic changes - Included consul service startup in docker-compose file - VES-HV now exits when fails to acquire confguration from consul Closes ONAP-229 Change-Id: I896cfd177fa45381f9822278c2dffc113dd3df72 Signed-off-by: jakub.dudycz@nokia.com Issue-ID: DCAEGEN2-601
Diffstat (limited to 'hv-collector-main/src/test')
-rw-r--r--hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfigurationTest.kt14
1 files changed, 13 insertions, 1 deletions
diff --git a/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfigurationTest.kt b/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfigurationTest.kt
index 4c2425bc..a14801da 100644
--- a/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfigurationTest.kt
+++ b/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfigurationTest.kt
@@ -30,6 +30,7 @@ import org.jetbrains.spek.api.dsl.on
import org.onap.dcae.collectors.veshv.domain.SecurityConfiguration
import org.onap.dcae.collectors.veshv.model.ServerConfiguration
import java.nio.file.Paths
+import java.time.Duration
/**
* @author Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
@@ -38,6 +39,8 @@ import java.nio.file.Paths
object ArgBasedServerConfigurationTest : Spek({
lateinit var cut: ArgBasedServerConfiguration
val configurationUrl = "http://test-address/test"
+ val listenPort = "6969"
+ val updateInterval = "10"
val pk = Paths.get("/", "etc", "ves", "pk.pem")
val cert = Paths.get("/", "etc", "ssl", "certs", "ca-bundle.crt")
val trustCert = Paths.get("/", "etc", "ves", "trusted.crt")
@@ -59,8 +62,9 @@ object ArgBasedServerConfigurationTest : Spek({
lateinit var result: ServerConfiguration
beforeEachTest {
- result = parse("--listen-port", "6969",
+ result = parse("--listen-port", listenPort,
"--config-url", configurationUrl,
+ "--update-interval", updateInterval,
"--private-key-file", pk.toFile().absolutePath,
"--cert-file", cert.toFile().absolutePath,
"--trust-cert-file", trustCert.toFile().absolutePath)
@@ -70,6 +74,10 @@ object ArgBasedServerConfigurationTest : Spek({
assertThat(result.port).isEqualTo(6969)
}
+ it("should set update interval") {
+ assertThat(result.configurationUpdateInterval).isEqualTo(Duration.ofSeconds(10))
+ }
+
it("should set proper config url") {
assertThat(result.configurationUrl).isEqualTo(configurationUrl)
}
@@ -112,6 +120,10 @@ object ArgBasedServerConfigurationTest : Spek({
assertThat(result.configurationUrl).isEqualTo(DefaultValues.CONFIG_URL)
}
+ it("should set default update interval") {
+ assertThat(result.configurationUpdateInterval).isEqualTo(Duration.ofSeconds(DefaultValues.UPDATE_INTERVAL))
+ }
+
on("security config") {
val securityConfiguration = result.securityConfiguration