diff options
author | Matt Clay <matt@mystile.com> | 2020-04-09 15:06:12 -0700 |
---|---|---|
committer | Matt Clay <matt@mystile.com> | 2020-04-09 18:12:21 -0700 |
commit | a0951721306cfdbfd7deb9b0e9c929c148552591 (patch) | |
tree | c89f72805b16f9cfe9de227d41b5b34d48f096d9 | |
parent | d86d20a378ef10fbcdff5174f58e4c94246f8aab (diff) | |
download | ansible-a0951721306cfdbfd7deb9b0e9c929c148552591.tar.gz |
Fix ansible-test --docker without tests dir.
-rw-r--r-- | changelogs/fragments/ansible-test-test-no-tests.yml | 2 | ||||
-rw-r--r-- | test/lib/ansible_test/_internal/delegation.py | 6 |
2 files changed, 8 insertions, 0 deletions
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 0000000000..8508ce2915 --- /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 d66b0d10b9..6cae52f651 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) |