cli
cli copied to clipboard
GetContextFromLocalDir tests confused by symlinks on OSX
For example:
--- FAIL: TestGetContextFromLocalDirWithNoDirectory (0.00s)
Error Trace: context_test.go:84
Error: Not equal:
expected: "/var/folders/_z/phfwjxz50w1clqsnlf4g2ym80000gp/T/builder-context-test687047581"
received: "/private/var/folders/_z/phfwjxz50w1clqsnlf4g2ym80000gp/T/builder-context-test687047581"
=== RUN TestGetContextFromLocalDirWithDockerfile
--- FAIL: TestGetContextFromLocalDirWithDockerfile (0.00s)
Error Trace: context_test.go:97
Error: Not equal:
expected: "/var/folders/_z/phfwjxz50w1clqsnlf4g2ym80000gp/T/builder-context-test205698136"
received: "/private/var/folders/_z/phfwjxz50w1clqsnlf4g2ym80000gp/T/builder-context-test205698136"
=== RUN TestGetContextFromLocalDirLocalFile
--- PASS: TestGetContextFromLocalDirLocalFile (0.00s)
=== RUN TestGetContextFromLocalDirWithCustomDockerfile
--- FAIL: TestGetContextFromLocalDirWithCustomDockerfile (0.00s)
Error Trace: context_test.go:135
Error: Not equal:
expected: "/var/folders/_z/phfwjxz50w1clqsnlf4g2ym80000gp/T/builder-context-test009992522"
received: "/private/var/folders/_z/phfwjxz50w1clqsnlf4g2ym80000gp/T/builder-context-test009992522"
On OSX, /var is a symlink to /private/var which causes the tests to fail.
A workaround is to set TMPDIR to a directory that isn't symlinked.
A fix would be to add filepath.Abs() to the expected values in these tests.
Looks like this was fixed in https://github.com/docker/cli/commit/4d93717ae5615a7a8960b833a30fea2077805148
- https://github.com/docker/cli/pull/3365