From 9bda64f78dc4e2622f2404a7b86b7f74d31025cd Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Mon, 20 Dec 2021 16:50:21 -0600 Subject: [PATCH] Handle crossplatform path discrepancy in CWD test --- internal/config/path_test.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/internal/config/path_test.go b/internal/config/path_test.go index d7460cb16..3e98c2c8f 100644 --- a/internal/config/path_test.go +++ b/internal/config/path_test.go @@ -54,7 +54,19 @@ func TestFindPath(t *testing.T) { out, err := FindPath(nil, "") require.NoError(err) - require.Equal(p, out.String()) + + // On mac, tempfiles land in a place that can be referenced as either + // /tmp/ or /private/tmp/ (the former is a symlink to the latter). + // This can mess with path equality assertions. We explicitly + // eval symlinks on both expected and actual here to flush out that + // discrepancy. + absolutePath, err := filepath.EvalSymlinks(p) + require.NoError(err) + + absoluteOut, err := out.EvalSymLinks() + require.NoError(err) + + require.Equal(absolutePath, absoluteOut.String()) }) t.Run("walks parent dirs looking for Vagrantfile", func(t *testing.T) {