Skip to content

Commit a1b24fd

Browse files
committed
ci: add Docker smoke test to catch native module failures
Build the Docker image and verify it works on every PR and push to develop/main/v2-*. Two checks: 1. Native module load — catches glibc mismatches like the GLIBC_2.38 error that put all CADT pods into CrashLoopBackOff 2. Container startup — runs the app with USE_SIMULATOR=true and waits for the "Server listening" log message
1 parent d902555 commit a1b24fd

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Docker Smoke Test
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- develop
8+
- main
9+
- 'v2-*'
10+
11+
permissions:
12+
contents: read
13+
14+
concurrency:
15+
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
docker-smoke-test:
20+
name: Docker smoke test
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v6
24+
25+
- name: Build Docker image
26+
run: docker build -t cadt-smoke-test .
27+
28+
- name: Verify native modules load
29+
run: |
30+
docker run --rm --entrypoint node --workdir /app cadt-smoke-test \
31+
--input-type=commonjs -e \
32+
"require('sqlite3'); console.log('sqlite3 native module loaded OK')"
33+
34+
- name: Verify container starts and health endpoints respond
35+
run: |
36+
trap 'docker rm -f cadt-test > /dev/null 2>&1 || true' EXIT
37+
38+
docker run -d --name cadt-test \
39+
-e USE_SIMULATOR=true \
40+
-e BIND_ADDRESS=0.0.0.0 \
41+
-p 31310:31310 \
42+
cadt-smoke-test
43+
44+
for i in $(seq 1 60); do
45+
if docker logs cadt-test 2>&1 | grep -q "Server listening"; then
46+
echo "Server started successfully"
47+
break
48+
fi
49+
if ! docker ps -q --filter "name=cadt-test" | grep -q .; then
50+
echo "Container exited unexpectedly:"
51+
docker logs cadt-test 2>&1
52+
exit 1
53+
fi
54+
if [ "$i" -eq 60 ]; then
55+
echo "Timeout waiting for server to start"
56+
docker logs cadt-test 2>&1
57+
exit 1
58+
fi
59+
sleep 1
60+
done
61+
62+
echo "Testing health endpoints..."
63+
64+
curl -sf http://localhost:31310/health | jq .
65+
curl -sf http://localhost:31310/v1/health | jq .
66+
curl -sf http://localhost:31310/v2/health | jq .
67+
68+
echo "All health checks passed"

0 commit comments

Comments
 (0)