Skip to content

Commit

Permalink
Fix ansible-test docker python version handling.
Browse files Browse the repository at this point in the history
This removes the old name based version detection behavior and
uses versions defined in the docker completion file instead, as
the new containers do not follow the old naming scheme.
  • Loading branch information
mattclay committed Sep 22, 2018
1 parent 18dc928 commit 54937ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
8 changes: 4 additions & 4 deletions test/runner/completion/docker.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
default name=quay.io/ansible/default-test-container:1.2.0
default name=quay.io/ansible/default-test-container:1.2.0 python=3
centos6 name=quay.io/ansible/centos6-test-container:1.4.0 seccomp=unconfined
centos7 name=quay.io/ansible/centos7-test-container:1.4.0 seccomp=unconfined
fedora24 name=quay.io/ansible/fedora24-test-container:1.4.0 seccomp=unconfined
fedora25 name=quay.io/ansible/fedora25-test-container:1.4.0 seccomp=unconfined
fedora26py3 name=quay.io/ansible/fedora26py3-test-container:1.4.0
fedora27py3 name=quay.io/ansible/fedora27py3-test-container:1.4.0
fedora26py3 name=quay.io/ansible/fedora26py3-test-container:1.4.0 python=3
fedora27py3 name=quay.io/ansible/fedora27py3-test-container:1.4.0 python=3
opensuse42.3 name=quay.io/ansible/opensuse42.3-test-container:1.4.0 seccomp=unconfined
ubuntu1404 name=quay.io/ansible/ubuntu1404-test-container:1.4.0 seccomp=unconfined
ubuntu1604 name=quay.io/ansible/ubuntu1604-test-container:1.4.0 seccomp=unconfined
ubuntu1604py3 name=quay.io/ansible/ubuntu1604py3-test-container:1.4.0 seccomp=unconfined
ubuntu1604py3 name=quay.io/ansible/ubuntu1604py3-test-container:1.4.0 seccomp=unconfined python=3
9 changes: 2 additions & 7 deletions test/runner/lib/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
get_available_port,
generate_pip_command,
find_python,
get_docker_completion,
)

from lib.docker_util import (
Expand Down Expand Up @@ -1457,15 +1458,9 @@ def get_integration_docker_filter(args, targets):
display.warning('Excluding tests marked "%s" which require --docker-privileged to run under docker: %s'
% (skip.rstrip('/'), ', '.join(skipped)))

docker_image = args.docker.split('@')[0] # strip SHA for proper tag comparison

python_version = 2 # images are expected to default to python 2 unless otherwise specified

if docker_image.endswith('py3'):
python_version = 3 # docker images ending in 'py3' are expected to default to python 3

if docker_image.endswith(':default'):
python_version = 3 # docker images tagged 'default' are expected to default to python 3
python_version = int(get_docker_completion().get(args.docker_raw).get('python', str(python_version)))

if args.python: # specifying a numeric --python option overrides the default python
if args.python.startswith('3'):
Expand Down

0 comments on commit 54937ba

Please sign in to comment.