Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Fargher <jfargher@gitlab.com>2023-02-07 06:38:49 +0300
committerJames Fargher <jfargher@gitlab.com>2023-02-08 22:50:38 +0300
commit5cf02f580e6eafb00c93631803d9627e6a579e83 (patch)
tree8675c12376a25ee2a42fcbec12f9bbccc3d777dc /packed_binaries_test.go
parent3060313e355e2fe711f6964a44ae5335fb68a76c (diff)
Extract file and executable permissions
Bulk update all file and executable permissions to use the new perm package. Strictly speaking changing os.ModePerm to perm.PublicFile is a permission change (it goes from executable to normal), but since ModePerm is only used in tests this should be safe.
Diffstat (limited to 'packed_binaries_test.go')
-rw-r--r--packed_binaries_test.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/packed_binaries_test.go b/packed_binaries_test.go
index d904ab28b..1c9941305 100644
--- a/packed_binaries_test.go
+++ b/packed_binaries_test.go
@@ -7,6 +7,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/helper/perm"
)
func TestUnpackAuxiliaryBinaries_success(t *testing.T) {
@@ -21,7 +22,7 @@ func TestUnpackAuxiliaryBinaries_success(t *testing.T) {
for _, entry := range entries {
fileInfo, err := entry.Info()
require.NoError(t, err)
- require.Equal(t, fileInfo.Mode(), os.FileMode(0o700), "expected the owner to have rwx permissions on the unpacked binary")
+ require.Equal(t, fileInfo.Mode(), perm.PrivateExecutable, "expected the owner to have rwx permissions on the unpacked binary")
sourceBinary, err := os.ReadFile(filepath.Join(buildDir, fileInfo.Name()))
require.NoError(t, err)
@@ -37,7 +38,7 @@ func TestUnpackAuxiliaryBinaries_alreadyExists(t *testing.T) {
destinationDir := t.TempDir()
existingFile := filepath.Join(destinationDir, "gitaly-hooks")
- require.NoError(t, os.WriteFile(existingFile, []byte("existing file"), os.ModePerm))
+ require.NoError(t, os.WriteFile(existingFile, []byte("existing file"), perm.PublicFile))
err := UnpackAuxiliaryBinaries(destinationDir)
require.EqualError(t, err, fmt.Sprintf(`open %s: file exists`, existingFile), "expected unpacking to fail if destination binary already existed")