Skip to content

Commit

Permalink
Cleaned up integration tests (#1101)
Browse files Browse the repository at this point in the history
Signed-off-by: dhoard <[email protected]>
  • Loading branch information
dhoard authored Dec 18, 2024
1 parent 0a35c0b commit 3f90ac2
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 182 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironme

HttpResponse httpResponse = HttpClient.sendRequest(url);

assertMetricsResponse(exporterTestEnvironment, httpResponse, MetricsContentType.DEFAULT);
assertMetricsResponse(httpResponse, MetricsContentType.DEFAULT);
}

@Verifyica.Test
Expand All @@ -91,10 +91,7 @@ public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvir
HttpHeader.ACCEPT,
MetricsContentType.OPEN_METRICS_TEXT_METRICS.toString());

assertMetricsResponse(
exporterTestEnvironment,
httpResponse,
MetricsContentType.OPEN_METRICS_TEXT_METRICS);
assertMetricsResponse(httpResponse, MetricsContentType.OPEN_METRICS_TEXT_METRICS);
}

@Verifyica.Test
Expand All @@ -108,8 +105,7 @@ public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnviro
HttpHeader.ACCEPT,
MetricsContentType.PROMETHEUS_TEXT_METRICS.toString());

assertMetricsResponse(
exporterTestEnvironment, httpResponse, MetricsContentType.PROMETHEUS_TEXT_METRICS);
assertMetricsResponse(httpResponse, MetricsContentType.PROMETHEUS_TEXT_METRICS);
}

@Verifyica.Test
Expand All @@ -123,10 +119,7 @@ public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEn
HttpHeader.ACCEPT,
MetricsContentType.PROMETHEUS_PROTOBUF_METRICS.toString());

assertMetricsResponse(
exporterTestEnvironment,
httpResponse,
MetricsContentType.PROMETHEUS_PROTOBUF_METRICS);
assertMetricsResponse(httpResponse, MetricsContentType.PROMETHEUS_PROTOBUF_METRICS);
}

@Verifyica.AfterAll
Expand All @@ -145,9 +138,7 @@ public static void conclude(ClassContext classContext) throws Throwable {
}

private void assertMetricsResponse(
ExporterTestEnvironment exporterTestEnvironment,
HttpResponse httpResponse,
MetricsContentType metricsContentType) {
HttpResponse httpResponse, MetricsContentType metricsContentType) {
assertCommonMetricsResponse(httpResponse, metricsContentType);

Collection<Metric> metrics = MetricsParser.parseCollection(httpResponse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironme

HttpResponse httpResponse = HttpClient.sendRequest(url);

assertMetricsResponse(exporterTestEnvironment, httpResponse, MetricsContentType.DEFAULT);
assertMetricsResponse(httpResponse, MetricsContentType.DEFAULT);
}

@Verifyica.Test
Expand All @@ -90,10 +90,7 @@ public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvir
HttpHeader.ACCEPT,
MetricsContentType.OPEN_METRICS_TEXT_METRICS.toString());

assertMetricsResponse(
exporterTestEnvironment,
httpResponse,
MetricsContentType.OPEN_METRICS_TEXT_METRICS);
assertMetricsResponse(httpResponse, MetricsContentType.OPEN_METRICS_TEXT_METRICS);
}

@Verifyica.Test
Expand All @@ -107,8 +104,7 @@ public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnviro
HttpHeader.ACCEPT,
MetricsContentType.PROMETHEUS_TEXT_METRICS.toString());

assertMetricsResponse(
exporterTestEnvironment, httpResponse, MetricsContentType.PROMETHEUS_TEXT_METRICS);
assertMetricsResponse(httpResponse, MetricsContentType.PROMETHEUS_TEXT_METRICS);
}

@Verifyica.Test
Expand All @@ -122,10 +118,7 @@ public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEn
HttpHeader.ACCEPT,
MetricsContentType.PROMETHEUS_PROTOBUF_METRICS.toString());

