|
@@ -591,12 +591,12 @@ func TestXattr(t *testing.T) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Set the xattrs, read them back and compare
|
|
// Set the xattrs, read them back and compare
|
|
|
- if err := tfs.SetXattr("/test", attrs, noopXattrFilter{}); errors.Is(err, ErrXattrsNotSupported) || errors.Is(err, syscall.EOPNOTSUPP) {
|
|
|
|
|
|
|
+ if err := tfs.SetXattr("/test", attrs, testXattrFilter{}); errors.Is(err, ErrXattrsNotSupported) || errors.Is(err, syscall.EOPNOTSUPP) {
|
|
|
t.Skip("xattrs not supported")
|
|
t.Skip("xattrs not supported")
|
|
|
} else if err != nil {
|
|
} else if err != nil {
|
|
|
t.Fatal(err)
|
|
t.Fatal(err)
|
|
|
}
|
|
}
|
|
|
- res, err := tfs.GetXattr("/test", noopXattrFilter{})
|
|
|
|
|
|
|
+ res, err := tfs.GetXattr("/test", testXattrFilter{})
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
t.Fatal(err)
|
|
|
}
|
|
}
|
|
@@ -631,10 +631,10 @@ func TestXattr(t *testing.T) {
|
|
|
sort.Slice(attrs, func(i, j int) bool { return attrs[i].Name < attrs[j].Name })
|
|
sort.Slice(attrs, func(i, j int) bool { return attrs[i].Name < attrs[j].Name })
|
|
|
|
|
|
|
|
// Set the xattrs, read them back and compare
|
|
// Set the xattrs, read them back and compare
|
|
|
- if err := tfs.SetXattr("/test", attrs, noopXattrFilter{}); err != nil {
|
|
|
|
|
|
|
+ if err := tfs.SetXattr("/test", attrs, testXattrFilter{}); err != nil {
|
|
|
t.Fatal(err)
|
|
t.Fatal(err)
|
|
|
}
|
|
}
|
|
|
- res, err = tfs.GetXattr("/test", noopXattrFilter{})
|
|
|
|
|
|
|
+ res, err = tfs.GetXattr("/test", testXattrFilter{})
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
t.Fatal(err)
|
|
|
}
|
|
}
|
|
@@ -666,8 +666,10 @@ func TestWalkInfiniteRecursion(t *testing.T) {
|
|
|
testWalkInfiniteRecursion(t, FilesystemTypeBasic, dir)
|
|
testWalkInfiniteRecursion(t, FilesystemTypeBasic, dir)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-type noopXattrFilter struct{}
|
|
|
|
|
|
|
+type testXattrFilter struct{}
|
|
|
|
|
|
|
|
-func (noopXattrFilter) Permit(string) bool { return true }
|
|
|
|
|
-func (noopXattrFilter) GetMaxSingleEntrySize() int { return 0 }
|
|
|
|
|
-func (noopXattrFilter) GetMaxTotalSize() int { return 0 }
|
|
|
|
|
|
|
+// Permit only xattrs generated by our test, avoiding issues with SELinux etc.
|
|
|
|
|
+func (testXattrFilter) Permit(name string) bool { return strings.HasPrefix(name, "user.test-") }
|
|
|
|
|
+
|
|
|
|
|
+func (testXattrFilter) GetMaxSingleEntrySize() int { return 0 }
|
|
|
|
|
+func (testXattrFilter) GetMaxTotalSize() int { return 0 }
|