Skip to content

Commit

Permalink
cleanup log filter (#11719)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeitlinger authored Jul 2, 2024
1 parent a3ec307 commit 99ab78c
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import static org.assertj.core.api.Assertions.assertThat;

import io.opentelemetry.api.OpenTelemetry;
import java.util.Arrays;
import java.util.List;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
Expand All @@ -19,6 +21,11 @@
@ExtendWith(OutputCaptureExtension.class)
public abstract class AbstractSpringStarterSmokeTest {

private static final List<String> IGNORED_WARNINGS =
Arrays.asList(
"Unable to load io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider",
"The architecture 'amd64' for image");

@Autowired protected OpenTelemetry openTelemetry;

protected SpringSmokeTestRunner testing;
Expand Down Expand Up @@ -47,11 +54,10 @@ void checkSpringLogs(CapturedOutput output) {
// only look for WARN and ERROR log level, e.g. [Test worker] WARN
.satisfies(
s -> {
if (!s.toString()
.contains(
"Unable to load io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider")
&& !s.toString().contains("The architecture 'amd64' for image")) {
assertThat(s).doesNotContain("] WARN").doesNotContain("] ERROR");
for (String line : s.toString().split("\n")) {
if (IGNORED_WARNINGS.stream().noneMatch(line::contains)) {
assertThat(line).doesNotContain("] WARN").doesNotContain("] ERROR");
}
}
});
}
Expand Down

0 comments on commit 99ab78c

Please sign in to comment.