+ describe("Messages dropped metrics") {
+ it("should gather metrics for invalid messages") {
+ val sut = vesHvWithNoOpSink(basicConfiguration)
+
+ sut.handleConnection(
+ messageWithInvalidWireFrameHeader(),
+ wireFrameMessageWithInvalidPayload(),
+ vesWireFrameMessage(domain = PERF3GPP),
+ messageWithInvalidListenerVersion()
+ )
+
+ val metrics = sut.metrics
+ assertThat(metrics.messagesDropped(INVALID_MESSAGE))
+ .describedAs("messagesDroppedCause $INVALID_MESSAGE metric")
+ .isEqualTo(3)
+ }
+
+ it("should gather metrics for route not found") {
+ val sut = vesHvWithNoOpSink(basicConfiguration)
+
+ sut.handleConnection(
+ vesWireFrameMessage(domain = PERF3GPP),
+ vesWireFrameMessage(domain = HEARTBEAT)
+ )
+
+ val metrics = sut.metrics
+ assertThat(metrics.messagesDropped(ROUTE_NOT_FOUND))
+ .describedAs("messagesDroppedCause $ROUTE_NOT_FOUND metric")
+ .isEqualTo(1)
+ }
+
+ it("should gather summed metrics for dropped messages"){
+ val sut = vesHvWithNoOpSink(basicConfiguration)
+
+ sut.handleConnection(
+ vesWireFrameMessage(domain = PERF3GPP),
+ vesWireFrameMessage(domain = HEARTBEAT),
+ wireFrameMessageWithInvalidPayload()
+ )
+
+ val metrics = sut.metrics
+ assertThat(metrics.messagesDroppedCount)
+ .describedAs("messagesDroppedCount metric")
+ .isEqualTo(2)
+ }
+ }
+})