Skip to content

Commit

Permalink
chore: define constant for file perms
Browse files Browse the repository at this point in the history
  • Loading branch information
MSevey committed May 30, 2024
1 parent 544d9c9 commit 92f83cc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/builder/kaniko/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
"github.com/stretchr/testify/require"
)

const testFilePerms = 0600

func TestCreateTarGz(t *testing.T) {
testDir := t.TempDir()
expectedFiles := map[string]*struct{}{
Expand All @@ -22,10 +24,10 @@ func TestCreateTarGz(t *testing.T) {
}
for file := range expectedFiles {
filePath := filepath.Join(testDir, file)
err := os.MkdirAll(filepath.Dir(filePath), 0600)
err := os.MkdirAll(filepath.Dir(filePath), testFilePerms)
require.NoError(t, err, "Failed to create directory: %s", filepath.Dir(filePath))

err = os.WriteFile(filePath, []byte(file), 0600)
err = os.WriteFile(filePath, []byte(file), testFilePerms)
require.NoError(t, err, "Failed to create file: %s", filePath)
}

Expand Down

0 comments on commit 92f83cc

Please sign in to comment.