assertMetricsResponse(
exporterTestEnvironment,
httpResponse,
MetricsContentType.PROMETHEUS_PROTOBUF_METRICS);
assertMetricsResponse(httpResponse, MetricsContentType.PROMETHEUS_PROTOBUF_METRICS);
}

@Verifyica.AfterAll
Expand All @@ -144,9 +137,7 @@ public static void conclude(ClassContext classContext) throws Throwable {
}

private void assertMetricsResponse(
ExporterTestEnvironment exporterTestEnvironment,
HttpResponse httpResponse,
MetricsContentType metricsContentType) {
HttpResponse httpResponse, MetricsContentType metricsContentType) {
assertCommonMetricsResponse(httpResponse, metricsContentType);

Collection<Metric> metrics = MetricsParser.parseCollection(httpResponse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironme

HttpResponse httpResponse = HttpClient.sendRequest(url);

assertMetricsResponse(exporterTestEnvironment, httpResponse, MetricsContentType.DEFAULT);
assertMetricsResponse(httpResponse, MetricsContentType.DEFAULT);
}

@Verifyica.Test
Expand All @@ -92,10 +92,7 @@ public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvir
HttpHeader.ACCEPT,
MetricsContentType.OPEN_METRICS_TEXT_METRICS.toString());

assertMetricsResponse(
exporterTestEnvironment,
httpResponse,
MetricsContentType.OPEN_METRICS_TEXT_METRICS);
assertMetricsResponse(httpResponse, MetricsContentType.OPEN_METRICS_TEXT_METRICS);
}

@Verifyica.Test
Expand All @@ -109,8 +106,7 @@ public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnviro
HttpHeader.ACCEPT,
MetricsContentType.PROMETHEUS_TEXT_METRICS.toString());

assertMetricsResponse(
exporterTestEnvironment, httpResponse, MetricsContentType.PROMETHEUS_TEXT_METRICS);
assertMetricsResponse(httpResponse, MetricsContentType.PROMETHEUS_TEXT_METRICS);
}

@Verifyica.Test
Expand All @@ -124,10 +120,7 @@ public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEn
HttpHeader.ACCEPT,
MetricsContentType.PROMETHEUS_PROTOBUF_METRICS.toString());

assertMetricsResponse(
exporterTestEnvironment,
httpResponse,
MetricsContentType.PROMETHEUS_PROTOBUF_METRICS);
assertMetricsResponse(httpResponse, MetricsContentType.PROMETHEUS_PROTOBUF_METRICS);
}

@Verifyica.AfterAll
Expand All @@ -146,9 +139,7 @@ public static void conclude(ClassContext classContext) throws Throwable {
}

private void assertMetricsResponse(
ExporterTestEnvironment exporterTestEnvironment,
HttpResponse httpResponse,
MetricsContentType metricsContentType) {
HttpResponse httpResponse, MetricsContentType metricsContentType) {
assertCommonMetricsResponse(httpResponse, metricsContentType);

Collection<Metric> metrics = MetricsParser.parseCollection(httpResponse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironme

HttpResponse httpResponse = HttpClient.sendRequest(url);

assertMetricsResponse(exporterTestEnvironment, httpResponse, MetricsContentType.DEFAULT);
assertMetricsResponse(httpResponse, MetricsContentType.DEFAULT);
}

@Verifyica.Test
Expand All @@ -92,10 +92,7 @@ public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvir
HttpHeader.ACCEPT,
MetricsContentType.OPEN_METRICS_TEXT_METRICS.toString());

assertMetricsResponse(
exporterTestEnvironment,
httpResponse,
MetricsContentType.OPEN_METRICS_TEXT_METRICS);
assertMetricsResponse(httpResponse, MetricsContentType.OPEN_METRICS_TEXT_METRICS);
}

@Verifyica.Test
Expand All @@ -109,8 +106,7 @@ public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnviro
HttpHeader.ACCEPT,
MetricsContentType.PROMETHEUS_TEXT_METRICS.toString());

assertMetricsResponse(
exporterTestEnvironment, httpResponse, MetricsContentType.PROMETHEUS_TEXT_METRICS);
assertMetricsResponse(httpResponse, MetricsContentType.PROMETHEUS_TEXT_METRICS);
}

@Verifyica.Test
Expand All @@ -124,10 +120,7 @@ public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEn
HttpHeader.ACCEPT,
MetricsContentType.PROMETHEUS_PROTOBUF_METRICS.toString());

assertMetricsResponse(
exporterTestEnvironment,
httpResponse,
MetricsContentType.PROMETHEUS_PROTOBUF_METRICS);
assertMetricsResponse(httpResponse, MetricsContentType.PROMETHEUS_PROTOBUF_METRICS);
}

@Verifyica.AfterAll
Expand All @@ -146,9 +139,7 @@ public static void conclude(ClassContext classContext) throws Throwable {
}

private void assertMetricsResponse(
ExporterTestEnvironment exporterTestEnvironment,
HttpResponse httpResponse,
MetricsContentType metricsContentType) {
HttpResponse httpResponse, MetricsContentType metricsContentType) {
assertCommonMetricsResponse(httpResponse, metricsContentType);

Collection<Metric> metrics = MetricsParser.parseCollection(httpResponse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironme

HttpResponse httpResponse = HttpClient.sendRequest(url);

assertMetricsResponse(exporterTestEnvironment, httpResponse, MetricsContentType.DEFAULT);
assertMetricsResponse(httpResponse, MetricsContentType.DEFAULT);
}

@Verifyica.Test
Expand All @@ -91,10 +91,7 @@ public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvir
HttpHeader.ACCEPT,
MetricsContentType.OPEN_METRICS_TEXT_METRICS.toString());

assertMetricsResponse(
exporterTestEnvironment,
httpResponse,
MetricsContentType.OPEN_METRICS_TEXT_METRICS);
assertMetricsResponse(httpResponse, MetricsContentType.OPEN_METRICS_TEXT_METRICS);
}

@Verifyica.Test
Expand All @@ -108,8 +105,7 @@ public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnviro
HttpHeader.ACCEPT,
MetricsContentType.PROMETHEUS_TEXT_METRICS.toString());

assertMetricsResponse(
exporterTestEnvironment, httpResponse, MetricsContentType.PROMETHEUS_TEXT_METRICS);
assertMetricsResponse(httpResponse, MetricsContentType.PROMETHEUS_TEXT_METRICS);
}

@Verifyica.Test
Expand All @@ -123,10 +119,7 @@ public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEn
HttpHeader.ACCEPT,
MetricsContentType.PROMETHEUS_PROTOBUF_METRICS.toString());

assertMetricsResponse(
exporterTestEnvironment,
httpResponse,
MetricsContentType.PROMETHEUS_PROTOBUF_METRICS);
assertMetricsResponse(httpResponse, MetricsContentType.PROMETHEUS_PROTOBUF_METRICS);
}

@Verifyica.AfterAll
Expand All @@ -145,9 +138,7 @@ public static void conclude(ClassContext classContext) throws Throwable {
}

private void assertMetricsResponse(
ExporterTestEnvironment exporterTestEnvironment,
HttpResponse httpResponse,
MetricsContentType metricsContentType) {
HttpResponse httpResponse, MetricsContentType metricsContentType) {
assertCommonMetricsResponse(httpResponse, metricsContentType);

Collection<Metric> metrics = MetricsParser.parseCollection(httpResponse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironme

HttpResponse httpResponse = HttpClient.sendRequest(url);

assertMetricsResponse(exporterTestEnvironment, httpResponse, MetricsContentType.DEFAULT);
assertMetricsResponse(httpResponse, MetricsContentType.DEFAULT);
}

@Verifyica.Test
Expand All @@ -91,10 +91,7 @@ public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvir
HttpHeader.ACCEPT,
MetricsContentType.OPEN_METRICS_TEXT_METRICS.toString());

