mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-22 10:58:57 +00:00
SELinux for example adds security.* attributes by default that we are not allowed to touch, which causes the test to fail.
This commit is contained in:
parent
922946683d
commit
bf1e418e4a
@ -591,12 +591,12 @@ func TestXattr(t *testing.T) {
|
||||
}
|
||||
|
||||
// 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")
|
||||
} else if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
res, err := tfs.GetXattr("/test", noopXattrFilter{})
|
||||
res, err := tfs.GetXattr("/test", testXattrFilter{})
|
||||
if err != nil {
|
||||
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 })
|
||||
|
||||
// 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)
|
||||
}
|
||||
res, err = tfs.GetXattr("/test", noopXattrFilter{})
|
||||
res, err = tfs.GetXattr("/test", testXattrFilter{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -666,8 +666,10 @@ func TestWalkInfiniteRecursion(t *testing.T) {
|
||||
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 }
|
||||
|
Loading…
Reference in New Issue
Block a user