-
-
Notifications
You must be signed in to change notification settings - Fork 970
Support MongoDB Testing in Forge #15339
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
base: 7.0.x
Are you sure you want to change the base?
Support MongoDB Testing in Forge #15339
Conversation
c889d31 to
250b9b3
Compare
jdaugherty
left a comment
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.
@sanjana2505006 please test changes locally before opening PRs
| [source,groovy,subs="attributes"] | ||
| testCompile "org.apache.grails:grails-testing-support-datamapping" | ||
| testCompile "org.apache.grails:grails-testing-support-web" | ||
| testCompile "org.apache.grails:grails-testing-support-mongodb" |
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.
This should not be a default recommendation. Not everyone uses mongodb. I also dont' think this is the right scope since the class will be needed at runtime of the test as well as compile.
| @@ -0,0 +1,34 @@ | |||
| # Unit Testing GORM for MongoDB | |||
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.
This library is not just for unit testing. it's for integration testing as well.
| String driver = "org.testcontainers.jdbc.ContainerDatabaseDriver"; | ||
| if (driverFeature instanceof SQLServer) { | ||
| generatorContext.addTemplate("sqlserverEula", new StringTemplate("src/test/resources/container-license-acceptance.txt", "mcr.microsoft.com/mssql/server:2019-CU4-ubuntu-16.04")); | ||
| generatorContext.addTemplate("sqlserverEula", |
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.
Please do not reformat these files unless it's across different commits.
| || generatorContext.isFeaturePresent(MongoGorm.class)) { | ||
| generatorContext.addDependency(Dependency.builder() | ||
| .groupId("org.apache.grails") | ||
| .artifactId("grails-testing-support-mongodb") |
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.
This is the wrong group id
250b9b3 to
3b6a04d
Compare
|
@jdaugherty Thank you for the detailed feedback! I have updated the PR to address all the points: For the docs, I added a specific page for pure MongoDB testing (covering both unit/integration) as requested. Verified everything locally by running the Forge tests and building the docs. It's all squashed into one clean commit now. Let me know if it looks good! |
Fixed an issue where the
grails-testing-support-mongodbdependency wasn't included when generating projects with MongoDB and TestContainers. Also added a new guide to the docs explaining how to unit test with MongoDB.Fixes #15007