From a0951721306cfdbfd7deb9b0e9c929c148552591 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Thu, 9 Apr 2020 15:06:12 -0700 Subject: [PATCH] Fix ansible-test --docker without tests dir. --- changelogs/fragments/ansible-test-test-no-tests.yml | 2 ++ test/lib/ansible_test/_internal/delegation.py | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 changelogs/fragments/ansible-test-test-no-tests.yml diff --git a/changelogs/fragments/ansible-test-test-no-tests.yml b/changelogs/fragments/ansible-test-test-no-tests.yml new file mode 100644 index 00000000000..8508ce29152 --- /dev/null +++ b/changelogs/fragments/ansible-test-test-no-tests.yml @@ -0,0 +1,2 @@ +bugfixes: + - ansible-test no longer fails when downloading test results for a collection without a ``tests`` directory when using the ``--docker`` option. diff --git a/test/lib/ansible_test/_internal/delegation.py b/test/lib/ansible_test/_internal/delegation.py index d66b0d10b96..6cae52f651e 100644 --- a/test/lib/ansible_test/_internal/delegation.py +++ b/test/lib/ansible_test/_internal/delegation.py @@ -9,6 +9,10 @@ import tempfile from . import types as t +from .io import ( + make_dirs, +) + from .executor import ( SUPPORTED_PYTHON_VERSIONS, HTTPTESTER_HOSTS, @@ -363,6 +367,8 @@ def delegate_docker(args, exclude, require, integration_targets): remote_results_name = os.path.basename(remote_results_root) remote_temp_file = os.path.join('/root', remote_results_name + '.tgz') + make_dirs(local_test_root) # make sure directory exists for collections which have no tests + with tempfile.NamedTemporaryFile(prefix='ansible-result-', suffix='.tgz') as local_result_fd: docker_exec(args, test_id, ['tar', 'czf', remote_temp_file, '--exclude', ResultType.TMP.name, '-C', remote_test_root, remote_results_name]) docker_get(args, test_id, remote_temp_file, local_result_fd.name)