mirror of
https://github.com/hanzoai/s3.git
synced 2026-10-30 14:59:09 +00:00
hanzoai/s3 was an AGPL-3.0 MinIO fork whose network-copyleft blocks embedding
and reselling as a managed service. Replace it wholesale with a fork of
SeaweedFS (github.com/seaweedfs/seaweedfs, Apache-2.0, Go) which ships a
built-in S3 gateway + Filer.
- License: AGPL-3.0 -> Apache-2.0 (upstream LICENSE kept verbatim, incl.
"Copyright 2025 Chris Lu"); NOTICE added crediting SeaweedFS. No AGPL/BUSL/
SSPL/GPL or enterprise ("ee") files remain.
- Module: go.mod path set to github.com/hanzoai/s3 with a self-replace
(replace github.com/seaweedfs/seaweedfs => ./) so the ~1800 internal Go files
keep their upstream import paths with zero churn. Internal identifiers and
import paths are intentionally NOT renamed.
- CLI rebrand: the binary is built as `s3` (was `weed`); root usage, per-command
help/usage/flag strings, shell autocomplete program name, and the product name
in CLI output now read "Hanzo S3" / `s3`. Users never see `weed`.
(e.g. `s3 server`, `s3 filer`, `s3 master`, `s3 volume`, `s3 s3`, `s3 mount`.)
- Build: `make` (or `go build -o s3 ./weed`) builds the `s3` binary green;
`cmd/weed-db` and `cmd/weed-sql` also build; `go vet ./weed/command/` clean.
- README/LLM.md rewritten for Hanzo S3; AGENTS.md/CLAUDE.md symlinks preserved.
- Dropped a 33MB prebuilt Mach-O `stress` binary upstream had committed; `.gitignore`
updated to ignore the `s3` build output.
129 lines
4.1 KiB
Bash
Executable File
129 lines
4.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# End-to-end test script for SeaweedFS with FoundationDB
|
|
set -e
|
|
|
|
# Colors
|
|
BLUE='\033[36m'
|
|
GREEN='\033[32m'
|
|
YELLOW='\033[33m'
|
|
RED='\033[31m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Test configuration
|
|
S3_ENDPOINT="http://127.0.0.1:8333"
|
|
ACCESS_KEY="admin"
|
|
SECRET_KEY="admin_secret_key"
|
|
BUCKET_NAME="test-fdb-bucket"
|
|
TEST_FILE="test-file.txt"
|
|
TEST_CONTENT="Hello FoundationDB from SeaweedFS!"
|
|
|
|
echo -e "${BLUE}Starting FoundationDB S3 integration tests...${NC}"
|
|
|
|
# Install aws-cli if not present (for testing)
|
|
if ! command -v aws &> /dev/null; then
|
|
echo -e "${YELLOW}AWS CLI not found. Please install it for full S3 testing.${NC}"
|
|
echo -e "${YELLOW}Continuing with curl-based tests...${NC}"
|
|
USE_CURL=true
|
|
else
|
|
USE_CURL=false
|
|
# Configure AWS CLI
|
|
export AWS_ACCESS_KEY_ID="$ACCESS_KEY"
|
|
export AWS_SECRET_ACCESS_KEY="$SECRET_KEY"
|
|
export AWS_DEFAULT_REGION="us-east-1"
|
|
fi
|
|
|
|
cleanup() {
|
|
echo -e "${YELLOW}Cleaning up test resources...${NC}"
|
|
if [ "$USE_CURL" = false ]; then
|
|
aws s3 rb s3://$BUCKET_NAME --force --endpoint-url=$S3_ENDPOINT 2>/dev/null || true
|
|
fi
|
|
rm -f $TEST_FILE
|
|
}
|
|
|
|
trap cleanup EXIT
|
|
|
|
echo -e "${BLUE}Test 1: Create test file${NC}"
|
|
echo "$TEST_CONTENT" > $TEST_FILE
|
|
echo -e "${GREEN}✅ Created test file${NC}"
|
|
|
|
if [ "$USE_CURL" = false ]; then
|
|
echo -e "${BLUE}Test 2: Create S3 bucket${NC}"
|
|
aws s3 mb s3://$BUCKET_NAME --endpoint-url=$S3_ENDPOINT
|
|
echo -e "${GREEN}✅ Bucket created successfully${NC}"
|
|
|
|
echo -e "${BLUE}Test 3: Upload file to S3${NC}"
|
|
aws s3 cp $TEST_FILE s3://$BUCKET_NAME/ --endpoint-url=$S3_ENDPOINT
|
|
echo -e "${GREEN}✅ File uploaded successfully${NC}"
|
|
|
|
echo -e "${BLUE}Test 4: List bucket contents${NC}"
|
|
aws s3 ls s3://$BUCKET_NAME --endpoint-url=$S3_ENDPOINT
|
|
echo -e "${GREEN}✅ Listed bucket contents${NC}"
|
|
|
|
echo -e "${BLUE}Test 5: Download and verify file${NC}"
|
|
aws s3 cp s3://$BUCKET_NAME/$TEST_FILE downloaded-$TEST_FILE --endpoint-url=$S3_ENDPOINT
|
|
|
|
if diff $TEST_FILE downloaded-$TEST_FILE > /dev/null; then
|
|
echo -e "${GREEN}✅ File content verification passed${NC}"
|
|
else
|
|
echo -e "${RED}❌ File content verification failed${NC}"
|
|
exit 1
|
|
fi
|
|
rm -f downloaded-$TEST_FILE
|
|
|
|
echo -e "${BLUE}Test 6: Delete file${NC}"
|
|
aws s3 rm s3://$BUCKET_NAME/$TEST_FILE --endpoint-url=$S3_ENDPOINT
|
|
echo -e "${GREEN}✅ File deleted successfully${NC}"
|
|
|
|
echo -e "${BLUE}Test 7: Verify file deletion${NC}"
|
|
if aws s3 ls s3://$BUCKET_NAME --endpoint-url=$S3_ENDPOINT | grep -q $TEST_FILE; then
|
|
echo -e "${RED}❌ File deletion verification failed${NC}"
|
|
exit 1
|
|
else
|
|
echo -e "${GREEN}✅ File deletion verified${NC}"
|
|
fi
|
|
|
|
else
|
|
echo -e "${YELLOW}Running basic curl tests...${NC}"
|
|
|
|
echo -e "${BLUE}Test 2: Check S3 endpoint availability${NC}"
|
|
if curl -f -s $S3_ENDPOINT > /dev/null; then
|
|
echo -e "${GREEN}✅ S3 endpoint is accessible${NC}"
|
|
else
|
|
echo -e "${RED}❌ S3 endpoint is not accessible${NC}"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
echo -e "${BLUE}Test: FoundationDB backend verification${NC}"
|
|
# Check that data is actually stored in FoundationDB
|
|
docker-compose exec -T fdb1 fdbcli --exec 'getrange seaweedfs seaweedfs\xFF' > fdb_keys.txt || true
|
|
|
|
if [ -s fdb_keys.txt ] && grep -q "seaweedfs" fdb_keys.txt; then
|
|
echo -e "${GREEN}✅ Data confirmed in FoundationDB backend${NC}"
|
|
else
|
|
echo -e "${YELLOW}⚠️ No data found in FoundationDB (may be expected if no operations performed)${NC}"
|
|
fi
|
|
|
|
rm -f fdb_keys.txt
|
|
|
|
echo -e "${BLUE}Test: Filer metadata operations${NC}"
|
|
# Test direct filer operations
|
|
FILER_ENDPOINT="http://127.0.0.1:8888"
|
|
|
|
# Create a directory
|
|
curl -X POST "$FILER_ENDPOINT/test-dir/" -H "Content-Type: application/json" -d '{}' || true
|
|
echo -e "${GREEN}✅ Directory creation test completed${NC}"
|
|
|
|
# List directory
|
|
curl -s "$FILER_ENDPOINT/" | head -10 || true
|
|
echo -e "${GREEN}✅ Directory listing test completed${NC}"
|
|
|
|
echo -e "${GREEN}🎉 All FoundationDB integration tests passed!${NC}"
|
|
|
|
echo -e "${BLUE}Test Summary:${NC}"
|
|
echo "- S3 API compatibility: ✅"
|
|
echo "- FoundationDB backend: ✅"
|
|
echo "- Filer operations: ✅"
|
|
echo "- Data persistence: ✅"
|