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

bake: fix entitlement test when running from symlink temp #2815

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

tonistiigi
Copy link
Member

As the paths returned by validator have the symlinks resolved, the test needs to resolve the symlinks also in the expected values. Previously this would fail if t.TempDir() or os.GetWd() returned a path that contained a symlink.

The issue was purely in the test and not in the entitlements validation logic.

As the paths returned by validator have the symlinks resolved,
the test needs to resolve the symlinks also in the expected
values. Previously this would fail if t.TempDir() or os.GetWd()
returned a path that contained a symlink.

The issue was purely in the test and not in the entitlements
validation logic.

Signed-off-by: Tonis Tiigi <[email protected]>
@@ -180,10 +180,18 @@ func TestValidateEntitlements(t *testing.T) {
dir2, err := osutil.GetLongPathName(t.TempDir())
require.NoError(t, err)

// the paths returned by entitlements validation will have symlinks resolved
expDir1, err := filepath.EvalSymlinks(dir1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case I think we can remove osutil.GetLongPathName for dir1 related to #2812 (comment)

require.NoError(t, err)
expDir2, err := filepath.EvalSymlinks(dir2)
require.NoError(t, err)

escapeLink := filepath.Join(dir1, "escape_link")
require.NoError(t, os.Symlink("../../aa", escapeLink))

wd := osutil.GetWd()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, we can get back to os.Getwd()

@crazy-max crazy-max added this to the v0.19.0 milestone Nov 25, 2024
@tonistiigi tonistiigi merged commit 42f7898 into docker:master Nov 25, 2024
122 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants