Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flakiness in Log4j2MetricsTest.asyncLogShouldNotBeDuplicated() #2451

Merged
merged 1 commit into from Feb 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -34,9 +34,11 @@
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.time.Duration;

import static java.util.Collections.emptyList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.await;

/**
* Tests for {@link Log4j2Metrics}.
Expand Down Expand Up @@ -171,7 +173,8 @@ void asyncLogShouldNotBeDuplicated() throws IOException {

assertThat(registry.get("log4j2.events").tags("level", "info").counter().count()).isEqualTo(0);
logger.info("Hello, world!");
assertThat(registry.get("log4j2.events").tags("level", "info").counter().count()).isEqualTo(1);
await().atMost(Duration.ofSeconds(1))
.until(() -> registry.get("log4j2.events").tags("level", "info").counter().count() == 1);
}

}