Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new default Docker container for ansible-test. #31944

Merged
merged 4 commits into from
Oct 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions test/runner/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*
!docker
!requirements
39 changes: 39 additions & 0 deletions test/runner/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM ubuntu:16.04

COPY docker/deadsnakes.list /etc/apt/sources.list.d/deadsnakes.list

RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F23C5A6CF475977595C89F51BA6932366A755776

RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
gcc \
git \
libffi-dev \
libxml2-dev \
libxslt1-dev \
locales \
make \
python2.6-dev \
python2.7-dev \
python3.5-dev \
python3.6-dev \
shellcheck \
&& \
apt-get clean

RUN rm /etc/apt/apt.conf.d/docker-clean
RUN locale-gen en_US.UTF-8
VOLUME /sys/fs/cgroup /run/lock /run /tmp

ADD https://bootstrap.pypa.io/get-pip.py /tmp/get-pip.py

COPY requirements/*.txt /tmp/requirements/
COPY docker/requirements.sh /tmp/
RUN cd /tmp/requirements && /tmp/requirements.sh

RUN ln -s python2.7 /usr/bin/python2
RUN ln -s python3.6 /usr/bin/python3
RUN ln -s python3 /usr/bin/python

ENV container=docker
CMD ["/sbin/init"]
2 changes: 2 additions & 0 deletions test/runner/docker/deadsnakes.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu xenial main
deb-src http://ppa.launchpad.net/deadsnakes/ppa/ubuntu xenial main
23 changes: 23 additions & 0 deletions test/runner/docker/requirements.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash -eu

python_versions=(
2.6
2.7
3.5
3.6
)

requirements=()

for requirement in *.txt; do
if [ "${requirement}" != "constraints.txt" ]; then
requirements+=("-r" "${requirement}")
fi
done

for python_version in "${python_versions[@]}"; do
set -x
"python${python_version}" /tmp/get-pip.py -c constraints.txt
"pip${python_version}" install --disable-pip-version-check -c constraints.txt "${requirements[@]}"
set +x
done
29 changes: 29 additions & 0 deletions test/runner/lib/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,9 @@ def _classify(self, path):

test_path = os.path.dirname(test_path)

if path.startswith('test/runner/docker/'):
return minimal # not used by tests, only used to build the default container

if path.startswith('test/runner/lib/cloud/'):
cloud_target = 'cloud/%s/' % name

Expand All @@ -476,6 +479,32 @@ def _classify(self, path):
'sanity': 'all', # test infrastructure, run all sanity checks
}

if path.startswith('test/runner/requirements/'):
if name in (
'integration',
'network-integration',
'windows-integration',
):
return {
name: self.integration_all_target,
}

if name in (
'sanity',
'units',
):
return {
name: 'all',
}

if name.startswith('integration.cloud.'):
cloud_target = 'cloud/%s/' % name.split('.')[2]

if cloud_target in self.integration_targets_by_alias:
return {
'integration': cloud_target,
}

if path.startswith('test/runner/'):
return all_tests(self.args) # test infrastructure, run all tests

Expand Down
2 changes: 1 addition & 1 deletion test/runner/lib/sanity/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def command_sanity(args):
if isinstance(test, SanityMultipleVersion):
versions = SUPPORTED_PYTHON_VERSIONS
else:
versions = None,
versions = (None,)

for version in versions:
if args.python and version and version != args.python:
Expand Down
3 changes: 2 additions & 1 deletion test/runner/requirements/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
coverage >= 4.2, != 4.3.2 # features in 4.2+ required, avoid known bug in 4.3.2 on python 2.6
pywinrm >= 0.2.1 # 0.1.1 required, but 0.2.1 provides better performance
pylint >= 1.5.3, < 1.7.0 # 1.4.1 adds JSON output, but 1.5.3 fixes bugs related to JSON output
pylint == 1.7.4 ; python_version >= '3.5' # versions before 1.7.1 hang or fail to install on python 3.x
pylint == 1.6.5 ; python_version <= '2.7' # versions after 1.6.5 hang or fail during test on python 2.x
sphinx < 1.6 ; python_version < '2.7' # sphinx 1.6 and later require python 2.7 or later
wheel < 0.30.0 ; python_version < '2.7' # wheel 0.30.0 and later require python 2.7 or later
yamllint != 1.8.0 ; python_version < '2.7' # yamllint 1.8.0 requires python 2.7+ while earlier/later versions do not
Expand Down
2 changes: 1 addition & 1 deletion test/runner/requirements/sanity.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ jinja2
mock
paramiko
pycodestyle
pylint
pylint ; python_version >= '2.7' # pylint 1.5.3+ is required for non-buggy JSON output, but 1.4+ requires python 2.7+
pytest
rstcheck
sphinx
Expand Down
15 changes: 15 additions & 0 deletions test/sanity/pylint/disable.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ blacklisted-name
broad-except
cell-var-from-loop
consider-iterating-dictionary
consider-merging-isinstance
consider-using-enumerate
consider-using-ternary
deprecated-lambda
deprecated-method
deprecated-module
Expand All @@ -29,11 +31,16 @@ global-variable-undefined
import-error
import-self
invalid-name
invalid-sequence-index
invalid-unary-operand-type
len-as-condition
line-too-long
literal-comparison
locally-disabled
method-hidden
misplaced-comparison-constant
missing-docstring
no-else-return
no-init
no-member
no-name-in-module
Expand All @@ -47,11 +54,14 @@ old-style-class
pointless-statement
pointless-string-statement
protected-access
pylint
redefined-argument-from-local
redefined-builtin
redefined-outer-name
redefined-variable-type
reimported
relative-import
signature-differs
simplifiable-if-statement
super-init-not-called
superfluous-parens
Expand All @@ -68,17 +78,22 @@ too-many-nested-blocks
too-many-public-methods
too-many-return-statements
too-many-statements
trailing-comma-tuple
unbalanced-tuple-unpacking
undefined-loop-variable
ungrouped-imports
unidiomatic-typecheck
unneeded-not
unsubscriptable-object
unsupported-assignment-operation
unsupported-delete-operation
unsupported-membership-test
unused-argument
unused-import
unused-variable
unused-wildcard-import
used-before-assignment
useless-super-delegation
wildcard-import
wrong-import-order
wrong-import-position