-
Notifications
You must be signed in to change notification settings - Fork 198
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
Create a way to disable Micronaut Data programmatically #2893
Comments
What exactly do you want to disable? |
see the linked discussion. A user with configuration such as datasources.default.db-type=mysql
datasources.default.dialect=MYSQL
micronaut.application.name=demo
datasources.default.schema-generate=CREATE_DROP
datasources.default.driver-class-name=com.mysql.cj.jdbc.Driver Should be able to write a functional test unrelated to persistence and don't waste time trying to setup the persistence logic. Users need to be able to annotate a test with something like: @Property(name = "data.enabled=false")
@MicronautTest
MyFunctionalTestUnrelatedToPersistenceTest We added for example the ability to disable JPA: https://micronaut-projects.github.io/micronaut-sql/5.6.0/guide/#hibernate-disable |
Depends if you want to disable some implementation based on it JDBC / Hibernate |
I think disabling a datasource completely. |
Then it should be implemented in |
Adding to what Sergio has mentioned: Use case: I wanted to test a mapper interaction with a service to verify that everything works well together, but the app uses a DB and I don't really want to set up one just for that test (or the couple of tests not related to a DB). Thanks! |
This allows the testing of non-db beans without requiring the connection pools to be fully configured. Does not cover r2dbc as that is defined elsewhere. micronaut-projects/micronaut-data#2893 It is done this way (with package requirements) as there is no way currently to allow EachBean to skip factory creation based on a property of the bean (ie Toggleable#isEnabled).
This allows the testing of non-db beans without requiring the connection pools to be fully configured. Does not cover r2dbc as that is defined elsewhere. micronaut-projects/micronaut-data#2893 It is done this way (with package requirements) as there is no way currently to allow EachBean to skip factory creation based on a property of the bean (ie Toggleable#isEnabled).
Done in micronaut-sql by micronaut-projects/micronaut-sql#1323 |
see: #2856 (reply in thread)
The text was updated successfully, but these errors were encountered: