-
Notifications
You must be signed in to change notification settings - Fork 123
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
Excepion when running multiple tests using MongoDbRule + Spring+Real remote Mongo Db+ CLEAN_INSERT Strategy #178
Comments
Any updates on this? :( |
No idea, why this is happening in this case, notice that for example here https://github.com/lordofthejars/nosql-unit/blob/master/nosqlunit-demo/src/test/java/com/lordofthejars/nosqlunit/demo/mongodb/WhenYouFindAllBooks.java I am using two tests. Can you debug https://github.com/lordofthejars/nosql-unit/blob/master/nosqlunit-mongodb/src/main/java/com/lordofthejars/nosqlunit/mongodb/MongoOperation.java tocheck what is happening to |
The connection to Mongo obtained from Spring, is closed in In your example, the second test method use the Besides, your are using a As i have mentioned, the Fongo implementation works great, simply because there is no |
I see, I think that the problem happens because of Spring integration, because then the Mongo Client is started by Spring but closed by NoSQLUnit. I will need to figure out if there is a way to detect this |
Yep. Maybe That's the workaround i've implemented for my tests... |
Yes I think this is right. Can you provide a PR? |
… destroying the test context Closes lordofthejars#178
Sure, i will push it tonight |
… destroying the test context Closes lordofthejars#178
Hello @lordofthejars when is this fix to be expected to be included into a release? |
I will try to do today, if I finish one thing :) if not then hope that during this week. Sorry :) |
The change does not exist in the latest release of the maven: |
Hi,
First, thanks for this project, really usefully.
I'm trying to writing integration tests using your library, with the scenario described in the issue's title (using a MongoClient instance created in Spring context from a real running MongoDb.)
Here is my configuration (most relevant parts)
The second running test always failed, because* after the first test execution, the DB connection is closed*, so further attempts to load data failed (due to an assert in MongoDb that checks is connection is open)
Here is the stack trace:
PS: Note everything works fine when using a in memory db like Fongo
WORKAROUND: add
@DirtiesContext
to each test method, to force recreatingApplicationContext
(thus new aMongoClient
is obtained for each test), but i would like a better solution...The text was updated successfully, but these errors were encountered: