Skip to content

Commit 44c3aa5

Browse files
committed
live metrics ready
1 parent b734932 commit 44c3aa5

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

smoke-tests/framework/src/main/java/com/microsoft/applicationinsights/smoketest/SmokeTestExtension.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import static org.assertj.core.api.Assertions.assertThat;
77
import static org.awaitility.Awaitility.await;
88
import static org.junit.Assert.assertEquals;
9+
import static org.junit.jupiter.api.Assertions.assertTrue;
910

1011
import com.google.common.base.Stopwatch;
1112
import com.microsoft.applicationinsights.smoketest.fakeingestion.MockedAppInsightsIngestionServer;
@@ -55,10 +56,10 @@
5556
@SuppressWarnings({"SystemOut", "InterruptedExceptionSwallowed"})
5657
public class SmokeTestExtension
5758
implements BeforeAllCallback,
58-
BeforeEachCallback,
59-
AfterAllCallback,
60-
AfterEachCallback,
61-
TestWatcher {
59+
BeforeEachCallback,
60+
AfterAllCallback,
61+
AfterEachCallback,
62+
TestWatcher {
6263

6364
// add -PsmokeTestRemoteDebug=true to the gradle args to enable (see ai.smoke-test.gradle.kts)
6465
private static final boolean REMOTE_DEBUG = Boolean.getBoolean("ai.smoke-test.remote-debug");
@@ -280,6 +281,10 @@ protected String getAppContext() {
280281
}
281282

282283
private void clearOutAnyInitLogs() throws Exception {
284+
// ensure live metrics is ready
285+
await().untilAsserted(() -> assertTrue(mockedIngestion.isPingReceived()));
286+
await().untilAsserted(() -> assertThat(mockedIngestion.getPostBodies()).isNotEmpty());
287+
283288
if (!skipHealthCheck) {
284289
String contextRootUrl = getBaseUrl() + "/";
285290
HttpHelper.getResponseCodeEnsuringSampled(contextRootUrl);

0 commit comments

Comments
 (0)