-
Notifications
You must be signed in to change notification settings - Fork 308
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
Running Testcontainers with Rancher Desktop and Apple Silicon fails #2609
Comments
I have the similar issues with flaky tests running on my M1 MacBook Pro (macOS Monterey 12.5) / Rancher Desktop 1.5.0 / testcontainers 1.17.3. Running well with Docker Desktop. |
Same as the prior commenter, I believe I experienced these issues with tests running on an M1 MacBook Pro (macOS Monterey 12.3)/ Rancher Desktop 1.5.0/ and two separate versions of testcontainers, As soon as I installed Docker Desktop, I could run the tests I needed to ( via Gradle, if that's important) on both of the above testcontainers. |
Same here - quarkusio/quarkus#25682 |
I don't think this issue is related to the CPU architecture. I'm experiencing the same problem (well the linked Quarkus Issue) on an Intel Mac. |
Observation: |
Things have worked out for me when I enabled the option |
@resilva87 Isn't that the default mode? (It is for me) |
@adroste For me at least it was not enabled. I'm running Rancher Desktop v1.6.1 |
I am running Rancher Desktop v1.6.2 and still have "Connection Refused" errors when talking to TestContainers embedded Postgres. Docker Desktop seems to work fine, but errors persist with Rancher Desktop. The test mentioned here re-creates the problem well. Here is the specific error I am seeing in my tests: java.sql.SQLException: org.postgresql.util.PSQLException: Connection to localhost:49312 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. Oddly, when I manually test the connection while images are running, I am able to connect from Command Prompt. |
Maybe this helps some others, but looking at a similar problem, I found this to work with the provided example under Colima which exhibited the same problem, adding in a wait strategy to ensure the external port was mapped:
|
Hi, I have similar problem with "MAC-Rancher Desktop-Test Container" combination. The intermittent exceptions of "Connection Failures" are the biggest challenge. Below changes would solve your problems.
|
I am facing the same issue. [INFO ] 2023-05-03 18:59:05 [main ] [/] [] 0:440 - Container testcontainers/sshd:1.1.0 is starting: 2e7992a0f868d11f0f947ed4a863db7a5c1b5b4be2b8503036cadc413fd33296 Rancher Desktop v1.8.1 Do we have a solution or a workaround? |
The export TESTCONTAINERS_HOST_OVERRIDE=$(rdctl shell ip a show rd0 | awk '/inet / {sub("/.*",""); print $2}') Output:
This requires that you run Rancher Desktop with admin access enabled, so it will allocate a routable IP: |
What I suspect is that the M1 machines are too fast. It takes up to 3 seconds for the port to be forwarded to the host, and if the app checks to connect to the port on My Intel machine is slower, so the forward may be already created by the time the connection is attempted. BTW, if you are using VZ emulation, then the interface name is
|
If you are using VZ emulation (requires macOS 13.3+ Ventura), then you can also get it to work without administrative access by exporting 2 more settings: export DOCKER_HOST=unix://$HOME/.rd/docker.sock
export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sock
export TESTCONTAINERS_HOST_OVERRIDE=$(rdctl shell ip a show vznat | awk '/inet / {sub("/.*",""); print $2}') This is possible because |
I doubt it has anything to do with the macOS or Rancher Desktop versions, but is some local system issue, as this is all managed by vmnet. I would try to reboot the machine, just to see if that fixes it, given that it has worked on the same machine before. While generally unsatisfying, it would at least maybe unblock you. |
Hi @jandubois, @udf2457 Unfortunately restart didn't help, it was the first I tried. I am with Rancher Desktop 1.10.0 (latest), MacBook Pro M1, MacOS Sonoma. It's strange indeed why this suddenly stopped working and there's no IPv4 any more, I have no idea why. |
I've found 2 people on Slack that have experienced something similar, and it is still unknown why this is happening. One person claimed it happend with 13.4.0, was fixed in 13.4.1, but happened again with 13.5.0, but the other person seemed to have experienced it with 13.4.1 as well. Now @pdrosos reports it happening in 15.?? as well, so it seems like an ongoing problem. I don't know if this can be worked around with the upcoming |
Ah, Sonoma. I'm still on Ventura (13.6). So we really need some more feedback from Sonoma users I guess, just to rule that possibility out. |
Has the same issue with Rancher Desktop and Test Containers. With such settings I am getting the same error "Connection refused". But interesting thing here is that if I stop in debug in place where it tries to connect to the database, wait for several seconds and then proceed the test then it works fine. |
I had to add additional
|
@pdrosos thank you for your advice. At the moment looks that Test Containers works correctly after adding permanent enviroment variables into .zprofile file and rebooting my mac. |
@jandubois Any updates regarding On my M1 mac with macOS 14.1.1 (23B81) and Rancher Desktop 1.11.0 I only see this:
|
@jandubois It seems to depend on the network the host machine is in. This morning I was sitting in the office connected to the WLAN there and had the no-inet-issue mentioned just above. Now I'm at home in my own WLAN and see this:
Thus |
I understand that this comment might be a little bit unethical to make given that this is an issue in Rancher Desktop's repo, but I wanted to point out that (at least as a temporary solution), Testcontainers Desktop now comes with an embedded runtime that has a built-in solution for this (detecting the IP while the VZ backend is used). P.S. we (Testcontainers) love Rancher Desktop and even mention it specifically as one of the available local runtime options in Testcontainers Desktop! ❤️ I was just following this thread and did not feel good about all these Testcontainers users who are having issues 🙌 |
@jandubois I can reproduce my problem: When being at home, the Rancher Desktop VM can obtain an IPv4 address, when connected with the company WIFI, it can't - maybe some certificate issues, I don't know - I'm more or less a network noob. Is there a way to not use a "bridged setup" (which I assume RD does) but a "NAT setup" for the VM and still have a reachable IP address for Testcontainers? |
And another update: I tried to use VZ emulation without administrative rights in my home office network to avoid the bridged network. But then no
Thus Testcontainers will not work, because we can not set
|
I tried this approach #2609 (comment) It worked without giving Again, the issue popped up and the fix was not permanent. Later, I tried the wait strategy as suggested here: #2609 (comment) It worked in my case with and without corporate VPN and verified in build pipeline as well, it works! Thanks.
|
@kari-jumo I ran into the same thing until I disabled run as administrator and ensured Kubernetes was disabled. |
In some situations, TestContainers think PostgreSQLContainer is ready, but the port forwarding is not yet available. The adjusted wait strategy takes this into account. See also rancher-sandbox/rancher-desktop#2609 (comment)
In some situations, TestContainers think PostgreSQLContainer is ready, but the port forwarding is not yet available. The adjusted wait strategy takes this into account. See also rancher-sandbox/rancher-desktop#2609 (comment)
In some situations, TestContainers think PostgreSQLContainer is ready, but the port forwarding is not yet available. The adjusted wait strategy takes this into account. See also rancher-sandbox/rancher-desktop#2609 (comment)
Still does not work. Rancher 1.15.0 in default configuration with Kubernetes disabled. Following https://docs.rancherdesktop.io/how-to-guides/using-testcontainers/
First failure:
Website forgot to mention
Still fails:
|
Got it to work with VZ instead of QEMU, same as #2609 (comment) Also no IPv4 on vznat while on home wifi (but with Tailwind vpn) |
Same issue here. And recommendations did not not work. Any expert opinions here ? |
Same issue for me. Running rancher desktop version 1.17.1. |
Same problem here with rancher 1.17.1 and macos sequoia. It seems that rancher is not enabling vz. |
@onderilkesever @arunmuthiyarkath @onc @michaeldisaro for me this command worked: |
Whilst I have no comment on @Fonzerelli13's general answer, I would comment that maybe instead of:
You might find it easier to do:
This will print the IP address associated with the default route (i.e. the one your internet traffic is going over). Disclaimer: Read up on all commands before running them, run at your own risk, yada yada yada 😉 |
I solved my problem. I noticed that without administrative privileges any time the GUI crashes it seems that any change made to preferences is not saved. I just tried this:
Rancher started fine with enabled kubernetes, and I was able to disable kubernetes and select Now intellij can correctly connect to docker host and run tests on a I have a MacBookPro M3 Pro with Sequoia 15.3 and Rancher 1.17.1. |
@udf2457 thank you. this solved my problems for me. |
@udf2457 Yep, that worked for us as well. THANK YOU |
I have a MacBookPro M4 Pro with Sequoia 15.2 and Rancher 1.18.0.
It could address
I change Rancher config virtual machine to |
Actual Behavior
Running a test using Testcontainers on a MacBook Pro M1 leads to exceptions and a failed test with Rancher Desktop. Using the same setup with Docker Desktop does not result in a failed test.
Steps to Reproduce
mvn verify
with Rancher Desktop (Kubernetes disabled, usingdockerd
runtime)Result
Failing logs with Rancher Desktop: repo-postgres-simple-test-macos-m1.log
Expected Behavior
Successful logs with Docker Desktop: repo-postgres-simple-test-macos-m1-docker-desktop.log
Additional Information
No response
Rancher Desktop Version
1.4.1
Rancher Desktop K8s Version
disabled
Which container runtime are you using?
moby (docker cli)
What operating system are you using?
macOS
Operating System / Build Version
macOs Monterey 12.4
What CPU architecture are you using?
arm64 (Apple Silicon)
Linux only: what package format did you use to install Rancher Desktop?
N/A
Windows User Only
No response
The text was updated successfully, but these errors were encountered: