-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
JUnit integration tests are too slow. #25188
Comments
@mshima, I am willing to contribute to this issue and have been doing some reading, Based on spring.io, contexts are cached and re-used as long as context configuration remains unique. I am trying to figure out what this really means from jhipter's backend implementation. Let me know if you like me to move forward, I see you have made some changes too... |
@dwarakaprasad great. |
Yup exactly, was having some fun looking at spring docs and sprint-test context cache implementation. The lambda that is being returned from SqlTestContainersSpringContextCustomizerFactory seem to be throwing the hashcode which is causing the context recreation. I am trying to replace the lambda with an object and see how the cache reacts... |
That's interesting, we should calculate the hashcode in customizers then. |
got it, the returned ContextCustomizer needs the overridden hashCode method, your impl seems to be adding it to the ContextCustomizerfactory rather. See my reference impl. |
With the ContextCustomizer hashCode in place the hash conflict is happing in ImportsContextCustomizer. |
Maybe it's related on how the TestContainerCustomizer is implemented. |
I was able to get the non-testContainer based test ("devDatabaseType": "h2Memory") to be loaded optimally (see this), but not for the one using testContainers. I am getting 'liquibase' bean creation error as the spring.dataSource.url seems to be going in as null from TestContainerCustomizer, i.e. the DatasourceProperties object in the LiquibaseConfiguration.java is empty and nothing from the Customizer is propagated. |
Overview of the issue
JUnit integration tests are too slow.
Application context is restarted for every class test suit.
Our implementation doesn't allow context reuse.
Backend test step in ng-default is taking ~5min. It can be reduced to 2min-3min.
The JUnit integration test duration can be reduce by at least 60%.
Motivation for or Use Case
Improve user experience for Tests.
Suggest a Fix
Cleanup tests context.
JHipster Version(s)
main
JHipster configuration
Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryBrowsers and Operating System
The text was updated successfully, but these errors were encountered: