cli icon indicating copy to clipboard operation
cli copied to clipboard

GetContextFromLocalDir tests confused by symlinks on OSX

Open dave-tucker opened this issue 8 years ago • 1 comments

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.

dave-tucker avatar Jun 20 '17 09:06 dave-tucker

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.

dnephin avatar Jun 20 '17 20:06 dnephin

Looks like this was fixed in https://github.com/docker/cli/commit/4d93717ae5615a7a8960b833a30fea2077805148

  • https://github.com/docker/cli/pull/3365

thaJeztah avatar Apr 22 '25 15:04 thaJeztah