Skip to content

Commit

Permalink
Fixed failing tests
Browse files Browse the repository at this point in the history
Signed-off-by: Krishna Kondaka <[email protected]>
  • Loading branch information
Krishna Kondaka committed Feb 25, 2024
1 parent f00afb2 commit 37e1664
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import io.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;
import io.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse;
import io.opentelemetry.proto.metrics.v1.InstrumentationLibraryMetrics;
import org.opensearch.dataprepper.plugins.otel.codec.OTelProtoCodec;
import io.opentelemetry.proto.metrics.v1.Metric;
import io.opentelemetry.proto.metrics.v1.ResourceMetrics;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -73,6 +74,10 @@ public class OTelMetricsGrpcServiceTest {
@Mock
private Counter successRequestsCounter;
@Mock
private Counter droppedCounter;
@Mock
private Counter createdCounter;
@Mock
private DistributionSummary payloadSize;
@Mock
private Timer requestProcessDuration;
Expand Down Expand Up @@ -100,6 +105,8 @@ public void setup() {

when(mockPluginMetrics.counter(OTelMetricsGrpcService.REQUESTS_RECEIVED)).thenReturn(requestsReceivedCounter);
when(mockPluginMetrics.counter(OTelMetricsGrpcService.SUCCESS_REQUESTS)).thenReturn(successRequestsCounter);
when(mockPluginMetrics.counter(OTelMetricsGrpcService.RECORDS_CREATED)).thenReturn(createdCounter);
when(mockPluginMetrics.counter(OTelMetricsGrpcService.RECORDS_DROPPED)).thenReturn(droppedCounter);
when(mockPluginMetrics.summary(OTelMetricsGrpcService.PAYLOAD_SIZE)).thenReturn(payloadSize);
when(mockPluginMetrics.timer(OTelMetricsGrpcService.REQUEST_PROCESS_DURATION)).thenReturn(requestProcessDuration);
doAnswer(invocation -> {
Expand All @@ -109,7 +116,7 @@ public void setup() {

when(serviceRequestContext.isTimedOut()).thenReturn(false);

sut = new OTelMetricsGrpcService(bufferWriteTimeoutInMillis, buffer, mockPluginMetrics);
sut = new OTelMetricsGrpcService(bufferWriteTimeoutInMillis, new OTelProtoCodec.OTelProtoDecoder(), buffer, mockPluginMetrics);
}

@Test
Expand Down

0 comments on commit 37e1664

Please sign in to comment.