aboutsummaryrefslogtreecommitdiffstats
path: root/hv-collector-main/src/test
diff options
context:
space:
mode:
authorJakub Dudycz <jakub.dudycz@nokia.com>2018-07-20 16:37:02 +0200
committerPiotr Jaszczyk <piotr.jaszczyk@nokia.com>2018-08-03 08:31:09 +0200
commita2d18b375631d010432089ed18db327c9e4f26bf (patch)
treead67ef481839ec7c81fb03daec7990faf715cf20 /hv-collector-main/src/test
parentf4a58fbdbcaaba92a4daae0e2807536c3da4c857 (diff)
Fix consul request timeout issue
Fix timeout issue when using consul blocking query calls by switching to standard requests peformed in given interval Closes ONAP-628 Change-Id: Ifaf7ddfa27045015a7a90c178e0d6d38955c0c58 Signed-off-by: Jakub Dudycz <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.kt31
1 files changed, 23 insertions, 8 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 0498344c..6da605f4 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
@@ -39,6 +39,7 @@ object ArgBasedServerConfigurationTest : Spek({
lateinit var cut: ArgBasedServerConfiguration
val configurationUrl = "http://test-address/test"
val firstRequestDelay = "10"
+ val requestInterval = "5"
val listenPort = "6969"
val pk = Paths.get("/", "etc", "ves", "pk.pem")
val cert = Paths.get("/", "etc", "ssl", "certs", "ca-bundle.crt")
@@ -63,6 +64,7 @@ object ArgBasedServerConfigurationTest : Spek({
"--listen-port", listenPort,
"--config-url", configurationUrl,
"--first-request-delay", firstRequestDelay,
+ "--request-interval", requestInterval,
"--private-key-file", pk.toFile().absolutePath,
"--cert-file", cert.toFile().absolutePath,
"--trust-cert-file", trustCert.toFile().absolutePath)
@@ -73,11 +75,18 @@ object ArgBasedServerConfigurationTest : Spek({
}
it("should set proper first consul request delay") {
- assertThat(result.firstRequestDelay).isEqualTo(Duration.ofSeconds(10))
+ assertThat(result.configurationProviderParams.firstRequestDelay)
+ .isEqualTo(Duration.ofSeconds(10))
+ }
+
+ it("should set proper consul request interval") {
+ assertThat(result.configurationProviderParams.requestInterval)
+ .isEqualTo(Duration.ofSeconds(5))
}
it("should set proper config url") {
- assertThat(result.configurationUrl).isEqualTo(configurationUrl)
+ assertThat(result.configurationProviderParams.configurationUrl)
+ .isEqualTo(configurationUrl)
}
it("should set proper security configuration") {
@@ -85,8 +94,6 @@ object ArgBasedServerConfigurationTest : Spek({
SecurityConfiguration(sslDisable = true, privateKey = pk, cert = cert, trustedCert = trustCert)
)
}
-
-
}
given("some parameters are present in the short form") {
@@ -101,11 +108,13 @@ object ArgBasedServerConfigurationTest : Spek({
}
it("should set proper first consul request delay") {
- assertThat(result.firstRequestDelay).isEqualTo(Duration.ofSeconds(10))
+ assertThat(result.configurationProviderParams.firstRequestDelay)
+ .isEqualTo(Duration.ofSeconds(10))
}
it("should set proper config url") {
- assertThat(result.configurationUrl).isEqualTo(configurationUrl)
+ assertThat(result.configurationProviderParams.configurationUrl)
+ .isEqualTo(configurationUrl)
}
}
@@ -121,14 +130,20 @@ object ArgBasedServerConfigurationTest : Spek({
}
it("should set default config url") {
- assertThat(result.configurationUrl).isEqualTo(DefaultValues.CONFIG_URL)
+ assertThat(result.configurationProviderParams.configurationUrl)
+ .isEqualTo(DefaultValues.CONFIG_URL)
}
it("should set default first consul request delay") {
- assertThat(result.firstRequestDelay)
+ assertThat(result.configurationProviderParams.firstRequestDelay)
.isEqualTo(Duration.ofSeconds(DefaultValues.CONSUL_FIRST_REQUEST_DELAY))
}
+ it("should set default consul request interval") {
+ assertThat(result.configurationProviderParams.requestInterval)
+ .isEqualTo(Duration.ofSeconds(DefaultValues.CONSUL_REQUEST_INTERVAL))
+ }
+
on("security config") {
val securityConfiguration = result.securityConfiguration