diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-01-27 10:39:36 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-01-27 10:39:36 +0300 |
commit | 505b214e5a61a8241f90cb844255b332903c4589 (patch) | |
tree | d4165d5a4a4b3395ce817eaf3e7cc75888c1b90a | |
parent | 4a014f5227b3defe785d9cec776abe2b1a944826 (diff) | |
parent | c6f9ed5e25aeb33fdc23e51404810614689ceb41 (diff) |
Merge branch 'pks-restore-custom-hooks-directory-vote-umask' into 'master'
repository: Fix RestoreCustomHooks test depending on the host's umask
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5294
Merged-by: Patrick Steinhardt <psteinhardt@gitlab.com>
Approved-by: Justin Tobler <jtobler@gitlab.com>
-rw-r--r-- | internal/gitaly/service/repository/restore_custom_hooks_test.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/internal/gitaly/service/repository/restore_custom_hooks_test.go b/internal/gitaly/service/repository/restore_custom_hooks_test.go index 8f4f28785..6596c0301 100644 --- a/internal/gitaly/service/repository/restore_custom_hooks_test.go +++ b/internal/gitaly/service/repository/restore_custom_hooks_test.go @@ -7,6 +7,7 @@ import ( "io" "os" "path/filepath" + "syscall" "testing" "github.com/stretchr/testify/assert" @@ -158,7 +159,15 @@ type testFile struct { } func TestNewDirectoryVote(t *testing.T) { - t.Parallel() + // The vote hash depends on the permission bits, so we must make sure that the files we + // write have the same permission bits on all systems. As the umask can get in our way we + // reset it to a known value here and restore it after the test. This also means that we + // cannot parallelize this test. + currentUmask := syscall.Umask(0) + defer func() { + syscall.Umask(currentUmask) + }() + syscall.Umask(0o022) for _, tc := range []struct { desc string |