mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-25 09:24:21 +00:00
add posix tests
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user