Skip to content

Commit 492f0a5

Browse files
committed
WIP
1 parent fcc2a0a commit 492f0a5

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/ue4docker/test.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import os
33
import sys
44

5+
from docker.errors import ImageNotFound
6+
57
from .infrastructure import (
68
ContainerUtils,
79
DockerUtils,
@@ -22,26 +24,28 @@ def test():
2224
if len(sys.argv) > 1 and sys.argv[1].strip("-") not in ["h", "help"]:
2325
# Verify that the specified container image exists
2426
tag = sys.argv[1]
25-
image = GlobalConfiguration.resolveTag(
27+
image_name = GlobalConfiguration.resolveTag(
2628
"ue4-full:{}".format(tag) if ":" not in tag else tag
2729
)
28-
if not DockerUtils.exists(image):
30+
try:
31+
image = client.images.get(image_name)
32+
except ImageNotFound:
2933
logger.error(
3034
'Error: the specified container image "{}" does not exist.'.format(
31-
image
35+
image_name
3236
)
3337
)
3438
sys.exit(1)
3539

3640
# Use process isolation mode when testing Windows containers, since running Hyper-V containers don't currently support manipulating the filesystem
37-
platform = ImageUtils.image_platform(client, image)
41+
platform = image.attrs["Os"]
3842
isolation = "process" if platform == "windows" else None
3943

4044
# Start a container to run our tests in, automatically stopping and removing the container when we finish
4145
logger.action(
42-
'Starting a container using the "{}" image...'.format(image), False
46+
'Starting a container using the "{}" image...'.format(image_name), False
4347
)
44-
container = ContainerUtils.start_for_exec(client, image, isolation=isolation)
48+
container = ContainerUtils.start_for_exec(client, image_name, isolation=isolation)
4549
with ContainerUtils.automatically_stop(container):
4650
# Create the workspace directory in the container
4751
workspaceDir = ContainerUtils.workspace_dir(container)

0 commit comments

Comments
 (0)