Open
Description
Hello,
mongock gets triggered in a test without any problem when performing a fully fledged spring boot test e.g.
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@Testcontainers // spinning up mongdb container by testcontainers library
class ApplicationIT {
}
Mongock is failing when doing a mongo slice test
@DataMongoTest
@Import(MongockConfig.class) // a dedicated config class for mongock stuff like `@EnableMongock` and other beans that are only required for mongock migration stuff
@Testcontainers // spinning up mongdb container by testcontainers library
class RepositoryIT {
}
I found a way to fix this by manually adding a driver bean to the spring context
@TestConfiguration
static class Fixture {
@Bean
public SpringDataMongoV3Driver driver(@Autowired MongoTemplate mongoTemplate) {
return SpringDataMongoV3Driver.withDefaultLock(mongoTemplate);
}
}
So I do observe that Mongock's autoconfiguration for "driver" beans is failing within a @DataMongoTest
.
I am using SB 2.7 and SB 2.6.X and only the Mongock version is 5.1.0
Best regards
Metadata
Metadata
Assignees
Labels
No labels