Skip to content

Commit 738eb34

Browse files
committed
Implement loop
Signed-off-by: Friedrich Gonzalez <1517449+friedrichg@users.noreply.github.com>
1 parent b0563e6 commit 738eb34

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

‎tools/packaging/test-packages‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,17 @@ function test_with_systemd() {
5151
container=$(docker run --platform="${platform}" --privileged --cgroupns=host --tmpfs /run --tmpfs /run/lock -v /sys/fs/cgroup:/sys/fs/cgroup:rw -td -v "$(pwd)"/dist:/opt/cortex -v "$(pwd)"/docs/configuration:/opt/config:ro -p 9009 "${image}")
5252
CONTAINERS+=("${container}")
5353

54-
# Wait briefly for systemd to initialize and verify container is running
55-
sleep 2
56-
if ! docker inspect --format='{{.State.Running}}' "${container}" | grep -q true; then
54+
# Wait for container to be running (timeout 10 seconds)
55+
timeout=10
56+
while [ $timeout -gt 0 ]; do
57+
if docker inspect --format='{{.State.Running}}' "${container}" | grep -q true; then
58+
break
59+
fi
60+
sleep 1
61+
timeout=$((timeout - 1))
62+
done
63+
64+
if [ $timeout -eq 0 ]; then
5765
echo "Container failed to start:"
5866
docker logs "${container}" || true
5967
error "Container ${container} is not running"

0 commit comments

Comments
 (0)