-
Notifications
You must be signed in to change notification settings - Fork 39
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
fix: make tests work on fedora #269
fix: make tests work on fedora #269
Conversation
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
65f06f9
to
c21d526
Compare
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.
thanks @Al-Pragliola for as well including documentation notes!
/lgtm
and planning to try it out locally asap to cross-check!
also if anyone else has chance to try it out on their system in the meantime :)
@@ -164,5 +166,5 @@ func tryDetectPodmanRunning() bool { | |||
if err != nil { | |||
return false | |||
} | |||
return info.Host.MachineState == "Running" | |||
return info.Host.MachineState == "Running" || strings.Contains(os.Getenv("DOCKER_HOST"), "podman.sock") |
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.
I believe worth noting that this addition leverage a podman configuration which is not "docker compatibility".
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 reason for the OR is on Linux systems that do not need a machine to run containers.
I'm hitting a btw @lampajr you were on Fedora too, did you needed this changes? 🤔 or maybe with docker engine it was not required ? |
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.
LGTM! but those instructions should apply to any OS in my experience.
Except of course for starting the socket, but that could be a footnote IMO, should be common sense on Linux.
CONTRIBUTING.md
Outdated
export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/podman/podman.sock | ||
export TESTCONTAINERS_RYUK_PRIVILEGED=true |
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.
Actually, I have to do the same things to get podman working with testcontainers on MacOS, but I usually export
DOCKER_HOST=unix://$(podman machine inspect --format '{{.ConnectionInfo.PodmanSocket.Path}}')
I wonder if it resolves to the same thing on Linux 👀
fwiw works for me on Mac OSX back again with:
but not with
but I'm also convinced is unrelated to this PR, confirming /lgtm |
Yeah exactly I am on Fedora and I can confirm that with docker I did not have to add these changes (at least so far, I can give it another try in a week when I'll come back) |
I can confirm this, with Docker none of those exports is required.
I just gave it a try and I can confirm the same results in my Fedora40: using I think it might be worth to mention it in the |
CONTRIBUTING.md
Outdated
|
||
```sh | ||
export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/podman/podman.sock | ||
export TESTCONTAINERS_RYUK_PRIVILEGED=true |
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.
@Al-Pragliola can you kindly double-check if it's about TESTCONTAINERS_RYUK_PRIVILEGED
or TESTCONTAINERS_RYUK_DISABLED
, please?
see also: #269 (comment)
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.
I removed the export to privileged, I may have had an unclean state when I tested the feature, it works now just with the change I made in the code and the export to DOCKER_HOST.
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.
btw it works with either of them set to true or false
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
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.
thank you for re-checking @Al-Pragliola and for this doc and DX improvement!
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: isinyaaa, tarilabs The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
fixes #268
Description
I set Privileged to true to test containers because SELinux prevented containers from reading metadata from the
conn_config.pb
file, which caused the container to use the in-memory database that does not persist data instead of the SQLite one, causing all tests to fail.I also improved podman detection on systems that do not require a machine by adding a check to the
DOCKER_HOST
environment variable.It's worth noting that I tried other ways to get it to work, both disabling Ryuk and trying to set different SELinux policies by following the testcontainers podman guide, but none of them worked.
How Has This Been Tested?
I tested this on my local machine by running
make test
Merge criteria: