feat(spring): @DataStormTest test slice#230
Merged
Merged
Conversation
720e0f0 to
4cc80fd
Compare
Spring users test Storm code with a full @SpringBootTest or with Storm's own @stormtest, which bypasses the Spring context entirely. What was missing is the slice test Spring users reach for first, like @DataJpaTest or @JooqTest. - New storm-spring-boot-test-autoconfigure module with @DataStormTest: starts only the DataSource, Storm's auto-configuration (template, repository scanning, transaction integration, schema validation, exception translation, observations), SQL initialization, and Flyway or Liquibase when present. Regular components stay out via a type exclude filter honoring includeFilters/excludeFilters; a bootstrapper applies the annotation's properties attribute. - Each test method runs in a Spring-managed transaction rolled back afterwards; Storm operations join it through the transaction bridge. - By default an embedded database replaces the application's DataSource; @AutoConfigureTestDatabase(replace = NONE) runs against the configured database, such as a Testcontainers-managed one via @Serviceconnection. - One module serves both starters: the slice pulls in the starters' identically named auto-configuration classes, with Boot 3 and Boot 4 platform entries listed as optional imports. The module has no compile dependency on Storm. Fixes #200
4cc80fd to
ee350c5
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Spring users test Storm code with a full
@SpringBootTestor with Storm's own@StormTest, which bypasses the Spring context entirely. What was missing is the slice test Spring users reach for first, like@DataJpaTestor@JooqTest.Fixes #200
What's included
storm-spring-boot-test-autoconfiguremodule (mirroring Boot's own layout, where@DataJpaTestlives inspring-boot-test-autoconfigure) with@DataStormTest: starts only theDataSource, Storm's auto-configuration (template, repository scanning, transaction integration, schema validation, exception translation, observations), SQL initialization, and Flyway or Liquibase when present. Regular@Component/@Service/@Controllerbeans stay out via a type exclude filter honoringincludeFilters/excludeFilters/useDefaultFilters; a bootstrapper applies the annotation'spropertiesattribute.@Transactionaland includes the transaction bridge, so Storm repository writes join the Spring-managed test transaction and roll back after each test.DataSourcewith an embedded database;spring.test.database.replace=noneruns against the configured one, such as a Testcontainers-managed database via@ServiceConnection. On Spring Boot 4 the replacement activates whenspring-boot-jdbc-test-autoconfigureis present.optional:imports, and the type exclusion registered through a context customizer built on FQCN-stable core classes rather than@TypeExcludeFilters, which Spring Boot 4 relocated. The module has no compile dependency on Storm; one artifact serves Boot 3 and Boot 4 (verified against Spring Boot 4.1 applications).Relationship to @stormtest
@StormTest(storm-test) remains the fast, framework-free option for query-level tests;@DataStormTestcovers what production Spring code sees — injected repository beans, translated exceptions, Spring-managed transactions,storm.*configuration. The docs cross-reference both with a rule of thumb.Verification
propertiesattribute applied.Docs: "Testing with @DataStormTest" section in spring-integration.md with H2 and Testcontainers examples; cross-links between testing.md and the slice section; CHANGELOG entry. Module registered in the reactor and the BOM.