Skip to content

Commit

Permalink
Backward compatibility with docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
pomo-mondreganto committed Jan 15, 2022
1 parent c2a2ae1 commit ad849ed
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/wait_for_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,17 @@

DOCKER_COMPOSE_FILE = 'docker-compose-tests.yml'
INITIALIZER_CONTAINER_NAME = 'forcad-initializer-1'
INITIALIZER_CONTAINER_NAME_OLD = 'forcad_initializer_1'


def wait_for_container(name):
def wait_for_initializer():
# Docker Compose broke compatibility in container naming.
out = subprocess.check_output(['docker', 'ps', '-a']).decode()
if INITIALIZER_CONTAINER_NAME in out:
name = INITIALIZER_CONTAINER_NAME
else:
name = INITIALIZER_CONTAINER_NAME_OLD

print(f'Waiting for container {name}')
command = ['docker', 'wait', name]
result = int(subprocess.check_output(command).decode().strip())
Expand All @@ -27,7 +35,7 @@ def wait_for_container(name):


def wait_all():
wait_for_container(INITIALIZER_CONTAINER_NAME)
wait_for_initializer()
wait_rounds(3)


Expand Down

0 comments on commit ad849ed

Please sign in to comment.