Skip to content

Commit

Permalink
Adjustments to the docker testing engine
Browse files Browse the repository at this point in the history
  • Loading branch information
CheeseCake87 committed Oct 31, 2023
1 parent fabe057 commit 7642906
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions docker_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def build_docker(tag_, file_):


def create_docker(tag_):
with DockerCli(f"create --name {tag_} {tag_}") as output_:
print(f"create --name {tag_} {tag_}")
with DockerCli(f"create --name {tag_.replace(':latest', '')} {tag_}") as output_:
print(f"create --name {tag_.replace(':latest', '')} {tag_}")
_ = output_


Expand All @@ -54,12 +54,8 @@ def start_docker(tag_):


build_pool = multiprocessing.Pool()
create_pool = multiprocessing.Pool()
start_pool = multiprocessing.Pool()

running_builds = []
running_creates = []
running_starts = []

print("Building test environments, please wait...")

Expand All @@ -75,34 +71,26 @@ def start_docker(tag_):

for tag, file in tags.items():
if tag in enabled_tags:
p_create = create_pool.apply_async(create_docker, args=(tag,))
running_creates.append(p_create)

for pro in running_creates:
pro.wait()
create_docker(tag.replace(':latest', ''))

print("Running test environments, please wait...")

for tag, file in tags.items():
if tag in enabled_tags:
p_starts = start_pool.apply_async(start_docker, args=(tag,))
running_starts.append(p_starts)

for pro in running_starts:
pro.wait()
start_docker(tag.replace(':latest', ''))

print("Gathering logs, please wait...")
for tag in tags:
if tag in enabled_tags:
get_logs(tag)
get_logs(tag.replace(':latest', ''))

cleanup_input = input("Do you want to cleanup? (Y/n): ")

if cleanup_input.lower() != "n":
print("Cleaning up, please wait...")
for tag in tags:
if tag in enabled_tags:
with DockerCli(f"rm {tag}") as output:
with DockerCli(f"rm {tag.replace(':latest', '')}") as output:
_ = output

for tag in tags:
Expand Down

0 comments on commit 7642906

Please sign in to comment.