mirror of
https://github.com/hanzoai/s3.git
synced 2026-10-30 14:59:09 +00:00
Full internal rename — build-verified, every module green (root + s3-rdma-sidecar
+ telemetry/server + all test modules):
- Dirs: weed/→s3/ (main tree); cmd/weed-{db,sql}→cmd/s3-{db,sql};
seaweed-volume→s3-volume; seaweedfs-rdma-sidecar→s3-rdma-sidecar;
s3/mount/weedfs_*.go→s3fs_*.go (~113 path renames).
- Imports: github.com/hanzoai/s3/weed/ → /s3/ across 1700+ files.
- gRPC proto services Seaweed/SeaweedFiler/SeaweedMessaging/... → Hanzo*
(8 services) via full protoc regeneration (correct descriptors, no sed-corruption).
- Brand SeaweedFS/Seaweed/seaweed → Hanzo/hanzo; internal X-Seaweedfs-* headers
→ X-Hanzo-*; .seaweedfs config dir → .s3.
- CLI is `s3`: go install github.com/hanzoai/s3/s3@latest | make install | Docker.
install.sh rewritten as a Hanzo S3 installer.
- External forks github.com/seaweedfs/{raft,go-fuse,goexif,cockroachdb-parser}
kept verbatim — immutable third-party module paths; NOTICE retained.
Residual (cosmetic, non-build): kafka loadtest test-proto package com.seaweedfs.loadtest.
129 lines
4.1 KiB
Bash
Executable File
129 lines
4.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# End-to-end test script for Hanzo 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 Hanzo!"
|
|
|
|
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 hanzo hanzo\xFF' > fdb_keys.txt || true
|
|
|
|
if [ -s fdb_keys.txt ] && grep -q "hanzo" 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: ✅"
|