mirror of
https://github.com/cirruslabs/tart.git
synced 2026-09-29 18:51:19 +02:00
integration-tests: use HttpWaitStrategy
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
import requests
|
|
||||||
|
|
||||||
from testcontainers.core.waiting_utils import wait_container_is_ready
|
|
||||||
from testcontainers.core.container import DockerContainer
|
from testcontainers.core.container import DockerContainer
|
||||||
|
from testcontainers.core.wait_strategies import HttpWaitStrategy
|
||||||
|
|
||||||
|
|
||||||
class DockerRegistry(DockerContainer):
|
class DockerRegistry(DockerContainer):
|
||||||
@@ -10,11 +8,9 @@ class DockerRegistry(DockerContainer):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__("registry:2")
|
super().__init__("registry:2")
|
||||||
self.with_exposed_ports(self._default_exposed_port)
|
self.with_exposed_ports(self._default_exposed_port)
|
||||||
|
self.waiting_for(HttpWaitStrategy(self._default_exposed_port, "/v2/").for_status_code(200))
|
||||||
|
|
||||||
@wait_container_is_ready(requests.exceptions.ConnectionError)
|
|
||||||
def remote_name(self, for_vm: str):
|
def remote_name(self, for_vm: str):
|
||||||
exposed_port = self.get_exposed_port(self._default_exposed_port)
|
exposed_port = self.get_exposed_port(self._default_exposed_port)
|
||||||
|
|
||||||
requests.get(f"http://127.0.0.1:{exposed_port}/v2/")
|
|
||||||
|
|
||||||
return f"127.0.0.1:{exposed_port}/tart/{for_vm}:latest"
|
return f"127.0.0.1:{exposed_port}/tart/{for_vm}:latest"
|
||||||
|
|||||||
Reference in New Issue
Block a user