diff options
author | kjaniak <kornel.janiak@nokia.com> | 2019-07-03 13:31:31 +0200 |
---|---|---|
committer | kjaniak <kornel.janiak@nokia.com> | 2019-07-03 13:31:31 +0200 |
commit | 867deb3761cdf9c02a2140b16ad42d8f593dc2c9 (patch) | |
tree | 169e7d2ecaa5d65511195b561e30d8790748348a /sources/hv-collector-kafka-consumer/src/test/kotlin | |
parent | 3e4f108d66fb31e5ea713fef1cf7bc99c0510c21 (diff) |
Change handling of offset metric for consumer app
Change-Id: Ia83469783d64d0174624489df671006e72bc8948
Issue-ID: DCAEGEN2-1635
Signed-off-by: kjaniak <kornel.janiak@nokia.com>
Diffstat (limited to 'sources/hv-collector-kafka-consumer/src/test/kotlin')
2 files changed, 5 insertions, 3 deletions
diff --git a/sources/hv-collector-kafka-consumer/src/test/kotlin/org/onap/dcae/collectors/veshv/kafkaconsumer/metrics/MicrometerMetricsTest.kt b/sources/hv-collector-kafka-consumer/src/test/kotlin/org/onap/dcae/collectors/veshv/kafkaconsumer/metrics/MicrometerMetricsTest.kt index 96ba588f..93a39ae8 100644 --- a/sources/hv-collector-kafka-consumer/src/test/kotlin/org/onap/dcae/collectors/veshv/kafkaconsumer/metrics/MicrometerMetricsTest.kt +++ b/sources/hv-collector-kafka-consumer/src/test/kotlin/org/onap/dcae/collectors/veshv/kafkaconsumer/metrics/MicrometerMetricsTest.kt @@ -21,6 +21,7 @@ package org.onap.dcae.collectors.veshv.kafkaconsumer.metrics import io.micrometer.prometheus.PrometheusConfig import io.micrometer.prometheus.PrometheusMeterRegistry +import org.apache.kafka.common.TopicPartition import org.assertj.core.api.Assertions.assertThat import org.assertj.core.data.Percentage import org.jetbrains.spek.api.Spek @@ -68,13 +69,14 @@ object MicrometerMetricsTest : Spek({ } describe("Gauges") { - val gaugeName = "$PREFIX.consumer.offset" + val gaugeName = "$PREFIX.consumer.offset.topic" on("notifyOffsetChanged") { val offset = 966L + val topicPartition = TopicPartition("sample_topic", 1) it("should update $gaugeName") { - cut.notifyOffsetChanged(offset, "sample_topic", 1) + cut.notifyOffsetChanged(offset, topicPartition) registry.verifyGauge(gaugeName) { assertThat(it.value()).isCloseTo(offset.toDouble(), doublePrecision) diff --git a/sources/hv-collector-kafka-consumer/src/test/kotlin/org/onap/dcae/collectors/veshv/kafkaconsumer/state/OffsetConsumerTest.kt b/sources/hv-collector-kafka-consumer/src/test/kotlin/org/onap/dcae/collectors/veshv/kafkaconsumer/state/OffsetConsumerTest.kt index 242f27be..5ccb483a 100644 --- a/sources/hv-collector-kafka-consumer/src/test/kotlin/org/onap/dcae/collectors/veshv/kafkaconsumer/state/OffsetConsumerTest.kt +++ b/sources/hv-collector-kafka-consumer/src/test/kotlin/org/onap/dcae/collectors/veshv/kafkaconsumer/state/OffsetConsumerTest.kt @@ -40,7 +40,7 @@ object OffsetConsumerTest : Spek({ offsetConsumer.update(topicPartition, newOffset) it("should notify message newOffset metric") { - verify(mockedMetrics).notifyOffsetChanged(newOffset, topicName, partitionNumber) + verify(mockedMetrics).notifyOffsetChanged(newOffset, topicPartition) } } } |