Skip to content

Commit c972cd2

Browse files
ci: Check the queue names of the smoke test's executor
The executor smoke test passed as soon as any executor registered. It now also fails unless an executor serves exactly the three queues which test/docker-compose.override.yaml sets: batches, batches-hooks, and codeintel. Amp-Thread-ID: https://ampcode.com/threads/T-01a1c7a5-6b65-723b-980c-b85e1e9008b5 Co-authored-by: Amp <amp@ampcode.com>
1 parent 889ac57 commit c972cd2

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

‎test/docker-compose.override.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ services:
55
executor:
66
environment:
77
- EXECUTOR_FRONTEND_PASSWORD=executor-smoke-test-token
8-
# Every queue. The base file leaves EXECUTOR_QUEUE_NAME empty, which the executor requires with this
8+
# Every queue; executor-smoke-test.sh checks for these names.
9+
# The base file leaves EXECUTOR_QUEUE_NAME empty, which the executor requires with this
910
- EXECUTOR_QUEUE_NAMES=batches,batches-hooks,codeintel

‎test/executor-smoke-test.sh‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -euo pipefail
66
# Requires: a running Sourcegraph docker-compose stack with an executor container
77
# (from smoke-test.sh or manual start).
88
# This script creates a site admin account, configures executor access, and verifies
9-
# the executor registers with the Sourcegraph instance.
9+
# the executor registers with the Sourcegraph instance, with every queue.
1010
#
1111
# Dependencies: curl, jq, docker
1212

@@ -15,6 +15,8 @@ EXECUTOR_TOKEN=$(docker exec executor printenv EXECUTOR_FRONTEND_PASSWORD)
1515
ADMIN_EMAIL="smoke-test@sourcegraph.com"
1616
ADMIN_USERNAME="smoke-admin"
1717
ADMIN_PASSWORD="smoke-test-password-123!"
18+
# The queues test/docker-compose.override.yaml gives the executor, sorted
19+
EXPECTED_QUEUE_NAMES="batches,batches-hooks,codeintel"
1820

1921
echo "=== Executor Smoke Test ==="
2022

@@ -78,14 +80,23 @@ echo " Site config updated"
7880
echo "Step 5: Waiting for executor to register..."
7981
MAX_ATTEMPTS=24
8082
for i in $(seq 1 $MAX_ATTEMPTS); do
81-
COUNT=$(curl -s -X POST "${FRONTEND_URL}/.api/graphql" \
83+
EXECUTORS=$(curl -s -X POST "${FRONTEND_URL}/.api/graphql" \
8284
-H "Authorization: token $TOKEN" \
8385
-H 'Content-Type: application/json' \
84-
-d '{"query":"{ executors(query: \"\", active: false) { totalCount } }"}' \
85-
| jq -r '.data.executors.totalCount // 0')
86+
-d '{"query":"{ executors(query: \"\", active: false) { totalCount nodes { queueNames } } }"}')
87+
COUNT=$(jq -r '.data.executors.totalCount // 0' <<<"$EXECUTORS")
8688

8789
if [ "$COUNT" -ge 1 ] 2>/dev/null; then
8890
echo " Executor registered after $((i * 5))s"
91+
# One line per executor: its queue names, sorted
92+
QUEUE_NAMES=$(jq -r '.data.executors.nodes[] | .queueNames // [] | sort | join(",")' <<<"$EXECUTORS")
93+
if ! grep --quiet --line-regexp --fixed-strings "$EXPECTED_QUEUE_NAMES" <<<"$QUEUE_NAMES"; then
94+
echo ""
95+
echo "=== EXECUTOR SMOKE TEST FAILED ==="
96+
echo "No executor serves the queues \"$EXPECTED_QUEUE_NAMES\". Registered: \"$QUEUE_NAMES\""
97+
exit 1
98+
fi
99+
echo " Executor serves the queues $EXPECTED_QUEUE_NAMES"
89100
echo ""
90101
echo "=== EXECUTOR SMOKE TEST PASSED ==="
91102
exit 0

0 commit comments

Comments
 (0)