diff options
| author | chrislu <chris.lu@gmail.com> | 2025-08-30 20:21:38 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2025-08-30 20:21:38 -0700 |
| commit | 478d550cba30affd2f4d211317bdfe3352a96e29 (patch) | |
| tree | b63a293c2605b459a8cdbd007789d4b886eb2021 /test/fuse_integration/framework.go | |
| parent | 879d512b552d834136cfb746a239e6168e5c4ffb (diff) | |
| download | seaweedfs-478d550cba30affd2f4d211317bdfe3352a96e29.tar.xz seaweedfs-478d550cba30affd2f4d211317bdfe3352a96e29.zip | |
add posix tests
Diffstat (limited to 'test/fuse_integration/framework.go')
| -rw-r--r-- | test/fuse_integration/framework.go | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/test/fuse_integration/framework.go b/test/fuse_integration/framework.go index 9cff1badb..82b5e3459 100644 --- a/test/fuse_integration/framework.go +++ b/test/fuse_integration/framework.go @@ -3,6 +3,7 @@ package fuse_test import ( "fmt" "io/fs" + "net" "os" "os/exec" "path/filepath" @@ -84,7 +85,33 @@ func (f *FuseTestFramework) Setup(config *TestConfig) error { return fmt.Errorf("framework already setup") } - // Create directories + // Check if we should skip cluster setup and use existing mount + if os.Getenv("TEST_SKIP_CLUSTER_SETUP") == "true" { + // Use existing mount point from environment + if existingMount := os.Getenv("TEST_MOUNT_POINT"); existingMount != "" { + f.mountPoint = existingMount + f.t.Logf("Using existing mount point: %s", f.mountPoint) + + // Verify mount point is accessible + if _, err := os.Stat(f.mountPoint); err != nil { + return fmt.Errorf("existing mount point not accessible: %v", err) + } + + // Test basic functionality + testFile := filepath.Join(f.mountPoint, ".framework_test") + if err := os.WriteFile(testFile, []byte("test"), 0644); err != nil { + return fmt.Errorf("mount point not writable: %v", err) + } + if err := os.Remove(testFile); err != nil { + f.t.Logf("Warning: failed to cleanup test file: %v", err) + } + + f.isSetup = true + return nil + } + } + + // Create directories for full cluster setup dirs := []string{f.mountPoint, f.dataDir} for _, dir := range dirs { if err := os.MkdirAll(dir, 0755); err != nil { @@ -138,6 +165,12 @@ func (f *FuseTestFramework) Setup(config *TestConfig) error { // Cleanup stops all processes and removes temporary files func (f *FuseTestFramework) Cleanup() { + // Skip cleanup if using external cluster + if os.Getenv("TEST_SKIP_CLUSTER_SETUP") == "true" { + f.t.Logf("Skipping cleanup - using external SeaweedFS cluster") + return + } + if f.mountProcess != nil { f.unmountFuse() } |
