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

PHPORM-266 Run tests on Atlas Local #3216

Merged
merged 2 commits into from
Jan 3, 2025
Merged

Conversation

GromNaN
Copy link
Member

@GromNaN GromNaN commented Nov 21, 2024

@GromNaN GromNaN force-pushed the PHPORM-266 branch 4 times, most recently from d951531 to a954df7 Compare November 21, 2024 17:17
@GromNaN GromNaN marked this pull request as ready for review January 2, 2025 20:22
@GromNaN GromNaN requested a review from a team as a code owner January 2, 2025 20:22
@GromNaN GromNaN requested a review from jmikola January 2, 2025 20:22
@@ -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/'
Copy link
Member

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.

Copy link
Member Author

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.

@GromNaN GromNaN force-pushed the PHPORM-266 branch 8 times, most recently from b8a994e to 7a58832 Compare January 3, 2025 17:00
@GromNaN GromNaN requested a review from jmikola January 3, 2025 17:04
@GromNaN GromNaN added minor and removed minor labels Jan 3, 2025
@GromNaN GromNaN enabled auto-merge (squash) January 3, 2025 17:16
@GromNaN GromNaN merged commit 3960aeb into mongodb:5.x Jan 3, 2025
32 checks passed
@GromNaN GromNaN deleted the PHPORM-266 branch January 3, 2025 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants