-
Notifications
You must be signed in to change notification settings - Fork 13
Testcontainers #224
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
Open
hannosgit
wants to merge
21
commits into
dbos-inc:main
Choose a base branch
from
hannosgit:testcontainers
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Testcontainers #224
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
09b9082
change tests
hannosgit 9376a1a
change tests
hannosgit 4386063
renaming
hannosgit 32e7902
use inherited method
hannosgit 6087064
Merge remote-tracking branch 'upstream/main' into testcontainers
hannosgit 4d8d7e5
fix after sync with upstream
hannosgit c80b67e
Merge branch 'main' into testcontainers
devhawk 89df37e
remove pg container from GH action
devhawk 675a42a
Merge upstream/main into testcontainers branch
hannosgit 4dfc711
revert changes in test.yml
hannosgit 69e4c8c
update testcontainers dependency
hannosgit f925c39
update testcontainers
hannosgit b8d9156
fix formatting
hannosgit cecaccc
fix EventsTest
hannosgit cc97cf9
fix PatchTest
hannosgit e0c037a
Merge remote-tracking branch 'origin/main' into testcontainers
hannosgit ae2ec89
update testcontainers version
hannosgit b9894bc
fix some things
hannosgit 74bbfd2
revert unwanted changes
hannosgit f56678e
Merge remote-tracking branch 'origin/main' into testcontainers
hannosgit e2089d1
Merge branch 'main' into testcontainers
devhawk 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
55 changes: 55 additions & 0 deletions
55
transact/src/test/java/dev/dbos/transact/DbSetupTestBase.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,55 @@ | ||
| package dev.dbos.transact; | ||
|
|
||
| import dev.dbos.transact.config.DBOSConfig; | ||
| import dev.dbos.transact.database.SystemDatabase; | ||
|
|
||
| import com.zaxxer.hikari.HikariDataSource; | ||
| import org.junit.jupiter.api.AfterAll; | ||
| import org.junit.jupiter.api.BeforeAll; | ||
| import org.testcontainers.postgresql.PostgreSQLContainer; | ||
|
|
||
| public class DbSetupTestBase { | ||
|
|
||
| protected static final PostgreSQLContainer postgres = new PostgreSQLContainer("postgres:18"); | ||
|
|
||
| protected static DBOSConfig dbosConfig; | ||
| protected static HikariDataSource dataSource; | ||
|
|
||
| @BeforeAll | ||
| protected static void onetimeSetup() throws Exception { | ||
| postgres.start(); | ||
| dbosConfig = | ||
| DBOSConfig.defaults("systemdbtest") | ||
| .withDatabaseUrl(postgres.getJdbcUrl()) | ||
| .withDbUser(postgres.getUsername()) | ||
| .withDbPassword(postgres.getPassword()); | ||
| dataSource = SystemDatabase.createDataSource(dbosConfig); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like we're always creating the data source but never closing it |
||
| } | ||
|
|
||
| @AfterAll | ||
| protected static void afterAll() throws Exception { | ||
| postgres.stop(); | ||
| } | ||
|
|
||
| protected DBOSClient getDBOSClient() { | ||
| return new DBOSClient(postgres.getJdbcUrl(), postgres.getUsername(), postgres.getPassword()); | ||
| } | ||
|
|
||
| protected static DBOSConfig createConfig(String appName) { | ||
| return DBOSConfig.defaults(appName) | ||
| .withDatabaseUrl(postgres.getJdbcUrl()) | ||
| .withDbUser(postgres.getUsername()) | ||
| .withDbPassword(postgres.getPassword()); | ||
| } | ||
|
|
||
| protected static DBOSConfig createConfigFromEnv(String appName) { | ||
| return DBOSConfig.defaultsFromEnv(appName) | ||
| .withDatabaseUrl(postgres.getJdbcUrl()) | ||
| .withDbUser(postgres.getUsername()) | ||
| .withDbPassword(postgres.getPassword()); | ||
| } | ||
|
|
||
| protected static String getJdbcUrl(String databaseName) { | ||
| return postgres.getJdbcUrl().replaceFirst("/[^/?]+(\\?.*)?$", "/" + databaseName + "$1"); | ||
| } | ||
| } | ||
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
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.
nitpick: default app name should be something like
transact-java-test