|
|
3 tháng trước cách đây | |
|---|---|---|
| .. | ||
| Makefile | 3 tháng trước cách đây | |
| README.md | 3 tháng trước cách đây | |
| concurrent_operations_test.go | 3 tháng trước cách đây | |
| directory_operations_test.go | 3 tháng trước cách đây | |
| framework.go | 3 tháng trước cách đây | |
| go.mod | 3 tháng trước cách đây | |
| go.sum | 3 tháng trước cách đây | |
| minimal_test.go | 3 tháng trước cách đây | |
| simple_test.go | 3 tháng trước cách đây | |
| working_demo_test.go | 3 tháng trước cách đây | |
This directory contains a comprehensive integration testing framework for SeaweedFS FUSE operations. The current SeaweedFS FUSE tests are primarily performance-focused (using FIO) but lack comprehensive functional testing. This framework addresses those gaps.
Note: Due to Go module conflicts between this test framework and the parent SeaweedFS module, the full test suite currently requires manual setup. The framework files are provided as a foundation for comprehensive FUSE testing once the module structure is resolved.
framework.go)cd test/fuse_integration
go test -v simple_test.go
framework.go - Test infrastructure and utilities
FuseTestFramework - Main test management structbasic_operations_test.go - Fundamental FUSE operations
directory_operations_test.go - Directory-specific tests
concurrent_operations_test.go - Concurrency and stress testing
framework := NewFuseTestFramework(t, DefaultTestConfig())
defer framework.Cleanup()
require.NoError(t, framework.Setup(DefaultTestConfig()))
config := &TestConfig{
Collection: "test",
Replication: "001",
ChunkSizeMB: 8,
CacheSizeMB: 200,
NumVolumes: 5,
EnableDebug: true,
MountOptions: []string{"-allowOthers"},
}
framework.AssertFileExists("path/to/file")
framework.AssertFileContent("file.txt", expectedContent)
framework.AssertFileMode("script.sh", 0755)
framework.CreateTestFile("test.txt", []byte("content"))
# Build SeaweedFS binary
make
# Run all FUSE tests
cd test/fuse_integration
go test -v
# Run specific test category
go test -v -run TestBasicFileOperations
go test -v -run TestConcurrentFileOperations
func TestCustomFUSE(t *testing.T) {
config := &TestConfig{
ChunkSizeMB: 16, // Larger chunks
CacheSizeMB: 500, // More cache
EnableDebug: true, // Debug output
SkipCleanup: true, // Keep files for inspection
}
framework := NewFuseTestFramework(t, config)
defer framework.Cleanup()
require.NoError(t, framework.Setup(config))
// Your tests here...
}
config := &TestConfig{
EnableDebug: true, // Enable verbose logging
SkipCleanup: true, // Keep temp files for inspection
}
func BenchmarkLargeFileWrite(b *testing.B) {
framework := NewFuseTestFramework(t, DefaultTestConfig())
defer framework.Cleanup()
require.NoError(t, framework.Setup(DefaultTestConfig()))
b.ResetTimer()
for i := 0; i < b.N; i++ {
// Benchmark file operations
}
}
func TestCustomWorkload(t *testing.T) {
framework := NewFuseTestFramework(t, DefaultTestConfig())
defer framework.Cleanup()
require.NoError(t, framework.Setup(DefaultTestConfig()))
// Simulate specific application workload
simulateWebServerWorkload(t, framework)
simulateDatabaseWorkload(t, framework)
simulateBackupWorkload(t, framework)
}
name: FUSE Integration Tests
on: [push, pull_request]
jobs:
fuse-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.21'
- name: Install FUSE
run: sudo apt-get install -y fuse
- name: Build SeaweedFS
run: make
- name: Run FUSE Tests
run: |
cd test/fuse_integration
go test -v -timeout 30m
FROM golang:1.21
RUN apt-get update && apt-get install -y fuse
COPY . /seaweedfs
WORKDIR /seaweedfs
RUN make
CMD ["go", "test", "-v", "./test/fuse_integration/..."]
| Aspect | Current Tests | New Framework |
|---|---|---|
| Operations Covered | Basic FIO read/write | All FUSE operations |
| Concurrency | Single-threaded | Multi-threaded stress tests |
| Error Scenarios | Limited | Comprehensive error handling |
| File Types | Regular files only | Large, sparse, many small files |
| Directory Testing | None | Complete directory operations |
| Setup Complexity | Manual Docker setup | Automated cluster management |
| Test Isolation | Shared environment | Isolated per-test environments |
| Debugging | Limited | Rich debugging and inspection |
Prerequisites
# Install FUSE
sudo apt-get install fuse # Ubuntu/Debian
brew install macfuse # macOS
# Build SeaweedFS
make
Run Tests
cd test/fuse_integration
go test -v
View Results
This framework represents a significant improvement in SeaweedFS FUSE testing capabilities, providing comprehensive coverage, real-world validation, and reliable automation that will help ensure the robustness and reliability of the FUSE implementation.