1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Support module tests on a single image. (#16620)

This commit is contained in:
Matt Clay 2016-07-06 23:37:56 -07:00 committed by GitHub
parent 9248cde239
commit fdf22b5a40

View file

@ -47,18 +47,25 @@ def main():
parser = ArgumentParser(description='Generate an integration test script for changed modules.')
parser.add_argument('module_group', choices=['core', 'extras'], help='module group to test')
parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', help='write verbose output to stderr')
parser.add_argument('--image', dest='image', default=os.environ.get('IMAGE'),
help='image to run tests with (default: auto-detect)')
parser.add_argument('--privileged', dest='privileged', action='store_true',
default=os.environ.get('PRIVILEGED') == 'true',
help='run container in privileged mode')
args = parser.parse_args()
jobs = None if args.image is None else ['IMAGE=%s%s' % (args.image, ' PRIVILEGED=true' if args.privileged else '')]
generate_test_commands(args.module_group, targets, verbose=args.verbose)
generate_test_commands(args.module_group, targets, jobs=jobs, verbose=args.verbose)
def generate_test_commands(module_group, targets, verbose=False):
def generate_test_commands(module_group, targets, jobs=None, verbose=False):
"""Generate test commands for the given module group and test targets.
Args:
module_group: The module group (core, extras) to examine.
targets: The test targets to examine.
jobs: The test jobs to execute, or None to auto-detect.
verbose: True to write detailed output to stderr.
"""
@ -110,6 +117,7 @@ def generate_test_commands(module_group, targets, verbose=False):
if verbose:
dump_stderr('use_tags', use_tags)
if jobs is None:
jobs = get_test_jobs(job_config_path)
target = ' '.join(targets)