Overhaul httptester support in ansible-test. (#39892)

- Works with the --remote option.
- Can be disabled with the --disable-httptester option.
- Change image with the --httptester option.
- Only load and run httptester for targets that require it.
This commit is contained in:
Matt Clay 2018-05-09 09:24:39 -07:00 committed by GitHub
parent 3c32b483bc
commit c1f9efabf4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 313 additions and 47 deletions

View file

@ -88,7 +88,7 @@ def main():
try:
args.func(config)
except Delegate as ex:
delegate(config, ex.exclude, ex.require)
delegate(config, ex.exclude, ex.require, ex.integration_targets)
display.review_warnings()
except ApplicationWarning as ex:
@ -278,6 +278,7 @@ def parse_args():
config=PosixIntegrationConfig)
add_extra_docker_options(posix_integration)
add_httptester_options(posix_integration, argparse)
network_integration = subparsers.add_parser('network-integration',
parents=[integration],
@ -380,6 +381,7 @@ def parse_args():
add_environments(shell, tox_version=True)
add_extra_docker_options(shell)
add_httptester_options(shell, argparse)
coverage_common = argparse.ArgumentParser(add_help=False, parents=[common])
@ -606,6 +608,29 @@ def add_extra_coverage_options(parser):
help='generate empty report of all python source files')
def add_httptester_options(parser, argparse):
"""
:type parser: argparse.ArgumentParser
:type argparse: argparse
"""
group = parser.add_mutually_exclusive_group()
group.add_argument('--httptester',
metavar='IMAGE',
default='quay.io/ansible/http-test-container:1.0.0',
help='docker image to use for the httptester container')
group.add_argument('--disable-httptester',
dest='httptester',
action='store_const',
const='',
help='do not use the httptester container')
parser.add_argument('--inject-httptester',
action='store_true',
help=argparse.SUPPRESS) # internal use only
def add_extra_docker_options(parser, integration=True):
"""
:type parser: argparse.ArgumentParser
@ -625,11 +650,6 @@ def add_extra_docker_options(parser, integration=True):
if not integration:
return
docker.add_argument('--docker-util',
metavar='IMAGE',
default='quay.io/ansible/http-test-container:1.0.0',
help='docker utility image to provide test services')
docker.add_argument('--docker-privileged',
action='store_true',
help='run docker container in privileged mode')