diff --git a/test/lib/ansible_test/_internal/commands/coverage/combine.py b/test/lib/ansible_test/_internal/commands/coverage/combine.py index b96e2ba05a8..15334ddaecb 100644 --- a/test/lib/ansible_test/_internal/commands/coverage/combine.py +++ b/test/lib/ansible_test/_internal/commands/coverage/combine.py @@ -67,10 +67,11 @@ def command_coverage_combine(args): :rtype: list[str] """ host_state = prepare_profiles(args) # coverage combine + combine_coverage_files(args, host_state) - if args.delegate: - raise Delegate(host_state) +def combine_coverage_files(args, host_state): # type: (CoverageCombineConfig, HostState) -> t.List[str] + """Combine coverage and return a list of the resulting files.""" if args.delegate: if isinstance(args.controller, (DockerConfig, RemoteConfig)): paths = get_all_coverage_files() diff --git a/test/lib/ansible_test/_internal/commands/coverage/html.py b/test/lib/ansible_test/_internal/commands/coverage/html.py index c4053a631ad..dc520898df7 100644 --- a/test/lib/ansible_test/_internal/commands/coverage/html.py +++ b/test/lib/ansible_test/_internal/commands/coverage/html.py @@ -20,7 +20,7 @@ from ...provisioning import ( ) from .combine import ( - command_coverage_combine, + combine_coverage_files, CoverageCombineConfig, ) @@ -34,7 +34,7 @@ def command_coverage_html(args): :type args: CoverageHtmlConfig """ host_state = prepare_profiles(args) # coverage html - output_files = command_coverage_combine(args) + output_files = combine_coverage_files(args, host_state) for output_file in output_files: if output_file.endswith('-powershell'): diff --git a/test/lib/ansible_test/_internal/commands/coverage/report.py b/test/lib/ansible_test/_internal/commands/coverage/report.py index d5a6ecd8f9a..aa62ac449eb 100644 --- a/test/lib/ansible_test/_internal/commands/coverage/report.py +++ b/test/lib/ansible_test/_internal/commands/coverage/report.py @@ -20,7 +20,7 @@ from ...provisioning import ( ) from .combine import ( - command_coverage_combine, + combine_coverage_files, CoverageCombineConfig, ) @@ -34,7 +34,7 @@ def command_coverage_report(args): :type args: CoverageReportConfig """ host_state = prepare_profiles(args) # coverage report - output_files = command_coverage_combine(args) + output_files = combine_coverage_files(args, host_state) for output_file in output_files: if args.group_by or args.stub: diff --git a/test/lib/ansible_test/_internal/commands/coverage/xml.py b/test/lib/ansible_test/_internal/commands/coverage/xml.py index 6938924029e..1298232f89e 100644 --- a/test/lib/ansible_test/_internal/commands/coverage/xml.py +++ b/test/lib/ansible_test/_internal/commands/coverage/xml.py @@ -38,7 +38,7 @@ from ...provisioning import ( ) from .combine import ( - command_coverage_combine, + combine_coverage_files, CoverageCombineConfig, ) @@ -52,7 +52,7 @@ def command_coverage_xml(args): :type args: CoverageXmlConfig """ host_state = prepare_profiles(args) # coverage xml - output_files = command_coverage_combine(args) + output_files = combine_coverage_files(args, host_state) for output_file in output_files: xml_name = '%s.xml' % os.path.basename(output_file) diff --git a/test/lib/ansible_test/_internal/host_profiles.py b/test/lib/ansible_test/_internal/host_profiles.py index ae33eb07491..2f6884c2c66 100644 --- a/test/lib/ansible_test/_internal/host_profiles.py +++ b/test/lib/ansible_test/_internal/host_profiles.py @@ -369,6 +369,9 @@ class DockerProfile(ControllerHostProfile[DockerConfig], SshTargetHostProfile[Do def deprovision(self): # type: () -> None """Deprovision the host after delegation has completed.""" + if not self.container_name: + return # provision was never called or did not succeed, so there is no container to remove + if self.args.docker_terminate == TerminateMode.ALWAYS or (self.args.docker_terminate == TerminateMode.SUCCESS and self.args.success): docker_rm(self.args, self.container_name)