feat: Add support for TestContainers (pgsql + redis modules) #503
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.
Add support for TestContainers to make it easy to set up independent test environments to allow running tests in parallel without risk of cross-contamination even if they touch the DB.
TestContainers support is behind the
test-containers
flag. When the flag is enabled, the consumer can enable TestContainers for the DB and Sidekiq Redis in theAppConfig
, in which case a TestContainer instance will be create when building theAppContext
, and the URI in theAppConfig
will be updated to match that of the TestContainer instance.Additionally, a new method was added to
AppConfig
to allow consumers to create it themselves. This would allow consumers more control over the config, including manually creating a TestContainer instance and updating the URI of a field in theAppConfig
before loading the application.Finally, a new
app::init_state
method was added to allow getting access to a realAppState
instance in tests. This method performs most of the setup of the app without actually running the app. This is similar but slightly different to the existingapp::prepare
method, and is intended to only be used in tests.Closes #500