Skip to content

Commit

Permalink
Fix flakiness in Log4j2MetricsTest.asyncLogShouldNotBeDuplicated() (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
izeye committed Feb 15, 2021
1 parent 71b3f5a commit 08dee6f
Showing 1 changed file with 4 additions and 1 deletion.
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);
}

}

0 comments on commit 08dee6f

Please sign in to comment.