-
Notifications
You must be signed in to change notification settings - Fork 28
Use Testcontainers for API integration tests #236
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
Changes from all commits
f146170
351d680
29fa618
4876dcd
bb23edd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,11 +25,10 @@ | |
|
|
||
| @ActiveProfiles("test") | ||
| class ApiNIP52EventIT extends BaseRelayIntegrationTest { | ||
| private static final String RELAY_URI = "ws://localhost:5555"; | ||
| private final SpringWebSocketClient springWebSocketClient; | ||
|
|
||
| public ApiNIP52EventIT() { | ||
| springWebSocketClient = new SpringWebSocketClient(RELAY_URI); | ||
| springWebSocketClient = new SpringWebSocketClient(getRelayUri()); | ||
|
||
| } | ||
|
|
||
| @Test | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,7 +31,6 @@ | |
|
|
||
| @ActiveProfiles("test") | ||
| class ApiNIP99EventIT extends BaseRelayIntegrationTest { | ||
| private static final String RELAY_URI = "ws://localhost:5555"; | ||
| public static final String CLASSIFIED_LISTING_CONTENT = "classified listing content"; | ||
|
|
||
| public static final String PTAG_HEX = "2bed79f81439ff794cf5ac5f7bff9121e257f399829e472c7a14d3e86fe76985"; | ||
|
|
@@ -58,7 +57,7 @@ class ApiNIP99EventIT extends BaseRelayIntegrationTest { | |
| private final SpringWebSocketClient springWebSocketClient; | ||
|
|
||
| public ApiNIP99EventIT() { | ||
| springWebSocketClient = new SpringWebSocketClient(RELAY_URI); | ||
| springWebSocketClient = new SpringWebSocketClient(getRelayUri()); | ||
|
||
| } | ||
|
|
||
|
Comment on lines
57
to
62
|
||
| @Test | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,11 +2,53 @@ | |||||||||||||||||
|
|
||||||||||||||||||
| import org.junit.jupiter.api.Assumptions; | ||||||||||||||||||
| import org.junit.jupiter.api.BeforeAll; | ||||||||||||||||||
| import org.springframework.test.context.DynamicPropertyRegistry; | ||||||||||||||||||
| import org.springframework.test.context.DynamicPropertySource; | ||||||||||||||||||
|
Comment on lines
+5
to
+6
|
||||||||||||||||||
| import org.springframework.test.context.DynamicPropertyRegistry; | |
| import org.springframework.test.context.DynamicPropertySource; |
Copilot
AI
Jul 30, 2025
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.
ResourceBundle.getBundle() can throw MissingResourceException if the properties file is not found. This should be handled gracefully or the file existence should be guaranteed.
Copilot
AI
Jul 30, 2025
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.
ResourceBundle.getString() can throw MissingResourceException if the key is not found in the properties file. This should be handled or a default value should be provided.
| String image = bundle.getString(IMAGE_KEY); | |
| String image; | |
| try { | |
| image = bundle.getString(IMAGE_KEY); | |
| } catch (MissingResourceException e) { | |
| image = "default/image:latest"; // Provide a default image value | |
| System.err.println("Warning: Missing key '" + IMAGE_KEY + "' in resource bundle. Using default image: " + image); | |
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| relay.container.image=scsibug/nostr-rs-relay:latest |
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.
Constructor initialization calling getRelayUri() will fail because the method depends on the relayUri field which is not initialized during object construction. Move this initialization to a @beforeeach method or use a lazy initialization pattern.