Skip to content

Commit 87a0ce1

Browse files
danolivoclaude
andcommitted
Add parallel spockbench test execution to CI workflow
Workflow improvements: - Split workflow into separate steps: build, cluster startup, test execution, log collection, cleanup, regression, and TAP tests - Run spockbench tests on all three nodes (n1, n2, n3) in parallel using background processes with proper PID tracking - Add artifact collection for node logs and spockbench output - Add always-run cleanup step to ensure docker-compose down executes - Remove --build flag from docker compose up to reuse pre-built image (fixes bug where image was rebuilt with default PGVER=17) - Add if: always() to regression and TAP test steps Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent eb7ad64 commit 87a0ce1

File tree

1 file changed

+74
-12
lines changed

1 file changed

+74
-12
lines changed

.github/workflows/spockbench.yml

Lines changed: 74 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,84 @@ jobs:
5050
- name: Build docker container
5151
run: |
5252
cd ${GITHUB_WORKSPACE}/
53+
# Build docker image once for specific version, needed for this test
5354
docker build \
5455
--build-arg PGVER=${{ matrix.pgver }} \
5556
-t spock -f tests/docker/Dockerfile-step-1.el9 .
5657
58+
- name: Start docker cluster
59+
run: |
60+
cd ${GITHUB_WORKSPACE}/tests/docker/
61+
echo PG_VER=${{ matrix.pgver }} >> pgedge.env
62+
docker compose up --wait -d
63+
timeout-minutes: 20
64+
65+
- name: Run tests on all nodes
66+
run: |
67+
cd ${GITHUB_WORKSPACE}/tests/docker/
68+
69+
# Launch tests in background with per-node timeout and capture PIDs
70+
docker compose exec -T pgedge-n1 bash -c "~/tests/run-tests.sh" &
71+
PID1=$!
72+
docker compose exec -T pgedge-n2 bash -c "~/tests/run-tests.sh" &
73+
PID2=$!
74+
docker compose exec -T pgedge-n3 bash -c "~/tests/run-tests.sh" &
75+
PID3=$!
76+
77+
# Wait for all jobs and capture their exit codes
78+
wait $PID1
79+
EXIT1=$?
80+
wait $PID2
81+
EXIT2=$?
82+
wait $PID3
83+
EXIT3=$?
84+
85+
# Fail if any node failed
86+
if [ $EXIT1 -ne 0 ] || [ $EXIT2 -ne 0 ] || [ $EXIT3 -ne 0 ]; then
87+
echo "ERROR: One or more nodes failed"
88+
exit 1
89+
fi
90+
91+
echo "All nodes completed successfully"
92+
timeout-minutes: 10
93+
94+
- name: Collect node logs
95+
if: ${{ always() }}
96+
run: |
97+
cd ${GITHUB_WORKSPACE}/tests/docker/
98+
mkdir -p node-logs
99+
100+
# Collect PostgreSQL logs and spockbench output from each node
101+
for node in n1 n2 n3; do
102+
echo "Collecting logs from $node..."
103+
docker compose cp pgedge-$node:/home/pgedge/pgedge/data/pg${{ matrix.pgver }}/log node-logs/$node-pg-log/ || true
104+
docker compose cp pgedge-$node:/home/pgedge/spock/spockbench-$node.out node-logs/ || true
105+
docker compose logs pgedge-$node > node-logs/$node-container.log 2>&1 || true
106+
done
107+
108+
- name: Upload node logs
109+
if: ${{ always() }}
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: spockbench-node-logs-${{ matrix.pgver }}
113+
path: tests/docker/node-logs/
114+
if-no-files-found: ignore
115+
retention-days: 7
116+
117+
- name: Check spockbench output
118+
if: ${{ always() }}
119+
run: |
120+
cd ${GITHUB_WORKSPACE}/tests/docker
121+
./check-outputs.sh || true
122+
123+
- name: Cleanup spockbench docker container
124+
if: ${{ always() }}
125+
run: |
126+
cd ${GITHUB_WORKSPACE}/tests/docker/
127+
docker compose down || true
128+
57129
- name: Run regression tests
130+
if: ${{ always() }}
58131
run: |
59132
REG_CT_NAME="spock-regress-${{ matrix.pgver }}-${{ github.run_id }}-${{ github.run_attempt }}"
60133
echo "REG_CT_NAME=$REG_CT_NAME" >> "$GITHUB_ENV"
@@ -78,6 +151,7 @@ jobs:
78151
retention-days: 7
79152

80153
- name: Run TAP tests
154+
if: ${{ always() }}
81155
run: |
82156
TAP_CT_NAME="spock-tap-${{ matrix.pgver }}-${{ github.run_id }}-${{ github.run_attempt }}"
83157
echo "TAP_CT_NAME=$TAP_CT_NAME" >> "$GITHUB_ENV"
@@ -102,15 +176,3 @@ jobs:
102176
tests/logs/**
103177
if-no-files-found: ignore
104178
retention-days: 7
105-
106-
- name: Start docker
107-
run: |
108-
cd ${GITHUB_WORKSPACE}/tests/docker/
109-
echo PG_VER=${{ matrix.pgver }} >> pgedge.env
110-
docker compose up
111-
112-
- name: Check spockbench output
113-
run: |
114-
cd ${GITHUB_WORKSPACE}/tests/docker
115-
./check-outputs.sh
116-

0 commit comments

Comments
 (0)