8000 integ-cli: Fix TestBuildAddBadLinks for windows by ahmetb · Pull Request #10871 · moby/moby · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

integ-cli: Fix TestBuildAddBadLinks for windows #10871

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

Merged
merged 1 commit into from
Feb 21, 2015
Merged

integ-cli: Fix TestBuildAddBadLinks for windows #10871

merged 1 commit into from
Feb 21, 2015

Conversation

ahmetb
Copy link
Contributor
@ahmetb ahmetb commented Feb 18, 2015

TestBuildAddBadLinks used to build a path by
concenating unix-style forward slashes. Fixed that
by providing a windows-equivalent using runtime.GOOS.

Signed-off-by: Ahmet Alp Balkan ahmetalpbalkan@gmail.com
cc: @unclejack @jfrazelle @icecrime @tiborvass

@ahmetb
Copy link
Contributor Author
ahmetb commented Feb 18, 2015

https://jenkins.dockerproject.com/job/Windows-PRs/54/console
--- PASS: TestBuildAddBadLinks (1.03s)
=== RUN TestBuildAddBadLinksVolume
[PASSED]: build - ADD should add files in volume 👍

@@ -1568,7 +1569,18 @@ func TestBuildAddBadLinks(t *testing.T) {
}
defer os.RemoveAll(tempDir)

symlinkTarget := fmt.Sprintf("/../../../../../../../../../../../..%s", tempDir)
var symlinkTarget string
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't possible to make this with filepath.Join without runtime.GOOS comparing?

Copy link
Contributor Author

Choose a reason for hiding this 8000 comment

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

@LK4D4 great idea but as far as I can tell, no:

filepath.Join("/", "foo", "bar") → "\\foo\bar" (not a valid URL on windows)

since we need the volume letter (c:) at the beginning I might give a full URL of where we're running:

filepath.Join(os.Getwd(), "..","..","..","..","..","..","..","..", "foo") → "c:\foo"

is still not what I want since filepath.Join clears the path from unnecessary stuff like "..". Any other ideas?

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense considering filepath.Join doc:

The result is Cleaned, in particular all empty strings are ignored.

Copy link
Contributor

Choose a reason for hiding this comment

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

I remember also there was filepath.Separator or smth like that also. Not sure it worth it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@LK4D4 you're right. it might help a bit but we still need to get the volume name c: somehow.

TestBuildAddBadLinks used to build a path by
concenating unix-style forward slashes. Fixed that
by providing a windows-equivalent using `runtime.GOOS`.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
@ahmetb
Copy link
Contributor Author
ahmetb commented Feb 20, 2015

Pushed the fix on this. Please review again.

@thaJeztah
Copy link
Member

Wondering; would file:// paths be a possibility? This would still need a drive letter on windows, but at least use a consistent directory-separator (slashes on all platforms)

@ahmetb
Copy link
Contributor Author
ahmetb commented Feb 20, 2015

@thaJeztah not really. file:// doesn't work with pkg/os.

@thaJeztah
Copy link
Member

@ahmetalpbalkan thanks. Kind of suspected it would be "too good to be true".

@jessfraz
Copy link
Contributor

LGTM

1 similar comment
@LK4D4
Copy link
Contributor
LK4D4 commented Feb 21, 2015

LGTM

LK4D4 added a commit that referenced this pull request Feb 21, 2015
…Links-fix

integ-cli: Fix TestBuildAddBadLinks for windows
@LK4D4 LK4D4 merged commit 4ba1128 into moby:master Feb 21, 2015
@ahmetb ahmetb deleted the win-cli/TestBuildAddBadLinks-fix branch February 21, 2015 01:35
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.

7 participants
0