Skip to content

Commit 2b0b6b4

Browse files
committed
switch to using goss
1 parent 061cdb1 commit 2b0b6b4

2 files changed

Lines changed: 27 additions & 9 deletions

File tree

.github/workflows/test.yml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
on:
2+
workflow_dispatch:
23
pull_request:
34

45
name: "Trigger: Push action"
@@ -128,6 +129,17 @@ jobs:
128129
if [ $? -ne 0 ]; then
129130
exit 1
130131
fi
132+
# test the EXIT trap on process crash
133+
GOSS_VARS=goss_vars_${GH_RUNNER_IMAGE}.yaml GOSS_FILE=goss_trap_exit.yaml GOSS_SLEEP=1 dgoss run --entrypoint /usr/bin/sleep \
134+
-e DEBUG_ONLY=false \
135+
-e REPO_URL=https://github.com/fake/repo \
136+
-e RUNNER_TOKEN=faketoken \
137+
-e RUN_AS_ROOT=true \
138+
-e DISABLE_AUTOMATIC_DEREGISTRATION=false \
139+
${GH_RUNNER_IMAGE} 10
140+
if [ $? -ne 0 ]; then
141+
exit 1
142+
fi
131143
debian_tests:
132144
runs-on: ubuntu-latest
133145
strategy:
@@ -233,15 +245,14 @@ jobs:
233245
-e EPHEMERAL=true \
234246
-e DISABLE_AUTO_UPDATE=true \
235247
${GH_RUNNER_IMAGE} 10
236-
237-
- name: Test EXIT trap on crash
238-
run: |
239-
# Run the container with a dummy token and force it to exit with code 1
240-
docker run --name trap-test \
248+
# test the EXIT trap on process crash
249+
GOSS_VARS=goss_vars_${GH_RUNNER_IMAGE}.yaml GOSS_FILE=goss_trap_exit.yaml GOSS_SLEEP=1 dgoss run --entrypoint /usr/bin/sleep \
250+
-e DEBUG_ONLY=false \
241251
-e REPO_URL=https://github.com/fake/repo \
242252
-e RUNNER_TOKEN=faketoken \
253+
-e RUN_AS_ROOT=true \
243254
-e DISABLE_AUTOMATIC_DEREGISTRATION=false \
244-
${GH_RUNNER_IMAGE} /bin/bash -c "exit 1" || true
245-
246-
# Check the logs to ensure the trap fired
247-
docker logs trap-test | grep "Caught EXIT - Deregistering runner"
255+
${GH_RUNNER_IMAGE} 10
256+
if [ $? -ne 0 ]; then
257+
exit 1
258+
fi

goss_trap_exit.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
command:
2+
/entrypoint.sh /bin/bash -c "exit 1":
3+
exit-status: 1
4+
stdout:
5+
- "Runner reusage is disabled"
6+
- "Caught EXIT - Deregistering runner"
7+
timeout: 10000

0 commit comments

Comments
 (0)