-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Change tmpDir when running e2e localmachine test on macOS #22362
Conversation
Ephemeral COPR build failed. @containers/packit-build please check. |
1 similar comment
Ephemeral COPR build failed. @containers/packit-build please check. |
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 @tnk4on!
I believe our macOS CI sets TMPDIR
, so it makes sense that the tests are failing. I think instead, we should only set tmpdir on macOS to /private/tmp
if TMPDIR
is not set, rather than overriding it.
03b88a2
to
ee50bf4
Compare
@ashley-cui I added code to check $TMPDIR. Please check. |
pkg/machine/e2e/machine_test.go
Outdated
|
||
func getTmpDir(value string) string { | ||
if runtime.GOOS == "darwin" { | ||
if len(value) >= 22 || value == "" { |
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 think I would still prefer that we only change the tmpdir if it is not set. If the user/runner of tests sets a path len > 22, I think we should fail with an error, and not secretly change the path without notice.
macOS tests are passing now!
6e1d2b4
to
4699dec
Compare
LGTM, restarted flaking tests, thanks! |
4699dec
to
c0839b1
Compare
Please rebase to pick up the bud test fail, thanks! @containers/podman-maintainers PTAL |
c0839b1
to
a4d412a
Compare
37c4cf7
to
4fcfc3f
Compare
@ashley-cui I added some code. Please check. If TMPDIR=“”, it cannot connect to gvproxy.sock.
so I changed it to return an error. Also, if TMPDIR is a directory that is not mounted on the podman machine, the bind mount test (e.g. "Volume ops". at basic_test.go) will return an error. |
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.
Other than two small comments, LGTM. Thanks!
pkg/machine/e2e/machine_test.go
Outdated
case runtime.GOOS != "darwin": | ||
tmpDir = value | ||
case len(value) >= 22: | ||
return "", errors.New("path length should be less than 22 characters") |
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.
Nit, so the user knows what path it is:
return "", errors.New("path length should be less than 22 characters") | |
return "", errors.New("$TMPDIR path length should be less than 22 characters") |
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.
small change and fixed
case len(value) >= 22: | ||
return "", errors.New("path length should be less than 22 characters") | ||
case value == "": | ||
return "", errors.New("TMPDIR cannot be empty. Set to directory mounted on podman machine (e.g. /private/tmp)") |
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'm okay with setting TMPDIR automatically to /private/tmp
in this instance
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.
This seems to be another Issue.
% export TMPDIR=""
% podman machine init --now
Looking up Podman Machine image at quay.io/podman/machine-os:5.1 to create VM
Getting image source signatures
Copying blob 5ab0b6fcee8a done |
Copying config 44136fa355 done |
Writing manifest to image destination
5ab0b6fcee8aba3f303ad47032c77ffa6894a25f8bc3645b3567860cd7dddf39
Extracting compressed file: podman-machine-default-arm64.raw: done
Machine init complete
Starting machine "podman-machine-default"
Error: unable to connect to "gvproxy" socket at "podman/podman-machine-default-gvproxy.sock"
The following code will set an empty path if TMPDIR=“”
. So the gvproxy path will be inappropriate.
If unset TMPDIR
is executed, /tmp is set and it works.
podman/pkg/machine/env/dir_darwin.go
Lines 5 to 11 in c9644eb
func getRuntimeDir() (string, error) { | |
tmpDir, ok := os.LookupEnv("TMPDIR") | |
if !ok { | |
tmpDir = "/tmp" | |
} | |
return tmpDir, nil | |
} |
Signed-off-by: Shion Tanaka <shtanaka@redhat.com>
LGTM @containers/podman-maintainers PTAL |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhatdan, tnk4on 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 |
Fix #22360
Does this PR introduce a user-facing change?
The fixes are only to the e2e test file and Doc, no additional tests.