Files
zeekayandHanzo Dev af0f387bbe Remove weed and SeaweedFS naming from the tree
The binary is s3 and the product is Hanzo S3; the rest of the tree now
says so too.

- Environment: WEED_* and SEAWEEDFS_* are S3_*, no aliases. fla9's flag
  prefix is S3, matching viper's existing "s3" prefix, so the S3_S3_SSE_*
  names mini.go exports are the ones viper reads (WEED_S3_SSE_KEK was never
  seen once viper moved to "s3").
- Java and Hadoop: packages, fs.hanzofs.* keys and the hanzofs:// scheme
  under the hanzofs namespace the protos already declare; classes take a
  neutral Filer prefix and file names match them again (the earlier pass left
  Seas3*.java holding Seaweed* classes). Client, hdfs3, examples, s3copier,
  random_access and the Spark tests compile.
- Helm chart: helpers are hanzo.*, values live under global.s3; the chart
  renders and lints, which it did not before.
- Terraform: the s3.service.tftpl reference matches the file; 12/12 render
  tests pass. Config paths point at /etc/hanzo, which the binary reads.
- loadtest.pb.go regenerated from loadtest.proto.
- Upstream logo, sponsor images and unreferenced diagrams removed from note/.

Kept: NOTICE attribution, LICENSE, the erasure-coding fixture
s3/storage/erasure_coding/1.dat (test bytes), and unmaintained/ and
third_party/ (vendored). No on-disk format, wire protocol or metadata key
changed.

Co-authored-by: Hanzo Dev <[email protected]>
2026-10-02 08:06:48 -07:00

312 lines
9.5 KiB
Makefile

# Hanzo FUSE Integration Testing Makefile
# Configuration
S3_BINARY := s3
GO_VERSION := 1.24
TEST_TIMEOUT := 30m
COVERAGE_FILE := coverage.out
# Default target
.DEFAULT_GOAL := help
# Check if s3 binary exists
check-binary:
@if [ ! -f "$(S3_BINARY)" ]; then \
echo "ERROR Hanzo binary not found at $(S3_BINARY)"; \
echo " Please run 'make' in the root directory first"; \
exit 1; \
fi
@echo "OK Hanzo binary found"
# Check FUSE installation
check-fuse:
@if command -v fusermount >/dev/null 2>&1; then \
echo "OK FUSE is installed (Linux)"; \
elif command -v umount >/dev/null 2>&1 && [ "$$(uname)" = "Darwin" ]; then \
echo "OK FUSE is available (macOS)"; \
else \
echo "ERROR FUSE not found. Please install:"; \
echo " Ubuntu/Debian: sudo apt-get install fuse"; \
echo " CentOS/RHEL: sudo yum install fuse"; \
echo " macOS: brew install macfuse"; \
exit 1; \
fi
# Check Go version
check-go:
@go version | grep -q "go1\.[2-9][0-9]" || \
go version | grep -q "go1\.2[1-9]" || \
(echo "ERROR Go $(GO_VERSION)+ required. Current: $$(go version)" && exit 1)
@echo "OK Go version check passed"
# Verify all prerequisites
check-prereqs: check-go check-fuse
@echo "โœ… All prerequisites satisfied"
# Build the Hanzo binary (if needed)
build:
@echo "Building Hanzo..."
cd ../.. && make
@echo "OK Build complete"
# Initialize go module (if needed)
init-module:
@if [ ! -f go.mod ]; then \
echo "๐Ÿ“ฆ Initializing Go module..."; \
go mod init hanzo-fuse-tests; \
go mod tidy; \
fi
# Run all tests
test: check-prereqs init-module
@echo "๐Ÿงช Running all FUSE integration tests..."
go test -v -timeout $(TEST_TIMEOUT) ./...
# Run tests with coverage
test-coverage: check-prereqs init-module
@echo "๐Ÿงช Running tests with coverage..."
go test -v -timeout $(TEST_TIMEOUT) -coverprofile=$(COVERAGE_FILE) ./...
go tool cover -html=$(COVERAGE_FILE) -o coverage.html
@echo "๐Ÿ“Š Coverage report generated: coverage.html"
# Run specific test categories
test-basic: check-prereqs init-module
@echo "๐Ÿงช Running basic file operations tests..."
go test -v -timeout $(TEST_TIMEOUT) -run TestBasicFileOperations
test-directory: check-prereqs init-module
@echo "๐Ÿงช Running directory operations tests..."
go test -v -timeout $(TEST_TIMEOUT) -run TestDirectoryOperations
test-concurrent: check-prereqs init-module
@echo "๐Ÿงช Running concurrent operations tests..."
go test -v -timeout $(TEST_TIMEOUT) -run TestConcurrentFileOperations
test-stress: check-prereqs init-module
@echo "๐Ÿงช Running stress tests..."
go test -v -timeout $(TEST_TIMEOUT) -run TestStressOperations
test-large-files: check-prereqs init-module
@echo "๐Ÿงช Running large file tests..."
go test -v -timeout $(TEST_TIMEOUT) -run TestLargeFileOperations
# Run tests with debugging enabled
test-debug: check-prereqs init-module
@echo "๐Ÿ” Running tests with debug output..."
go test -v -timeout $(TEST_TIMEOUT) -args -debug
# Run tests and keep temp files for inspection
test-no-cleanup: check-prereqs init-module
@echo "๐Ÿงช Running tests without cleanup (for debugging)..."
go test -v -timeout $(TEST_TIMEOUT) -args -no-cleanup
# Quick smoke test
test-smoke: check-prereqs init-module
@echo "๐Ÿ’จ Running smoke tests..."
go test -v -timeout 5m -run TestBasicFileOperations/CreateAndReadFile
# Run benchmarks
benchmark: check-prereqs init-module
@echo "๐Ÿ“ˆ Running benchmarks..."
go test -v -timeout $(TEST_TIMEOUT) -bench=. -benchmem
# Validate test files compile
validate: init-module
@echo "โœ… Validating test files..."
go build -o /dev/null ./...
@echo "โœ… All test files compile successfully"
# Clean up generated files
clean:
@echo "๐Ÿงน Cleaning up..."
rm -f $(COVERAGE_FILE) coverage.html
rm -rf /tmp/hanzo_fuse_test_*
go clean -testcache
@echo "โœ… Cleanup complete"
# Format Go code
fmt:
@echo "๐ŸŽจ Formatting Go code..."
go fmt ./...
# Run linter
lint:
@echo "๐Ÿ” Running linter..."
@if command -v golangci-lint >/dev/null 2>&1; then \
golangci-lint run; \
else \
echo "โš ๏ธ golangci-lint not found, running go vet instead"; \
go vet ./...; \
fi
# Run all quality checks
check: validate lint fmt
@echo "โœ… All quality checks passed"
# Install development dependencies
install-deps:
@echo "๐Ÿ“ฆ Installing development dependencies..."
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
go mod download
go mod tidy
# Quick development setup
setup: install-deps build check-prereqs
@echo "๐Ÿš€ Development environment ready!"
# Docker-based testing
test-docker:
@echo "๐Ÿณ Running tests in Docker..."
docker build -t hanzo-fuse-tests -f Dockerfile.test ../..
docker run --rm --privileged hanzo-fuse-tests
# Create Docker test image
docker-build:
@echo "๐Ÿณ Building Docker test image..."
@cat > Dockerfile.test << 'EOF' ;\
FROM golang:$(GO_VERSION) ;\
RUN apt-get update && apt-get install -y fuse ;\
WORKDIR /hanzo ;\
COPY . . ;\
RUN make ;\
WORKDIR /hanzo/test/fuse ;\
RUN go mod init hanzo-fuse-tests && go mod tidy ;\
CMD ["make", "test"] ;\
EOF
# GitHub Actions workflow
generate-workflow:
@echo "๐Ÿ“ Generating GitHub Actions workflow..."
@mkdir -p ../../.github/workflows
@cat > ../../.github/workflows/fuse-integration.yml << 'EOF' ;\
name: FUSE Integration Tests ;\
;\
on: ;\
push: ;\
branches: [ master, main ] ;\
pull_request: ;\
branches: [ master, main ] ;\
;\
jobs: ;\
fuse-integration: ;\
runs-on: ubuntu-latest ;\
timeout-minutes: 45 ;\
;\
steps: ;\
- name: Checkout code ;\
uses: actions/checkout@v4 ;\
;\
- name: Set up Go ;\
uses: actions/setup-go@v4 ;\
with: ;\
go-version: '$(GO_VERSION)' ;\
;\
- name: Install FUSE ;\
run: sudo apt-get update && sudo apt-get install -y fuse ;\
;\
- name: Build Hanzo ;\
run: make ;\
;\
- name: Run FUSE Integration Tests ;\
run: | ;\
cd test/fuse ;\
make test ;\
;\
- name: Upload test artifacts ;\
if: failure() ;\
uses: actions/upload-artifact@v3 ;\
with: ;\
name: test-logs ;\
path: /tmp/hanzo_fuse_test_* ;\
EOF
@echo "โœ… GitHub Actions workflow generated"
# Performance profiling
profile: check-prereqs init-module
@echo "๐Ÿ“Š Running performance profiling..."
go test -v -timeout $(TEST_TIMEOUT) -cpuprofile cpu.prof -memprofile mem.prof -bench=.
@echo "๐Ÿ“Š Profiles generated: cpu.prof, mem.prof"
@echo "๐Ÿ“Š View with: go tool pprof cpu.prof"
# Memory leak detection
test-memory: check-prereqs init-module
@echo "๐Ÿ” Running memory leak detection..."
go test -v -timeout $(TEST_TIMEOUT) -race -test.memprofile mem.prof
# List available test functions
list-tests:
@echo "๐Ÿ“‹ Available test functions:"
@grep -r "^func Test" *.go | sed 's/.*func \(Test[^(]*\).*/ \1/' | sort
# Get test status and statistics
test-stats: check-prereqs init-module
@echo "๐Ÿ“Š Test statistics:"
@go test -v ./... | grep -E "(PASS|FAIL|RUN)" | \
awk '{ \
if ($$1 == "RUN") tests++; \
else if ($$1 == "PASS") passed++; \
else if ($$1 == "FAIL") failed++; \
} END { \
printf " Total tests: %d\n", tests; \
printf " Passed: %d\n", passed; \
printf " Failed: %d\n", failed; \
printf " Success rate: %.1f%%\n", (passed/tests)*100; \
}'
# Watch for file changes and run tests
watch:
@echo "๐Ÿ‘€ Watching for changes..."
@if command -v entr >/dev/null 2>&1; then \
find . -name "*.go" | entr -c make test-smoke; \
else \
echo "โš ๏ธ 'entr' not found. Install with: apt-get install entr"; \
echo " Falling back to manual test run"; \
make test-smoke; \
fi
# Show help
help:
@echo "Hanzo FUSE Integration Testing"
@echo "=================================="
@echo ""
@echo "Prerequisites:"
@echo " make check-prereqs - Check all prerequisites"
@echo " make setup - Complete development setup"
@echo " make build - Build Hanzo binary"
@echo ""
@echo "Testing:"
@echo " make test - Run all tests"
@echo " make test-basic - Run basic file operations tests"
@echo " make test-directory - Run directory operations tests"
@echo " make test-concurrent - Run concurrent operations tests"
@echo " make test-stress - Run stress tests"
@echo " make test-smoke - Quick smoke test"
@echo " make test-coverage - Run tests with coverage report"
@echo ""
@echo "Debugging:"
@echo " make test-debug - Run tests with debug output"
@echo " make test-no-cleanup - Keep temp files for inspection"
@echo " make profile - Performance profiling"
@echo " make test-memory - Memory leak detection"
@echo ""
@echo "Quality:"
@echo " make validate - Validate test files compile"
@echo " make lint - Run linter"
@echo " make fmt - Format code"
@echo " make check - Run all quality checks"
@echo ""
@echo "Utilities:"
@echo " make clean - Clean up generated files"
@echo " make list-tests - List available test functions"
@echo " make test-stats - Show test statistics"
@echo " make watch - Watch files and run smoke tests"
@echo ""
@echo "Docker & CI:"
@echo " make test-docker - Run tests in Docker"
@echo " make generate-workflow - Generate GitHub Actions workflow"
.PHONY: help check-prereqs check-binary check-fuse check-go build init-module \
test test-coverage test-basic test-directory test-concurrent test-stress \
test-large-files test-debug test-no-cleanup test-smoke benchmark validate \
clean fmt lint check install-deps setup test-docker docker-build \
generate-workflow profile test-memory list-tests test-stats watch