test: stop the compat server even when startup fails (#11659)

* test: stop the compat server even when startup fails

test-with-server depended on start-server as a prerequisite, so a failed
startup skipped the recipe and the spawned weed mini kept the port.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test: verify the recorded PID is weed before stopping it

A prerequisite failure leaves a stale weed-server.pid in place; the PID
may have been reused by an unrelated process.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Chris LuandDevin authored and GitHub committed 2026-10-09 10:01:53 +08:00
1 parent 9a9bd67efe
commit 440249a270
1 file changed
+9 -5
+9 -5
View File
@@ -76,9 +76,12 @@ start-server: check-deps
stop-server:
@if [ -f weed-server.pid ]; then \
echo "Stopping SeaweedFS server..."; \
kill $$(cat weed-server.pid) 2>/dev/null || true; \
sleep 2; \
pid=$$(cat weed-server.pid); \
if ps -p $$pid -o comm= 2>/dev/null | grep -q weed; then \
echo "Stopping SeaweedFS server..."; \
kill $$pid 2>/dev/null || true; \
sleep 2; \
fi; \
rm -f weed-server.pid; \
fi
@@ -89,8 +92,9 @@ test-errors:
--access-key admin \
--secret-key admin
test-with-server: start-server
@$(MAKE) test-errors; TEST_RESULT=$$?; \
test-with-server:
@$(MAKE) start-server; START_RESULT=$$?; \
if [ $$START_RESULT -eq 0 ]; then $(MAKE) test-errors; TEST_RESULT=$$?; else TEST_RESULT=$$START_RESULT; fi; \
$(MAKE) stop-server; exit $$TEST_RESULT
logs: