Skip to content

Add test for workdir being a symlink to another folder #11915

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ekzhang
Copy link
Contributor

@ekzhang ekzhang commented Jul 11, 2025

Should only pass after #11910 is merged in.
Thanks @avagin for help here!

#11910 (comment)

Should only pass after google#11910 is merged in.
Thanks @avagin for help here!
@avagin
Copy link
Collaborator

avagin commented Jul 11, 2025

LGTM. Thanks.

copybara-service bot pushed a commit that referenced this pull request Jul 15, 2025
Should only pass after #11910 is merged in.
Thanks @avagin for help here!

#11910 (comment)

FUTURE_COPYBARA_INTEGRATE_REVIEW=#11915 from ekzhang:add-test-symlink-workdir a8cf826
PiperOrigin-RevId: 783271203
copybara-service bot pushed a commit that referenced this pull request Jul 15, 2025
Should only pass after #11910 is merged in.
Thanks @avagin for help here!

#11910 (comment)

FUTURE_COPYBARA_INTEGRATE_REVIEW=#11915 from ekzhang:add-test-symlink-workdir a8cf826
PiperOrigin-RevId: 783271203
copybara-service bot pushed a commit that referenced this pull request Jul 15, 2025
Should only pass after #11910 is merged in.
Thanks @avagin for help here!

#11910 (comment)

FUTURE_COPYBARA_INTEGRATE_REVIEW=#11915 from ekzhang:add-test-symlink-workdir a8cf826
PiperOrigin-RevId: 783271203
copybara-service bot pushed a commit that referenced this pull request Jul 15, 2025
Should only pass after #11910 is merged in.
Thanks @avagin for help here!

#11910 (comment)

FUTURE_COPYBARA_INTEGRATE_REVIEW=#11915 from ekzhang:add-test-symlink-workdir a8cf826
PiperOrigin-RevId: 783271203
copybara-service bot pushed a commit that referenced this pull request Jul 15, 2025
Should only pass after #11910 is merged in.
Thanks @avagin for help here!

#11910 (comment)

FUTURE_COPYBARA_INTEGRATE_REVIEW=#11915 from ekzhang:add-test-symlink-workdir a8cf826
PiperOrigin-RevId: 783271203
copybara-service bot pushed a commit that referenced this pull request Jul 15, 2025
Should only pass after #11910 is merged in.
Thanks @avagin for help here!

#11910 (comment)

FUTURE_COPYBARA_INTEGRATE_REVIEW=#11915 from ekzhang:add-test-symlink-workdir a8cf826
PiperOrigin-RevId: 783271203
copybara-service bot pushed a commit that referenced this pull request Jul 15, 2025
Should only pass after #11910 is merged in.
Thanks @avagin for help here!

#11910 (comment)

FUTURE_COPYBARA_INTEGRATE_REVIEW=#11915 from ekzhang:add-test-symlink-workdir a8cf826
PiperOrigin-RevId: 783271203
@avagin
Copy link
Collaborator

avagin commented Jul 16, 2025

This test fails on buildkite:

--- FAIL: TestSymlinkWorkingDirectory (0.62s)
    integration_test.go:1059: working directory mismatch, want: "/test/symlink-to-dir\n", got: "/test/actual-dir\n"
    integration_test.go:1066: docker run failed: Error response from daemon: Conflict. The container name "/TestSymlinkWorkingDirectory-V5YVDQCPRWDVTGWTTEVQPH5ZNNR4PC66" is already in use by container "ef188b464367eccff250f2c7b49eee4d34492749b0f352fe78eaaf60841686a4". You have to remove (or rename) that container to be able to reuse that name.
FAIL


// Additional test: verify we can actually use the working directory
// by creating a file in it
_, err = d.Run(ctx, opts, "sh", "-c", "echo 'test content' > testfile && cat testfile")
Copy link
Collaborator

Choose a reason for hiding this comment

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

you can combine this command with the previous one to avoid executing the same container twice.


// Test that the container can start with symlinked working directory
// and that pwd returns the symlinked path
got, err := d.Run(ctx, opts, "sh", "-c", "pwd")
Copy link
Collaborator

Choose a reason for hiding this comment

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

In gVisor, pwd returns targetDir, which differs from Linux's behavior. However, this doesn't like a critical issue. You can file a separate issue for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants