-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add smoke test showing OOM due to recursive log capture on Wildfly (#…
- Loading branch information
Showing
8 changed files
with
161 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
plugins { | ||
id("ai.smoke-test-war") | ||
} |
18 changes: 18 additions & 0 deletions
18
...evel/src/main/java/com/microsoft/applicationinsights/smoketestapp/HealthCheckServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.microsoft.applicationinsights.smoketestapp; | ||
|
||
import java.io.IOException; | ||
import javax.servlet.annotation.WebServlet; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
// this is used by the test infra in order to know when it's ok to start running the tests | ||
@WebServlet("") | ||
public class HealthCheckServlet extends HttpServlet { | ||
|
||
@Override | ||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {} | ||
} |
25 changes: 25 additions & 0 deletions
25
...java/com/microsoft/applicationinsights/smoketestapp/OutOfMemoryWithDebugLevelServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.microsoft.applicationinsights.smoketestapp; | ||
|
||
import java.io.IOException; | ||
import java.util.logging.Logger; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.annotation.WebServlet; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
@WebServlet("/*") | ||
public class OutOfMemoryWithDebugLevelServlet extends HttpServlet { | ||
|
||
private static final Logger logger = Logger.getLogger("smoketestapp"); | ||
|
||
@Override | ||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) | ||
throws ServletException, IOException { | ||
|
||
logger.info("hello"); | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
...eTest/java/com/microsoft/applicationinsights/smoketest/OutOfMemoryWithDebugLevelTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.microsoft.applicationinsights.smoketest; | ||
|
||
import static com.microsoft.applicationinsights.smoketest.EnvironmentValue.TOMCAT_8_JAVA_11; | ||
import static com.microsoft.applicationinsights.smoketest.EnvironmentValue.TOMCAT_8_JAVA_11_OPENJ9; | ||
import static com.microsoft.applicationinsights.smoketest.EnvironmentValue.TOMCAT_8_JAVA_17; | ||
import static com.microsoft.applicationinsights.smoketest.EnvironmentValue.TOMCAT_8_JAVA_21; | ||
import static com.microsoft.applicationinsights.smoketest.EnvironmentValue.TOMCAT_8_JAVA_8; | ||
import static com.microsoft.applicationinsights.smoketest.EnvironmentValue.TOMCAT_8_JAVA_8_OPENJ9; | ||
import static com.microsoft.applicationinsights.smoketest.EnvironmentValue.WILDFLY_13_JAVA_8; | ||
import static com.microsoft.applicationinsights.smoketest.EnvironmentValue.WILDFLY_13_JAVA_8_OPENJ9; | ||
import static java.util.concurrent.TimeUnit.NANOSECONDS; | ||
import static java.util.concurrent.TimeUnit.SECONDS; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import com.microsoft.applicationinsights.smoketest.schemav2.MessageData; | ||
import java.util.List; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
@UseAgent | ||
abstract class OutOfMemoryWithDebugLevelTest { | ||
|
||
@RegisterExtension | ||
static final SmokeTestExtension testing = | ||
SmokeTestExtension.builder() | ||
.setSelfDiagnosticsLevel( | ||
"debug") // intentionally running with selfDiagnosticLevel "debug" | ||
.build(); | ||
|
||
private static final int COUNT = 100; | ||
|
||
@Test | ||
@TargetUri(value = "/test", callCount = COUNT) | ||
void test() throws Exception { | ||
long start = System.nanoTime(); | ||
while (testing.mockedIngestion.getCountForType("RequestData") < COUNT | ||
&& NANOSECONDS.toSeconds(System.nanoTime() - start) < 10) {} | ||
// wait ten more seconds before checking that we didn't receive too many | ||
Thread.sleep(SECONDS.toMillis(10)); | ||
|
||
List<MessageData> messages = testing.mockedIngestion.getMessageDataInRequest(COUNT); | ||
|
||
assertThat(messages).hasSize(COUNT); | ||
} | ||
|
||
@Environment(TOMCAT_8_JAVA_8) | ||
static class Tomcat8Java8Test extends OutOfMemoryWithDebugLevelTest {} | ||
|
||
@Environment(TOMCAT_8_JAVA_8_OPENJ9) | ||
static class Tomcat8Java8OpenJ9Test extends OutOfMemoryWithDebugLevelTest {} | ||
|
||
@Environment(TOMCAT_8_JAVA_11) | ||
static class Tomcat8Java11Test extends OutOfMemoryWithDebugLevelTest {} | ||
|
||
@Environment(TOMCAT_8_JAVA_11_OPENJ9) | ||
static class Tomcat8Java11OpenJ9Test extends OutOfMemoryWithDebugLevelTest {} | ||
|
||
@Environment(TOMCAT_8_JAVA_17) | ||
static class Tomcat8Java17Test extends OutOfMemoryWithDebugLevelTest {} | ||
|
||
@Environment(TOMCAT_8_JAVA_21) | ||
static class Tomcat8Java21Test extends OutOfMemoryWithDebugLevelTest {} | ||
|
||
@Environment(WILDFLY_13_JAVA_8) | ||
static class Wildfly13Java8Test extends OutOfMemoryWithDebugLevelTest {} | ||
|
||
@Environment(WILDFLY_13_JAVA_8_OPENJ9) | ||
static class Wildfly13Java8OpenJ9Test extends OutOfMemoryWithDebugLevelTest {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters