aboutsummaryrefslogtreecommitdiff
path: root/test/fuse_integration/framework.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/fuse_integration/framework.go')
-rw-r--r--test/fuse_integration/framework.go35
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()
}