Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
tests: fix long shutdown times for the webhook_receiver container (cv…
Browse files Browse the repository at this point in the history
…at-ai#5458)

Currently, `server.py` runs as PID 1, which means that it won't be
terminated by a `SIGTERM` signal unless it explicitly handles it (which
it doesn't). So when Docker tries to shut the container down, it sends
the server a `SIGTERM`, which gets ignored, and then sits there for 10
seconds before sending it a `SIGKILL`.

To work around this, enable the built-in Docker init program, which
forwards signals to the Python server. Since the Python server is no
longer PID 1, `SIGTERM` will now shut it down immediately.

The `init` option is supported starting from the Compose format version
3.7, so bump the version.
  • Loading branch information
SpecLad authored and mikhail-treskin committed Jul 1, 2023
1 parent 5f95ec4 commit 5c19fce
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/docker-compose.test_servers.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
version: '3.3'
version: '3.7'

services:
webhook_receiver:
image: python:3.9-slim
restart: always
command: python3 /tmp/server.py
init: true
env_file:
- ./tests/python/webhook_receiver/.env
expose:
Expand Down

0 comments on commit 5c19fce

Please sign in to comment.