* weed: report the host transparent huge page policy at startup Go maps the heap with MADV_HUGEPAGE, so the host THP policy applies to a SeaweedFS process whether or not the operator asked for it, and the advice in the Go GC guide depends on the heap size. Operators had no way to see which mode a node actually runs in. Log enabled/defrag/khugepaged.max_ptes_none once at startup from the long-running commands, and print the Go toolchain in `weed version` so a support bundle identifies the runtime that produced the binary. Nothing changes the policy: THP is host-wide, and GODEBUG=disablethp=1 remains the only per-process control. Refs #5437 * build: declare Go 1.27.4, the toolchain the releases already use The 4.55 release binaries report go1.27.4 (`go version -m` on the published tarball), while go.mod still said 1.26.6, the Dockerfiles pinned golang:1.26, and the release workflows left the Go version to the action default of "the latest stable at build time". A source build, a container and a downloaded tarball therefore ran different toolchains from the same tag, and the next release could silently pick up another one. Set the go directive to 1.27.4 in the root module and in the four modules that build in CI, bump the 16 Dockerfiles, and pin goversion: 1.27.4 in the 16 release and dev action steps. `go mod tidy` now emits the two require blocks Go 1.27 expects; no dependency version changed. Go 1.27's gofmt realigns 8 files. * weed mini: report the THP policy after quieting stderr The startup line ran from the dispatch point before runMini applied quietMiniLogs, so every weed mini start on Linux printed it to stderr, which mini keeps for the welcome banner, warnings and errors. Log it from runMini after quietMiniLogs so it lands in the log file only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: report whether the Go heap can use huge pages The runtime advises only GC metadata with MADV_HUGEPAGE and leaves the heap arenas to the host default, so under enabled=madvise the heap stays on small pages. The log still printed go_heap_disabled=false there, which reads as "the heap uses THP". Report go_heap_thp, true only under enabled=always without GODEBUG=disablethp, and drop the struct comment that said the heap is mapped with MADV_HUGEPAGE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: count an inherited PR_SET_THP_DISABLE in go_heap_thp A launcher can disable THP for the process with prctl, and children inherit it, so enabled=always alone does not mean the heap gets huge pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: read GODEBUG disablethp the way the runtime does The runtime applies GODEBUG left to right, so with disablethp=1,disablethp=0 the heap keeps THP, while the helper stopped at the first disablethp=1. The helper also missed other nonzero values such as disablethp=2, which the runtime treats as disabled, and trimmed spaces around keys, which the runtime keeps. Take the last disablethp with an integer value, treat any nonzero value as disabled, and match keys exactly. The parser now takes the GODEBUG string, so it is tested without changing the environment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: honor per-size THP policies in go_heap_thp Since Linux 6.8 each anonymous huge page size has its own policy in hugepages-<size>kB/enabled, and only "inherit" follows the top-level knob. A 64kB size set to "always" gives the unadvised heap huge pages under a top-level "madvise" or "never", and a 2048kB size set to "never" takes them away under "always", but the log judged only the top-level value. Read the per-size policies and report go_heap_thp=true when any size reaches the heap. Under a top-level "never", the "disabled by the host" line is now printed only when no size reaches the heap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: report go_heap_thp=unknown when the process setting is unreadable If PR_GET_THP_DISABLE fails, for example because a seccomp profile rejects it, the process THP setting is not known, but the log treated it as allowed and could print go_heap_thp=true. Print go_heap_thp=unknown in that case. It stays false when the host or GODEBUG already rules out heap huge pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: report go_heap_thp=unknown when a per-size THP policy is unreadable An unreadable hugepages-<size>kB/enabled was skipped, so the log could say the host disabled THP while that size allowed it. Keep it as an empty mode and report unknown unless a readable size already allows huge pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ci: take the Go version from go.mod in tests and releases posix-compliance pinned GO_VERSION 1.26 and built go 1.27.4 modules only through the GOTOOLCHAIN auto-switch; nine workflows used go-version ^1.26 and the kafka jobs ran in golang:1.26-alpine. Read the version from go.mod with go-version-file, as the other setup-go steps already do, moving checkout ahead of setup-go where it came after so the file exists. The posix report takes the version from the setup-go output. The release and dev builds pinned goversion 1.27.4 in 16 places. The pinned go-release-action reads the go directive when goversion is go.mod, so the binaries now follow go.mod without a second copy of the version. * weed: report the THP policy from every long-running command mount, worker, iam, master.follower, the filer sync/backup/remote/replicate daemons and the mq agent and kafka gateway keep serving after startup like the commands already listed; mount is likely where heap size matters most. fuse is not listed: its first process starts a child with the same arguments and waits, so logging at dispatch would print the line twice. It logs in runFuse just before handing over to runMount, which only the child reaches. --------- Co-authored-by: Konstantin Lebedev <whitefox@mayflower.work> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
SeaweedFS FUSE Integration Testing Framework
Overview
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.
⚠️ Current Status
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.
Working Components
- ✅ Framework design and architecture (
framework.go) - ✅ Individual test file structure and compilation
- ✅ Test methodology and comprehensive coverage
- ✅ Documentation and usage examples
- ⚠️ Full test suite execution (requires Go module isolation)
Verified Working Test
cd test/fuse_integration
go test -v simple_test.go
Current Testing Gaps Addressed
1. Limited Functional Coverage
- Current: Only basic FIO performance tests
- New: Comprehensive testing of all FUSE operations (create, read, write, delete, mkdir, rmdir, permissions, etc.)
2. No Concurrency Testing
- Current: Single-threaded performance tests
- New: Extensive concurrent operation tests, race condition detection, thread safety validation
3. Insufficient Error Handling
- Current: Basic error scenarios
- New: Comprehensive error condition testing, edge cases, failure recovery
4. Missing Edge Cases
- Current: Simple file operations
- New: Large files, sparse files, deep directory nesting, many small files, permission variations
Framework Architecture
Core Components
-
framework.go- Test infrastructure and utilitiesFuseTestFramework- Main test management struct- Automated SeaweedFS cluster setup/teardown
- FUSE mount/unmount management
- Helper functions for file operations and assertions
-
basic_operations_test.go- Fundamental FUSE operations- File create, read, write, delete
- File attributes and permissions
- Large file handling
- Sparse file operations
-
directory_operations_test.go- Directory-specific tests- Directory creation, deletion, listing
- Nested directory structures
- Directory permissions and rename operations
- Complex directory scenarios
-
concurrent_operations_test.go- Concurrency and stress testing- Concurrent file and directory operations
- Race condition detection
- High-frequency operations
- Stress testing scenarios
Key Features
Automated Test Environment
framework := NewFuseTestFramework(t, DefaultTestConfig())
defer framework.Cleanup()
require.NoError(t, framework.Setup(DefaultTestConfig()))
- Automatic cluster setup: Master, Volume, Filer servers
- FUSE mounting: Proper mount point management
- Cleanup: Automatic teardown of all resources
Configurable Test Parameters
config := &TestConfig{
Collection: "test",
Replication: "001",
ChunkSizeMB: 8,
CacheSizeMB: 200,
NumVolumes: 5,
EnableDebug: true,
MountOptions: []string{"-allowOthers"},
}
Rich Assertion Helpers
framework.AssertFileExists("path/to/file")
framework.AssertFileContent("file.txt", expectedContent)
framework.AssertFileMode("script.sh", 0755)
framework.CreateTestFile("test.txt", []byte("content"))
Test Categories
1. Basic File Operations
- Create/Read/Write/Delete: Fundamental file operations
- File Attributes: Size, timestamps, permissions
- Append Operations: File appending behavior
- Large Files: Files exceeding chunk size limits
- Sparse Files: Non-contiguous file data
2. Directory Operations
- Directory Lifecycle: Create, list, remove directories
- Nested Structures: Deep directory hierarchies
- Directory Permissions: Access control testing
- Directory Rename: Move operations
- Complex Scenarios: Many files, deep nesting
3. Concurrent Operations
- Multi-threaded Access: Simultaneous file operations
- Race Condition Detection: Concurrent read/write scenarios
- Directory Concurrency: Parallel directory operations
- Stress Testing: High-frequency operations
4. Error Handling & Edge Cases
- Permission Denied: Access control violations
- Disk Full: Storage limit scenarios
- Network Issues: Filer/Volume server failures
- Invalid Operations: Malformed requests
- Recovery Testing: Error recovery scenarios
Usage Examples
Basic Test Run
# 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
Custom Configuration
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...
}
Debugging Failed Tests
config := &TestConfig{
EnableDebug: true, // Enable verbose logging
SkipCleanup: true, // Keep temp files for inspection
}
Advanced Features
Performance Benchmarking
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
}
}
Custom Test Scenarios
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)
}
Integration with CI/CD
GitHub Actions Example
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.26'
- 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
Docker Testing
FROM golang:1.26
RUN apt-get update && apt-get install -y fuse
COPY . /seaweedfs
WORKDIR /seaweedfs
RUN make
CMD ["go", "test", "-v", "./test/fuse_integration/..."]
Comparison with Current Testing
| 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 |
Benefits
1. Comprehensive Coverage
- Tests all FUSE operations supported by SeaweedFS
- Covers edge cases and error conditions
- Validates behavior under concurrent access
2. Reliable Testing
- Isolated test environments prevent test interference
- Automatic cleanup ensures consistent state
- Deterministic test execution
3. Easy Maintenance
- Clear test organization and naming
- Rich helper functions reduce code duplication
- Configurable test parameters for different scenarios
4. Real-world Validation
- Tests actual FUSE filesystem behavior
- Validates integration between all SeaweedFS components
- Catches issues that unit tests might miss
Future Enhancements
1. Extended FUSE Features
- Extended attributes (xattr) testing
- Symbolic link operations
- Hard link behavior
- File locking mechanisms
2. Performance Profiling
- Built-in performance measurement
- Memory usage tracking
- Latency distribution analysis
- Throughput benchmarking
3. Fault Injection
- Network partition simulation
- Server failure scenarios
- Disk full conditions
- Memory pressure testing
4. Integration Testing
- Multi-filer configurations
- Cross-datacenter replication
- S3 API compatibility while mounted
- Backup/restore operations
Getting Started
-
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
- Test output shows detailed operation results
- Failed tests include specific error information
- Debug mode provides verbose logging
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.