tests: fix potential infinite wait in tests spinning up a container (#7153)

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens L
2023-10-12 13:57:29 +02:00
committed by GitHub
parent 6d1eef039e
commit abab635a01
7 changed files with 37 additions and 52 deletions

View File

@ -1,7 +1,6 @@
"""outpost tests"""
from shutil import rmtree
from tempfile import mkdtemp
from time import sleep
import yaml
from channels.testing.live import ChannelsLiveServerTestCase
@ -20,10 +19,10 @@ from authentik.outposts.models import (
from authentik.outposts.tasks import outpost_connection_discovery
from authentik.providers.proxy.controllers.docker import DockerController
from authentik.providers.proxy.models import ProxyProvider
from tests.e2e.utils import get_docker_tag
from tests.e2e.utils import DockerTestCase, get_docker_tag
class TestProxyDocker(ChannelsLiveServerTestCase):
class TestProxyDocker(DockerTestCase, ChannelsLiveServerTestCase):
"""Test Docker Controllers"""
def _start_container(self, ssl_folder: str) -> Container:
@ -45,12 +44,8 @@ class TestProxyDocker(ChannelsLiveServerTestCase):
}
},
)
while True:
container.reload()
status = container.attrs.get("State", {}).get("Health", {}).get("Status")
if status == "healthy":
return container
sleep(1)
self.wait_for_container(container)
return container
def setUp(self):
super().setUp()