aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2025-08-31 12:58:52 -0700
committerchrislu <chris.lu@gmail.com>2025-08-31 12:58:52 -0700
commita2378a29dcea338e598689344b139515db7814c4 (patch)
treec22ecc530c708ac22df00dfbff2606a79f7e94c7
parentf6cdb887a21589df96817e25d53b7bc53c006e76 (diff)
downloadseaweedfs-a2378a29dcea338e598689344b139515db7814c4.tar.xz
seaweedfs-a2378a29dcea338e598689344b139515db7814c4.zip
fix
-rw-r--r--test/fuse_integration/posix_compliance_test.go12
-rw-r--r--test/fuse_integration/posix_extended_test.go9
-rw-r--r--test/fuse_integration/posix_external_test.go8
3 files changed, 17 insertions, 12 deletions
diff --git a/test/fuse_integration/posix_compliance_test.go b/test/fuse_integration/posix_compliance_test.go
index bb3f2a0a1..fbd2eef0b 100644
--- a/test/fuse_integration/posix_compliance_test.go
+++ b/test/fuse_integration/posix_compliance_test.go
@@ -257,16 +257,16 @@ func (s *POSIXComplianceTestSuite) TestPermissions(t *testing.T) {
stat, err := os.Stat(testFile)
require.NoError(t, err)
- // Note: Some FUSE implementations may not preserve execute bits on regular files
- // SeaweedFS FUSE mount typically masks execute bits for security
+ // Note: The final file permissions are affected by the system's umask.
+ // We check against the requested mode and the mode as affected by a common umask (e.g. 0022).
actualMode := stat.Mode() & os.ModePerm
expectedMode := os.FileMode(0642)
- expectedModeNoExec := os.FileMode(0640) // 642 without execute bits
+ expectedModeWithUmask := os.FileMode(0640) // e.g., 0642 with umask 0002 or 0022
- // Accept either the exact permissions or permissions without execute bit
- if actualMode != expectedMode && actualMode != expectedModeNoExec {
+ // Accept either the exact permissions or permissions as modified by umask
+ if actualMode != expectedMode && actualMode != expectedModeWithUmask {
t.Errorf("Expected file permissions %o or %o, but got %o",
- expectedMode, expectedModeNoExec, actualMode)
+ expectedMode, expectedModeWithUmask, actualMode)
}
})
diff --git a/test/fuse_integration/posix_extended_test.go b/test/fuse_integration/posix_extended_test.go
index 76f3f115d..408d93287 100644
--- a/test/fuse_integration/posix_extended_test.go
+++ b/test/fuse_integration/posix_extended_test.go
@@ -115,10 +115,11 @@ func (s *POSIXExtendedTestSuite) TestExtendedAttributes(t *testing.T) {
require.NoError(t, err)
require.Greater(t, size, 0)
- // Parse the null-separated list
- attrList := string(listBuf[:size])
- for name := range attrs {
- require.Contains(t, attrList, name)
+ // Parse the null-separated list and verify attributes
+ attrList := parseXattrList(listBuf[:size])
+ expectedAttrs := []string{"user.attr1", "user.attr2", "user.attr3"}
+ for _, expectedAttr := range expectedAttrs {
+ require.Contains(t, attrList, expectedAttr, "Expected attribute should be in the list")
}
})
diff --git a/test/fuse_integration/posix_external_test.go b/test/fuse_integration/posix_external_test.go
index e1ca0b5e7..31d1d1ad6 100644
--- a/test/fuse_integration/posix_external_test.go
+++ b/test/fuse_integration/posix_external_test.go
@@ -6,6 +6,7 @@ import (
"os/exec"
"path/filepath"
"strings"
+ "syscall"
"testing"
"time"
@@ -476,8 +477,11 @@ func (s *ExternalPOSIXTestSuite) testEdgeCases(t *testing.T, mountPoint string)
// Note: filepath.Join(testDir, "") returns testDir itself
err := os.WriteFile(testDir, []byte("test"), 0644)
require.Error(t, err)
- // Verify the error indicates we're trying to write to a directory
- require.Contains(t, err.Error(), "directory", "Expected error to indicate target is a directory")
+ // Verify the error is specifically about the target being a directory
+ var pathErr *os.PathError
+ if require.ErrorAs(t, err, &pathErr) {
+ require.Equal(t, syscall.EISDIR, pathErr.Err)
+ }
})
t.Run("VeryLongFileName", func(t *testing.T) {