mirror of
https://github.com/hanzoai/s3.git
synced 2026-10-30 14:59:09 +00:00
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]>
130 lines
3.3 KiB
Bash
130 lines
3.3 KiB
Bash
#!/bin/bash
|
|
|
|
# Test script to verify broker discovery works end-to-end
|
|
|
|
set -e
|
|
|
|
echo "=== Testing Hanzo Broker Discovery ==="
|
|
|
|
cd /Users/chrislu/go/src/github.com/hanzoai/s3
|
|
|
|
# Build s3 binary
|
|
echo "Building s3 binary..."
|
|
go build -o /tmp/s3-discovery ./s3
|
|
|
|
# Setup data directory
|
|
S3_DATA_DIR="/tmp/hanzo-discovery-test-$$"
|
|
mkdir -p "$S3_DATA_DIR"
|
|
echo "Using data directory: $S3_DATA_DIR"
|
|
|
|
# Cleanup function
|
|
cleanup() {
|
|
echo "Cleaning up..."
|
|
pkill -f "s3.*server" || true
|
|
pkill -f "s3.*mq.broker" || true
|
|
sleep 2
|
|
rm -rf "$S3_DATA_DIR"
|
|
rm -f /tmp/s3-discovery* /tmp/broker-discovery-test*
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
# Start Hanzo server with consistent IP configuration
|
|
echo "Starting Hanzo server..."
|
|
/tmp/s3-discovery -v 1 server \
|
|
-ip="127.0.0.1" \
|
|
-ip.bind="127.0.0.1" \
|
|
-dir="$S3_DATA_DIR" \
|
|
-master.raftHashicorp \
|
|
-master.port=9333 \
|
|
-volume.port=8081 \
|
|
-filer.port=8888 \
|
|
-filer=true \
|
|
-metricsPort=9325 \
|
|
> /tmp/s3-discovery-server.log 2>&1 &
|
|
|
|
SERVER_PID=$!
|
|
echo "Server PID: $SERVER_PID"
|
|
|
|
# Wait for master
|
|
echo "Waiting for master..."
|
|
for i in $(seq 1 30); do
|
|
if curl -s http://127.0.0.1:9333/cluster/status >/dev/null; then
|
|
echo "✓ Master is up"
|
|
break
|
|
fi
|
|
echo " Waiting for master... ($i/30)"
|
|
sleep 1
|
|
done
|
|
|
|
# Give components time to initialize
|
|
echo "Waiting for components to initialize..."
|
|
sleep 10
|
|
|
|
# Start MQ broker
|
|
echo "Starting MQ broker..."
|
|
/tmp/s3-discovery -v 2 mq.broker \
|
|
-master="127.0.0.1:9333" \
|
|
-port=17777 \
|
|
> /tmp/s3-discovery-broker.log 2>&1 &
|
|
|
|
BROKER_PID=$!
|
|
echo "Broker PID: $BROKER_PID"
|
|
|
|
# Wait for broker
|
|
echo "Waiting for broker to register..."
|
|
sleep 15
|
|
broker_ready=false
|
|
for i in $(seq 1 20); do
|
|
if nc -z 127.0.0.1 17777; then
|
|
echo "✓ MQ broker is accepting connections"
|
|
broker_ready=true
|
|
break
|
|
fi
|
|
echo " Waiting for MQ broker... ($i/20)"
|
|
sleep 1
|
|
done
|
|
|
|
if [ "$broker_ready" = false ]; then
|
|
echo "[FAIL] MQ broker failed to start"
|
|
echo "Server logs:"
|
|
cat /tmp/s3-discovery-server.log
|
|
echo "Broker logs:"
|
|
cat /tmp/s3-discovery-broker.log
|
|
exit 1
|
|
fi
|
|
|
|
# Additional wait for broker registration
|
|
echo "Allowing broker to register with master..."
|
|
sleep 15
|
|
|
|
# Check cluster status
|
|
echo "Checking cluster status..."
|
|
CLUSTER_STATUS=$(curl -s "http://127.0.0.1:9333/cluster/status")
|
|
echo "Cluster status: $CLUSTER_STATUS"
|
|
|
|
# Now test broker discovery using the same approach as the Kafka gateway
|
|
echo "Testing broker discovery..."
|
|
cd test/kafka
|
|
S3_MASTERS=127.0.0.1:9333 timeout 30s go test -v -run "TestOffsetManagement" -timeout 25s ./e2e/... > /tmp/broker-discovery-test.log 2>&1 && discovery_success=true || discovery_success=false
|
|
|
|
if [ "$discovery_success" = true ]; then
|
|
echo "[OK] Broker discovery test PASSED!"
|
|
echo "Gateway was able to discover and connect to MQ brokers"
|
|
else
|
|
echo "[FAIL] Broker discovery test FAILED"
|
|
echo "Last few lines of test output:"
|
|
tail -20 /tmp/broker-discovery-test.log || echo "No test logs available"
|
|
fi
|
|
|
|
echo
|
|
echo "📊 Test Results:"
|
|
echo " Broker startup: ✅"
|
|
echo " Broker registration: ✅"
|
|
echo " Gateway discovery: $([ "$discovery_success" = true ] && echo "✅" || echo "❌")"
|
|
|
|
echo
|
|
echo "📁 Logs available:"
|
|
echo " Server: /tmp/s3-discovery-server.log"
|
|
echo " Broker: /tmp/s3-discovery-broker.log"
|
|
echo " Discovery test: /tmp/broker-discovery-test.log"
|