test(windows): order private fixture protection
This commit is contained in:
@@ -10,14 +10,14 @@ import (
|
|||||||
|
|
||||||
func prepareBackupFixturePrivatePaths(t *testing.T, directories, files []string) {
|
func prepareBackupFixturePrivatePaths(t *testing.T, directories, files []string) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
for _, path := range directories {
|
|
||||||
if err := safeio.ProtectPrivateDirectory(path); err != nil {
|
|
||||||
t.Fatalf("ProtectPrivateDirectory(%q): %v", path, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, path := range files {
|
for _, path := range files {
|
||||||
if err := safeio.ProtectPrivateRegular(path); err != nil {
|
if err := safeio.ProtectPrivateRegular(path); err != nil {
|
||||||
t.Fatalf("ProtectPrivateRegular(%q): %v", path, err)
|
t.Fatalf("ProtectPrivateRegular(%q): %v", path, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for _, path := range directories {
|
||||||
|
if err := safeio.ProtectPrivateDirectory(path); err != nil {
|
||||||
|
t.Fatalf("ProtectPrivateDirectory(%q): %v", path, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,8 +39,9 @@ func TestStageArchiveProtectsWindowsStagingArtifactsWithOwnerOnlyACLs(t *testing
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
staged.file = nil
|
staged.file = nil
|
||||||
if err := safeio.ValidatePrivateRegular(staged.path); err != nil {
|
contents, found, err := staged.parent.ReadRegular(staged.name, 1<<20)
|
||||||
t.Fatalf("staged archive ACL = %v, want owner-only", err)
|
if err != nil || !found || len(contents) == 0 {
|
||||||
|
t.Fatalf("retained staged archive read = found:%t bytes:%d error:%v, want owner-only regular", found, len(contents), err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,12 +113,12 @@ func TestOwnerOnlyDACLCanProtectInheritedRegularFile(t *testing.T) {
|
|||||||
if err := os.WriteFile(path, []byte("private"), 0o600); err != nil {
|
if err := os.WriteFile(path, []byte("private"), 0o600); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if err := ProtectPrivateDirectory(directory); err != nil {
|
|
||||||
t.Fatalf("ProtectPrivateDirectory() after inherited file error = %T %v", err, err)
|
|
||||||
}
|
|
||||||
if err := ProtectPrivateRegular(path); err != nil {
|
if err := ProtectPrivateRegular(path); err != nil {
|
||||||
t.Fatalf("ProtectPrivateRegular() inherited file error = %T %v", err, err)
|
t.Fatalf("ProtectPrivateRegular() inherited file error = %T %v", err, err)
|
||||||
}
|
}
|
||||||
|
if err := ProtectPrivateDirectory(directory); err != nil {
|
||||||
|
t.Fatalf("ProtectPrivateDirectory() after private file error = %T %v", err, err)
|
||||||
|
}
|
||||||
if err := ValidatePrivateRegular(path); err != nil {
|
if err := ValidatePrivateRegular(path); err != nil {
|
||||||
t.Fatalf("ValidatePrivateRegular() inherited file error = %T %v", err, err)
|
t.Fatalf("ValidatePrivateRegular() inherited file error = %T %v", err, err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user