assertMetricsResponse(
exporterTestEnvironment,
httpResponse,
MetricsContentType.OPEN_METRICS_TEXT_METRICS);
assertMetricsResponse(httpResponse, MetricsContentType.OPEN_METRICS_TEXT_METRICS);
}

@Verifyica.Test
Expand All @@ -108,8 +105,7 @@ public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnviro
HttpHeader.ACCEPT,
MetricsContentType.PROMETHEUS_TEXT_METRICS.toString());

assertMetricsResponse(
exporterTestEnvironment, httpResponse, MetricsContentType.PROMETHEUS_TEXT_METRICS);
assertMetricsResponse(httpResponse, MetricsContentType.PROMETHEUS_TEXT_METRICS);
}

@Verifyica.Test
Expand All @@ -123,10 +119,7 @@ public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEn
HttpHeader.ACCEPT,
MetricsContentType.PROMETHEUS_PROTOBUF_METRICS.toString());

assertMetricsResponse(
exporterTestEnvironment,
httpResponse,
MetricsContentType.PROMETHEUS_PROTOBUF_METRICS);
assertMetricsResponse(httpResponse, MetricsContentType.PROMETHEUS_PROTOBUF_METRICS);
}

@Verifyica.AfterAll
Expand All @@ -145,9 +138,7 @@ public static void conclude(ClassContext classContext) throws Throwable {
}

private void assertMetricsResponse(
ExporterTestEnvironment exporterTestEnvironment,
HttpResponse httpResponse,
MetricsContentType metricsContentType) {
HttpResponse httpResponse, MetricsContentType metricsContentType) {
assertCommonMetricsResponse(httpResponse, metricsContentType);

Collection<Metric> metrics = MetricsParser.parseCollection(httpResponse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironme

HttpResponse httpResponse = HttpClient.sendRequest(url);

assertMetricsResponse(exporterTestEnvironment, httpResponse, MetricsContentType.DEFAULT);
assertMetricsResponse(httpResponse, MetricsContentType.DEFAULT);
}

@Verifyica.Test
Expand All @@ -94,10 +94,7 @@ public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvir
HttpHeader.ACCEPT,
MetricsContentType.OPEN_METRICS_TEXT_METRICS.toString());

assertMetricsResponse(
exporterTestEnvironment,
httpResponse,
MetricsContentType.OPEN_METRICS_TEXT_METRICS);
assertMetricsResponse(httpResponse, MetricsContentType.OPEN_METRICS_TEXT_METRICS);
}

@Verifyica.Test
Expand All @@ -111,8 +108,7 @@ public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnviro
HttpHeader.ACCEPT,
MetricsContentType.PROMETHEUS_TEXT_METRICS.toString());

assertMetricsResponse(
exporterTestEnvironment, httpResponse, MetricsContentType.PROMETHEUS_TEXT_METRICS);
assertMetricsResponse(httpResponse, MetricsContentType.PROMETHEUS_TEXT_METRICS);
}

@Verifyica.Test
Expand All @@ -126,10 +122,7 @@ public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEn
HttpHeader.ACCEPT,
MetricsContentType.PROMETHEUS_PROTOBUF_METRICS.toString());

assertMetricsResponse(
exporterTestEnvironment,
httpResponse,
MetricsContentType.PROMETHEUS_PROTOBUF_METRICS);
assertMetricsResponse(httpResponse, MetricsContentType.PROMETHEUS_PROTOBUF_METRICS);
}

@Verifyica.AfterAll
Expand All @@ -148,9 +141,7 @@ public static void conclude(ClassContext classContext) throws Throwable {
}

private void assertMetricsResponse(
ExporterTestEnvironment exporterTestEnvironment,
HttpResponse httpResponse,
MetricsContentType metricsContentType) {
HttpResponse httpResponse, MetricsContentType metricsContentType) {
assertCommonMetricsResponse(httpResponse, metricsContentType);

Collection<Metric> metrics = MetricsParser.parseCollection(httpResponse);
Expand Down
Loading

0 comments on commit 3f90ac2

Please sign in to comment.