-
Notifications
You must be signed in to change notification settings - Fork 1.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
PHPORM-266 Run tests on Atlas Local #3216
Conversation
d951531
to
a954df7
Compare
.github/workflows/build-ci.yml
Outdated
@@ -93,4 +103,4 @@ jobs: | |||
- name: "Run tests" | |||
run: "./vendor/bin/phpunit --coverage-clover coverage.xml" | |||
env: | |||
MONGODB_URI: 'mongodb://127.0.0.1/?replicaSet=rs' | |||
MONGODB_URI: 'mongodb://127.0.0.1/' |
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.
Is this necessary to connect to the Atlas container? The subtle impact of this change means that you're going to establish a direct connection to the host instead of constructing a replica set connection. It'd be preferable to figure out what the appropriate replica set name is for each environment and fill that in here.
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.
The Atlas Local container creates a replica set automatically, using the hostname of the container. But I can't connect using this replica set name.
$ docker run --rm -d -t -p27017:27017 mongodb/mongodb-atlas-local:latest
a4e8da8c44ce38e990644497bda0aa4105a82f88c143aceaf4efae9a3d041feb
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a4e8da8c44ce mongodb/mongodb-atlas-local:latest "/usr/local/bin/runn…" 4 seconds ago Up 4 seconds (health: starting) 0.0.0.0:27017->27017/tcp, :::27017->27017/tcp competent_rosalind
$ mongosh 'mongodb://127.0.0.1:27017/' --eval 'rs.status().set'
a4e8da8c44ce
$ mongosh 'mongodb://127.0.0.1:27017/?replicaSet=a4e8da8c44ce'
Current Mongosh Log ID: 67781475e943141095ff0bb1
Connecting to: mongodb://127.0.0.1:27017/?replicaSet=0ac71f55cba3&serverSelectionTimeoutMS=2000&appName=mongosh+2.3.2
MongoNetworkError: getaddrinfo ENOTFOUND a4e8da8c44ce
Solution: skip the replica set configuration and use implicit direct connect for Atlas local.
b8a994e
to
7a58832
Compare
Fix PHPORM-266