From 7b13216e2d423744d321ba0f94ef05e89402c336 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Fri, 16 Dec 2022 15:25:07 +0300 Subject: [PATCH] tests: fix long shutdown times for the webhook_receiver container (#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. --- tests/docker-compose.test_servers.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/docker-compose.test_servers.yml b/tests/docker-compose.test_servers.yml index 27f3c2c8..c27d0a05 100644 --- a/tests/docker-compose.test_servers.yml +++ b/tests/docker-compose.test_servers.yml @@ -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: