From bebff269a609f9123b153fa4fdedfc7ec0e32d51 Mon Sep 17 00:00:00 2001 From: Samir Talwar Date: Wed, 12 Oct 2022 15:26:35 +0200 Subject: [PATCH] server/tests-py: If a port is busy, try to figure out why. Every now and again, I see in CI that a test will abort early because port 8080 is busy. Given that we're running in a fresh Docker container, this makes no sense to me. On failure, it will now run `lsof -i :$PORT` to try and figure out what's listening on that port. PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6285 GitOrigin-RevId: 5eb58d016b2f43872e2c78a7d89d27cfc3e22312 --- .circleci/test-server.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.circleci/test-server.sh b/.circleci/test-server.sh index cb9dbce0320..dfbbfb96299 100755 --- a/.circleci/test-server.sh +++ b/.circleci/test-server.sh @@ -36,7 +36,12 @@ time_elapsed() { fail_if_port_busy() { local PORT="$1" if nc -z localhost "$PORT"; then - echo "Port $PORT is busy. Exiting" + echo "ERROR:" + echo "Port $PORT is busy." + echo "Output of \`lsof -i :$PORT\`:" + lsof -i ":$PORT" + echo + echo 'Exiting immediately.' exit 1 fi }