Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,28 @@ jobs:
env:
BASE_URL: http://127.0.0.1:8730

- name: Stop and restart the container
run: |
before=$(sha256sum "$RUNNER_TEMP/data/apps.json")
docker stop -t 30 stackyard-e2e
code=$(docker inspect -f '{{.State.ExitCode}}' stackyard-e2e)
echo "stopped with exit code ${code}"
if [ "$code" = 137 ]; then
echo "::error::the container ignored SIGTERM and was killed"
exit 1
fi
docker start stackyard-e2e
for i in $(seq 1 60); do
if curl -fsS http://127.0.0.1:8730/health >/dev/null 2>&1; then echo "up again after ${i}s"; break; fi
if [ "$i" = 60 ]; then echo "::error::the container never became healthy after a restart"; exit 1; fi
sleep 1
done
after=$(sha256sum "$RUNNER_TEMP/data/apps.json")
if [ "$before" != "$after" ]; then
echo "::error::the restart changed the saved config"
exit 1
fi

- name: Container logs on failure
if: failure()
run: docker logs stackyard-e2e
Expand Down
15 changes: 15 additions & 0 deletions test/repo/release-workflow.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,21 @@ test('the e2e workflow can be called, and still runs on its own', () => {
);
});

test('the e2e workflow stops and restarts the built image after the specs', () => {
const e2e = yaml.load(fs.readFileSync(path.join(root, '.github/workflows/e2e.yml'), 'utf8'));
const e2eSteps = Object.values(e2e.jobs)[0].steps;
const at = e2eSteps.findIndex(s => s.name === 'Stop and restart the container');
assert.ok(
at > e2eSteps.findIndex(s => s.name === 'Run the specs'),
'the restart must run on the config the specs saved',
);
const run = e2eSteps[at].run;
assert.match(run, /docker stop -t \d+ stackyard-e2e/);
assert.match(run, /"\$code" = 137/, 'a container killed after the stop timeout must fail the job');
assert.match(run, /docker start stackyard-e2e/);
assert.match(run, /"\$before" != "\$after"/, 'the restart must leave the saved config as it was');
});

/* Every other gate reads a locally built copy. These pin the checks that read
the published image, and that nothing announces a release before they pass. */

Expand Down
Loading