-
-
Notifications
You must be signed in to change notification settings - Fork 465
Add Tomcat support in the system test runner and tests to the spring-jakarta sample #4635
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
6497aa1
Add Tomcat support in the system test runner and tests to the spring-…
alexander-alderman-webb 90ab6da
Create webapps directory and revert library changes only needed for t…
alexander-alderman-webb b6fe8bc
Adapt test instead of endpoint in spring-jakarta sample
alexander-alderman-webb dcc9cc8
Format code
getsentry-bot e1edcf2
Add task dependency from run on war in spring-jakarta sample
alexander-alderman-webb 506baad
Merge branch 'webb/e2e_tests_with_tomcat' of github.com:getsentry/sen…
alexander-alderman-webb a90c5af
Format code
getsentry-bot 9a62123
Add missing argument in interactive mode and build before launching i…
alexander-alderman-webb 7897b39
Merge branch 'webb/e2e_tests_with_tomcat' of github.com:getsentry/sen…
alexander-alderman-webb 65fea05
Add spring-jakarta sample to CI system tests config file
alexander-alderman-webb 7713458
Stop tomcat server on signal in system-test-runner
alexander-alderman-webb b027648
merge main
alexander-alderman-webb aa79e43
Stop Tomcat process in all cases
alexander-alderman-webb c8d4c97
Merge branch 'main' into webb/e2e_tests_with_tomcat
alexander-alderman-webb 7c23dbc
Merge branch 'main' into webb/e2e_tests_with_tomcat
alexander-alderman-webb 337c221
Merge branch 'main' into webb/e2e_tests_with_tomcat
alexander-alderman-webb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
32 changes: 32 additions & 0 deletions
32
...es/sentry-samples-spring-jakarta/src/main/java/io/sentry/samples/spring/jakarta/Main.java
This file contains hidden or 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,32 @@ | ||
| package io.sentry.samples.spring.jakarta; | ||
|
|
||
| import java.io.File; | ||
| import java.io.IOException; | ||
| import org.apache.catalina.LifecycleException; | ||
| import org.apache.catalina.startup.Tomcat; | ||
|
|
||
| public class Main { | ||
|
|
||
| public static void main(String[] args) throws LifecycleException, IOException { | ||
| File webappsDirectory = new File("./tomcat.8080/webapps"); | ||
| if (!webappsDirectory.exists()) { | ||
| boolean didCreateDirectories = webappsDirectory.mkdirs(); | ||
| if (!didCreateDirectories) { | ||
| throw new RuntimeException( | ||
| "Failed to create directory required by Tomcat: " + webappsDirectory.getAbsolutePath()); | ||
| } | ||
| } | ||
|
|
||
| String pathToWar = "./build/libs"; | ||
| String warName = "sentry-samples-spring-jakarta-0.0.1-SNAPSHOT"; | ||
| File war = new File(pathToWar + "/" + warName + ".war"); | ||
|
|
||
| Tomcat tomcat = new Tomcat(); | ||
| tomcat.setPort(8080); | ||
| tomcat.getConnector(); | ||
|
|
||
| tomcat.addWebapp("/" + warName, war.getCanonicalPath()); | ||
| tomcat.start(); | ||
| tomcat.getServer().await(); | ||
| } | ||
| } |
7 changes: 6 additions & 1 deletion
7
...try-samples-spring-jakarta/src/main/java/io/sentry/samples/spring/jakarta/web/Person.java
This file contains hidden or 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 hidden or 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
12 changes: 12 additions & 0 deletions
12
sentry-samples/sentry-samples-spring-jakarta/src/test/kotlin/io/sentry/DummyTest.kt
This file contains hidden or 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,12 @@ | ||
| package io.sentry | ||
|
|
||
| import kotlin.test.Test | ||
| import kotlin.test.assertTrue | ||
|
|
||
| class DummyTest { | ||
| @Test | ||
| fun `the only test`() { | ||
| // only needed to have more than 0 tests and not fail the build | ||
| assertTrue(true) | ||
| } | ||
| } |
46 changes: 46 additions & 0 deletions
46
...es/sentry-samples-spring-jakarta/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt
This file contains hidden or 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,46 @@ | ||
| package io.sentry.systemtest | ||
|
|
||
| import io.sentry.systemtest.util.TestHelper | ||
| import kotlin.test.Test | ||
| import kotlin.test.assertEquals | ||
| import org.junit.Before | ||
|
|
||
| class PersonSystemTest { | ||
| lateinit var testHelper: TestHelper | ||
|
|
||
| @Before | ||
| fun setup() { | ||
| testHelper = TestHelper("http://localhost:8080/sentry-samples-spring-jakarta-0.0.1-SNAPSHOT") | ||
| testHelper.reset() | ||
| } | ||
|
|
||
| @Test | ||
| fun `get person fails`() { | ||
| val restClient = testHelper.restClient | ||
| restClient.getPerson(11L) | ||
| assertEquals(500, restClient.lastKnownStatusCode) | ||
|
|
||
| testHelper.ensureTransactionReceived { transaction, envelopeHeader -> | ||
| testHelper.doesTransactionHaveOp(transaction, "http.server") | ||
| } | ||
|
|
||
| Thread.sleep(10000) | ||
|
|
||
| testHelper.ensureLogsReceived { logs, envelopeHeader -> | ||
| testHelper.doesContainLogWithBody(logs, "warn Sentry logging") && | ||
| testHelper.doesContainLogWithBody(logs, "error Sentry logging") && | ||
| testHelper.doesContainLogWithBody(logs, "hello there world!") | ||
| } | ||
| } | ||
|
|
||
| @Test | ||
| fun `create person works`() { | ||
| val restClient = testHelper.restClient | ||
| val person = Person("firstA", "lastB") | ||
| val returnedPerson = restClient.createPerson(person) | ||
| assertEquals(200, restClient.lastKnownStatusCode) | ||
|
|
||
| assertEquals(person.firstName, returnedPerson!!.firstName) | ||
| assertEquals(person.lastName, returnedPerson!!.lastName) | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Java Version Mismatch with Tomcat 11
New Tomcat 11.0.10 (Servlet 6.1.0) dependencies require Java 21, but the project and CI currently use Java 17. This causes an
UnsupportedClassVersionErrorwhen running thespring-jakartasample, breaking new system tests in CI and local development environments. To resolve, either upgrade the CI/runtime JDK to 21 (aligning toolchains) or use Tomcat 10.1.x (Servlet 6.0) which is compatible with Java 17.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not according to https://tomcat.apache.org/whichversion.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://jakarta.ee/specifications/servlet/6.1/ also says Java 17