|
21 | 21 | import java.nio.file.Path; |
22 | 22 | import java.time.Duration; |
23 | 23 | import java.util.ArrayList; |
24 | | -import java.util.Arrays; |
25 | 24 | import java.util.Collection; |
26 | 25 | import java.util.List; |
27 | 26 | import java.util.concurrent.BlockingQueue; |
28 | 27 | import java.util.concurrent.ExecutionException; |
29 | 28 | import java.util.concurrent.LinkedBlockingDeque; |
30 | | -import java.util.function.Consumer; |
31 | 29 | import java.util.stream.Collectors; |
32 | 30 | import org.junit.jupiter.api.AfterAll; |
33 | 31 | import org.junit.jupiter.api.AfterEach; |
@@ -125,45 +123,6 @@ void endToEndTest(@TempDir Path tmpDir) { |
125 | 123 | verifyMetrics(); |
126 | 124 | } |
127 | 125 |
|
128 | | - // TODO: This implementation is DEPRECATED and will be removed once all integration tests are |
129 | | - // migrated to MetricsVerifier |
130 | | - protected void waitAndAssertMetrics(Iterable<Consumer<Metric>> assertions) { |
131 | | - await() |
132 | | - .atMost(Duration.ofSeconds(30)) |
133 | | - .untilAsserted( |
134 | | - () -> { |
135 | | - List<ExportMetricsServiceRequest> receivedMetrics = otlpServer.getMetrics(); |
136 | | - assertThat(receivedMetrics).describedAs("no metric received").isNotEmpty(); |
137 | | - |
138 | | - List<Metric> metrics = |
139 | | - receivedMetrics.stream() |
140 | | - .map(ExportMetricsServiceRequest::getResourceMetricsList) |
141 | | - .flatMap(rm -> rm.stream().map(ResourceMetrics::getScopeMetricsList)) |
142 | | - .flatMap(Collection::stream) |
143 | | - .filter( |
144 | | - // TODO: disabling batch span exporter might help remove unwanted metrics |
145 | | - sm -> sm.getScope().getName().equals("io.opentelemetry.jmx")) |
146 | | - .flatMap(sm -> sm.getMetricsList().stream()) |
147 | | - .collect(Collectors.toList()); |
148 | | - |
149 | | - assertThat(metrics) |
150 | | - .describedAs("metrics reported but none from JMX scraper") |
151 | | - .isNotEmpty(); |
152 | | - |
153 | | - for (Consumer<Metric> assertion : assertions) { |
154 | | - assertThat(metrics).anySatisfy(assertion); |
155 | | - } |
156 | | - }); |
157 | | - } |
158 | | - |
159 | | - // TODO: This implementation is DEPRECATED and will be removed once all integration tests are |
160 | | - // migrated to MetricsVerifier |
161 | | - @SafeVarargs |
162 | | - @SuppressWarnings("varargs") |
163 | | - protected final void waitAndAssertMetrics(Consumer<Metric>... assertions) { |
164 | | - waitAndAssertMetrics(Arrays.asList(assertions)); |
165 | | - } |
166 | | - |
167 | 126 | protected void verifyMetrics() { |
168 | 127 | MetricsVerifier metricsVerifier = createMetricsVerifier(); |
169 | 128 | await() |
@@ -192,11 +151,7 @@ protected void verifyMetrics() { |
192 | 151 | }); |
193 | 152 | } |
194 | 153 |
|
195 | | - // TODO: This method is going to be abstract once all integration tests are migrated to |
196 | | - // MetricsVerifier |
197 | | - protected MetricsVerifier createMetricsVerifier() { |
198 | | - return MetricsVerifier.create(); |
199 | | - } |
| 154 | + protected abstract MetricsVerifier createMetricsVerifier(); |
200 | 155 |
|
201 | 156 | protected JmxScraperContainer customizeScraperContainer( |
202 | 157 | JmxScraperContainer scraper, GenericContainer<?> target, Path tempDir) { |
|
0 commit comments