Skip to content

Commit

Permalink
Unite integration tests scenarios into one test
Browse files Browse the repository at this point in the history
  • Loading branch information
eyalkoren committed Dec 27, 2018
1 parent 81dff7a commit a090f8d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,18 @@ public final void stopServer() {
}
}

/**
* NOTE: This test class should contain a single test method, otherwise multiple instances may coexist and cause port clash due to the
* debug proxy
*/
@Test
public void testTransactionReporting() throws Exception {
public void testAllScenarios() throws Exception {
testTransactionReporting();
testTransactionErrorReporting();
testSpanErrorReporting();
}

private void testTransactionReporting() throws Exception {
for (String pathToTest : getPathsToTest()) {
mockServerContainer.getClient().clear(HttpRequest.request(), ClearType.LOG);
executeRequest(pathToTest, "Hello World", 200);
Expand All @@ -186,8 +196,7 @@ public void testTransactionReporting() throws Exception {
}
}

@Test
public void testSpanErrorReporting() throws Exception {
private void testSpanErrorReporting() throws Exception {
for (String pathToTest : getPathsToTest()) {
mockServerContainer.getClient().clear(HttpRequest.request(), ClearType.LOG);
executeRequest(pathToTest + "?cause_db_error=true", "DB Error", 200);
Expand All @@ -197,8 +206,7 @@ public void testSpanErrorReporting() throws Exception {
}
}

@Test
public void testTransactionErrorReporting() throws Exception {
private void testTransactionErrorReporting() throws Exception {
for (String pathToTest : getPathsToTestErrors()) {
mockServerContainer.getClient().clear(HttpRequest.request(), ClearType.LOG);
executeRequest(pathToTest + "?cause_transaction_error=true", "", 500);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ public class TomcatIT extends AbstractServletContainerIntegrationTest {
public TomcatIT(final String tomcatVersion) {
super(new GenericContainer<>("tomcat:" + tomcatVersion)
.withNetwork(Network.SHARED)
.withEnv("CATALINA_OPTS", "-javaagent:/elastic-apm-agent.jar -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005")
.withEnv("JPDA_ADDRESS", "5005")
.withEnv("JPDA_TRANSPORT", "dt_socket")
.withEnv("CATALINA_OPTS", "-javaagent:/elastic-apm-agent.jar")
.withEnv("ELASTIC_APM_SERVER_URL", "http://apm-server:1080")
.withEnv("ELASTIC_APM_IGNORE_URLS", "/status*,/favicon.ico")
.withEnv("ELASTIC_APM_REPORT_SYNC", "true")
Expand Down

0 comments on commit a090f8d

Please sign in to comment.