Skip to content
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

Fix issue with unit test on domain with multiple dataSource. #33

Merged
merged 7 commits into from
Nov 20, 2018

Conversation

TarikChrouki
Copy link

@TarikChrouki TarikChrouki commented Apr 17, 2018

As mentionned in #21, and grails/grails-core#10888
we are unable to test or use domain in unit test.
I create simple tests case to reproduce this issue (CarSpec, CarServiceSpec), with new domain (Car) in second datasource.

The proposed solution works well and all tests pass successfully.

@anthonyMoreira
Copy link

anthonyMoreira commented Jun 1, 2018

Awesome work ! That really helped me thank you.

A real shame that no one seem to care ! We definately need a way with DataTest to use the DataStore we want...

@HybridProgrammer
Copy link

HybridProgrammer commented Jul 24, 2018

Thank you, solved my problem with unit tests. Same issue described above.

Comment: Integrations tests
Similar issue exists for Integration tests. Default source works but when accessing anything defined by DataSources (additional db configurations) the tests throws a "org.hibernate.HibernateException: No Session found for current thread"

Running the application however doesn't have an issue.

@graemerocher graemerocher merged commit 30048fc into grails:master Nov 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants