mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-05-17 23:31:31 +00:00
The master returns each registered filer in pb.ServerAddress dual-port form (host:httpPort.grpcPort, e.g. 10.0.0.1:8888.18888). The admin's plugin context builder forwarded that string verbatim as filer_grpc_address, so workers calling grpc.DialContext on it failed every job in ~3ms with "dial tcp: lookup tcp/8888.18888: unknown port". Run each entry through pb.ServerAddress.ToGrpcAddress before populating ClusterContext.FilerGrpcAddresses. The lifecycle integration test now pins filer.port.grpc to a value that breaks the FILER_PORT+10000 assumption, and a new dispatch test drives the admin's /api/plugin/job-types/s3_lifecycle/run path end-to-end and asserts the dispatched job both reaches the filer and deletes the backdated object.
87 lines
2.7 KiB
Makefile
87 lines
2.7 KiB
Makefile
# S3 Lifecycle Test Makefile
|
|
# End-to-end test of the event-driven lifecycle worker, driven by
|
|
# the s3.lifecycle.run-shard shell command.
|
|
|
|
.PHONY: help build-weed start-server stop-server test test-with-server clean health-check
|
|
|
|
WEED_BINARY := ../../../weed/weed_binary
|
|
S3_PORT := 8333
|
|
MASTER_PORT := 9333
|
|
VOLUME_PORT := 8080
|
|
FILER_PORT := 8888
|
|
# Pin the filer gRPC port off the FILER_PORT+10000 convention so any
|
|
# code path that assumes the offset breaks here, not in production.
|
|
FILER_GRPC_PORT := 18890
|
|
ADMIN_PORT := 23646
|
|
ACCESS_KEY ?= some_access_key1
|
|
SECRET_KEY ?= some_secret_key1
|
|
TEST_TIMEOUT := 10m
|
|
TEST_PATTERN := TestLifecycle
|
|
SERVER_DIR := ./test-volume-data/server-data
|
|
|
|
help:
|
|
@echo "S3 Lifecycle Test Makefile"
|
|
@echo ""
|
|
@echo "Targets:"
|
|
@echo " build-weed - build the SeaweedFS binary"
|
|
@echo " start-server - start a local 'weed mini' cluster"
|
|
@echo " stop-server - stop the cluster"
|
|
@echo " test - run tests against an already-running cluster"
|
|
@echo " test-with-server - start, run tests, stop"
|
|
@echo " health-check - is the S3 endpoint up?"
|
|
@echo " clean - remove test artifacts"
|
|
|
|
build-weed:
|
|
@echo "Building SeaweedFS binary..."
|
|
@cd ../../../weed && go build -o weed_binary .
|
|
@chmod +x $(WEED_BINARY)
|
|
|
|
start-server: build-weed
|
|
@echo "Starting weed mini..."
|
|
@rm -f weed-server.pid
|
|
@mkdir -p $(SERVER_DIR)
|
|
@AWS_ACCESS_KEY_ID=$(ACCESS_KEY) AWS_SECRET_ACCESS_KEY=$(SECRET_KEY) $(WEED_BINARY) mini \
|
|
-dir=$(SERVER_DIR) \
|
|
-s3.port=$(S3_PORT) \
|
|
-filer.port.grpc=$(FILER_GRPC_PORT) \
|
|
> weed-test.log 2>&1 & \
|
|
echo $$! > weed-server.pid
|
|
@for i in $$(seq 1 90); do \
|
|
if curl -s http://localhost:$(S3_PORT) >/dev/null 2>&1; then \
|
|
echo "server up after $$i s"; exit 0; \
|
|
fi; \
|
|
sleep 1; \
|
|
done; \
|
|
echo "server did not start within 90s"; \
|
|
tail -50 weed-test.log; \
|
|
exit 1
|
|
|
|
stop-server:
|
|
@if [ -f weed-server.pid ]; then \
|
|
PID=$$(cat weed-server.pid); \
|
|
kill -TERM $$PID 2>/dev/null || true; \
|
|
sleep 1; \
|
|
kill -KILL $$PID 2>/dev/null || true; \
|
|
rm -f weed-server.pid; \
|
|
fi
|
|
|
|
health-check:
|
|
@curl -s http://localhost:$(S3_PORT) >/dev/null && echo "S3 up on $(S3_PORT)" || (echo "S3 not reachable"; exit 1)
|
|
|
|
test:
|
|
@WEED_BINARY=$$(cd ../../../weed && pwd)/weed_binary \
|
|
S3_ENDPOINT=http://localhost:$(S3_PORT) \
|
|
S3_GRPC_ENDPOINT=localhost:$$(($(S3_PORT) + 10000)) \
|
|
MASTER_ENDPOINT=http://localhost:$(MASTER_PORT) \
|
|
FILER_GRPC_ADDRESS=localhost:$(FILER_GRPC_PORT) \
|
|
ADMIN_ENDPOINT=http://localhost:$(ADMIN_PORT) \
|
|
go test -v -timeout $(TEST_TIMEOUT) -run $(TEST_PATTERN)
|
|
|
|
test-with-server: start-server
|
|
@$(MAKE) test || (RC=$$?; $(MAKE) stop-server; exit $$RC)
|
|
@$(MAKE) stop-server
|
|
|
|
clean: stop-server
|
|
@rm -rf $(SERVER_DIR) test-volume-data
|
|
@rm -f weed-test.log weed-server.pid
|