Skip to content
This repository was archived by the owner on Jun 12, 2025. It is now read-only.

Use default client instead of create a new client when running tests #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

smartinm
Copy link

When I run the tests, I get following errors after a while:

Mongo::Error::NoServerAvailable:         Mongo::Error::NoServerAvailable: No server is available matching preference: #<Mongo::ServerSelector::Primary:0x007fe8fa5593e0 @options={"mode"=>:primary, "database"=>"admin"}, @tag_sets=[], @server_selection_timeout=30>
D, [2015-11-17T18:00:13.977278 #32569] DEBUG -- : MONGODB | Adding 127.0.0.1:27017 to the cluster.
D, [2015-11-17T18:00:13.980724 #32569] DEBUG -- : MONGODB | IOError
D, [2015-11-17T18:00:14.480547 #32569] DEBUG -- : MONGODB | IOError

I think the problem is because a new client is created every time in teardown.

This PR modifies BaseTestCase to use default client instead of create a new client when running tests.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant