Add OUTPUT_DIR env var to integration tests.
This commit is contained in:
parent
3e18bbec34
commit
ec88510fd4
1 changed files with 13 additions and 9 deletions
|
@ -786,9 +786,9 @@ def command_integration_filtered(args, targets, all_targets):
|
||||||
make_dirs(test_dir)
|
make_dirs(test_dir)
|
||||||
|
|
||||||
if target.script_path:
|
if target.script_path:
|
||||||
command_integration_script(args, target)
|
command_integration_script(args, target, test_dir)
|
||||||
else:
|
else:
|
||||||
command_integration_role(args, target, start_at_task)
|
command_integration_role(args, target, start_at_task, test_dir)
|
||||||
start_at_task = None
|
start_at_task = None
|
||||||
|
|
||||||
end_time = time.time()
|
end_time = time.time()
|
||||||
|
@ -1010,18 +1010,19 @@ def run_setup_targets(args, test_dir, target_names, targets_dict, targets_execut
|
||||||
make_dirs(test_dir)
|
make_dirs(test_dir)
|
||||||
|
|
||||||
if target.script_path:
|
if target.script_path:
|
||||||
command_integration_script(args, target)
|
command_integration_script(args, target, test_dir)
|
||||||
else:
|
else:
|
||||||
command_integration_role(args, target, None)
|
command_integration_role(args, target, None, test_dir)
|
||||||
|
|
||||||
targets_executed.add(target_name)
|
targets_executed.add(target_name)
|
||||||
|
|
||||||
|
|
||||||
def integration_environment(args, target, cmd):
|
def integration_environment(args, target, cmd, test_dir):
|
||||||
"""
|
"""
|
||||||
:type args: IntegrationConfig
|
:type args: IntegrationConfig
|
||||||
:type target: IntegrationTarget
|
:type target: IntegrationTarget
|
||||||
:type cmd: list[str]
|
:type cmd: list[str]
|
||||||
|
:type test_dir: str
|
||||||
:rtype: dict[str, str]
|
:rtype: dict[str, str]
|
||||||
"""
|
"""
|
||||||
env = ansible_environment(args)
|
env = ansible_environment(args)
|
||||||
|
@ -1035,6 +1036,7 @@ def integration_environment(args, target, cmd):
|
||||||
JUNIT_OUTPUT_DIR=os.path.abspath('test/results/junit'),
|
JUNIT_OUTPUT_DIR=os.path.abspath('test/results/junit'),
|
||||||
ANSIBLE_CALLBACK_WHITELIST='junit',
|
ANSIBLE_CALLBACK_WHITELIST='junit',
|
||||||
ANSIBLE_TEST_CI=args.metadata.ci_provider,
|
ANSIBLE_TEST_CI=args.metadata.ci_provider,
|
||||||
|
OUTPUT_DIR=test_dir,
|
||||||
)
|
)
|
||||||
|
|
||||||
if args.debug_strategy:
|
if args.debug_strategy:
|
||||||
|
@ -1056,10 +1058,11 @@ def integration_environment(args, target, cmd):
|
||||||
return env
|
return env
|
||||||
|
|
||||||
|
|
||||||
def command_integration_script(args, target):
|
def command_integration_script(args, target, test_dir):
|
||||||
"""
|
"""
|
||||||
:type args: IntegrationConfig
|
:type args: IntegrationConfig
|
||||||
:type target: IntegrationTarget
|
:type target: IntegrationTarget
|
||||||
|
:type test_dir: str
|
||||||
"""
|
"""
|
||||||
display.info('Running %s integration test script' % target.name)
|
display.info('Running %s integration test script' % target.name)
|
||||||
|
|
||||||
|
@ -1068,17 +1071,18 @@ def command_integration_script(args, target):
|
||||||
if args.verbosity:
|
if args.verbosity:
|
||||||
cmd.append('-' + ('v' * args.verbosity))
|
cmd.append('-' + ('v' * args.verbosity))
|
||||||
|
|
||||||
env = integration_environment(args, target, cmd)
|
env = integration_environment(args, target, cmd, test_dir)
|
||||||
cwd = target.path
|
cwd = target.path
|
||||||
|
|
||||||
intercept_command(args, cmd, target_name=target.name, env=env, cwd=cwd)
|
intercept_command(args, cmd, target_name=target.name, env=env, cwd=cwd)
|
||||||
|
|
||||||
|
|
||||||
def command_integration_role(args, target, start_at_task):
|
def command_integration_role(args, target, start_at_task, test_dir):
|
||||||
"""
|
"""
|
||||||
:type args: IntegrationConfig
|
:type args: IntegrationConfig
|
||||||
:type target: IntegrationTarget
|
:type target: IntegrationTarget
|
||||||
:type start_at_task: str | None
|
:type start_at_task: str | None
|
||||||
|
:type test_dir: str
|
||||||
"""
|
"""
|
||||||
display.info('Running %s integration test role' % target.name)
|
display.info('Running %s integration test role' % target.name)
|
||||||
|
|
||||||
|
@ -1138,7 +1142,7 @@ def command_integration_role(args, target, start_at_task):
|
||||||
if args.verbosity:
|
if args.verbosity:
|
||||||
cmd.append('-' + ('v' * args.verbosity))
|
cmd.append('-' + ('v' * args.verbosity))
|
||||||
|
|
||||||
env = integration_environment(args, target, cmd)
|
env = integration_environment(args, target, cmd, test_dir)
|
||||||
cwd = 'test/integration'
|
cwd = 'test/integration'
|
||||||
|
|
||||||
env['ANSIBLE_ROLES_PATH'] = os.path.abspath('test/integration/targets')
|
env['ANSIBLE_ROLES_PATH'] = os.path.abspath('test/integration/targets')
|
||||||
|
|
Loading…
Reference in a new issue