diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2021-02-02 14:44:26 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2021-02-02 14:44:26 +0300 |
commit | f747aef48c410f5177e9e3c3446132870dc74cd7 (patch) | |
tree | d4c47890826c321fa669eb2536a79034e699e690 | |
parent | 09737ad4cd3774508d682ac23cfee8cd8d4a1156 (diff) |
evaluate repo path's symlinks in UserUpdateBranch tests
macOS' default temporary directory is under '/var/...'. '/var' is a
symlink to '/private/var'. UserUpdateBranch tests compare the full path
with symlinks evaluated to a path that does not have the symlinks expanded,
causing the test to fail on macOS. This commit evaluates the symlinks prior
to comparing the two paths to fix this.
-rw-r--r-- | internal/gitaly/service/operations/update_branches_test.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/gitaly/service/operations/update_branches_test.go b/internal/gitaly/service/operations/update_branches_test.go index f31641202..859889748 100644 --- a/internal/gitaly/service/operations/update_branches_test.go +++ b/internal/gitaly/service/operations/update_branches_test.go @@ -4,6 +4,7 @@ import ( "context" "crypto/sha1" "fmt" + "path/filepath" "testing" "github.com/stretchr/testify/require" @@ -233,6 +234,13 @@ func testFailedUserUpdateBranchDueToHooks(t *testing.T, ctx context.Context) { testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t) defer cleanupFn() + // macOS' default tmp directory is under /var/... but /var itself is a symlink + // to /private/var. The repository path in the environment variables has its symlinked + // evaluated, causing the comparison to fail, thus we evaluate them here already so the + // assertion later works. + testRepoPath, err := filepath.EvalSymlinks(testRepoPath) + require.NoError(t, err) + serverSocketPath, stop := runOperationServiceServer(t) defer stop() |