fix: skip permission tests when running as root (CI/Docker)
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
3bcb8ff741
commit
ade9766d65
1 changed files with 6 additions and 0 deletions
|
|
@ -569,6 +569,9 @@ func TestPersistAndLoad(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("load from unreadable file returns error", func(t *testing.T) {
|
||||
if os.Getuid() == 0 {
|
||||
t.Skip("chmod 000 does not restrict root")
|
||||
}
|
||||
tmpDir := t.TempDir()
|
||||
path := filepath.Join(tmpDir, "unreadable.yaml")
|
||||
require.NoError(t, os.WriteFile(path, []byte("quotas: {}"), 0644))
|
||||
|
|
@ -600,6 +603,9 @@ func TestPersistAndLoad(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("persist to unwritable directory returns error", func(t *testing.T) {
|
||||
if os.Getuid() == 0 {
|
||||
t.Skip("chmod 0555 does not restrict root")
|
||||
}
|
||||
tmpDir := t.TempDir()
|
||||
unwritable := filepath.Join(tmpDir, "readonly")
|
||||
require.NoError(t, os.MkdirAll(unwritable, 0555))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue