tarantool / test-run

Tarantool functional testing framework
14 stars 15 forks source link

Artifact saving fails on a Unix domain socket file #351

Closed Totktonada closed 1 year ago

Totktonada commented 1 year ago

How to reproduce

Clone tarantool, build, patch a test, which creates a Unix domain socket, to make it fail:

diff --git a/test/app-tap/gh-2717-no-quit-sigint.test.lua b/test/app-tap/gh-2717-no-quit-sigint.test.lua
index 21bee27aa..9eba960cf 100755
--- a/test/app-tap/gh-2717-no-quit-sigint.test.lua
+++ b/test/app-tap/gh-2717-no-quit-sigint.test.lua
@@ -265,4 +265,5 @@ test:unlike(ph:info().status.state, popen.state.EXITED,
 ph:shutdown({stdin = true})
 ph:close()

+error('boom')
 os.exit(test:check() and 0 or 1)

Run and see the following error:

Traceback (most recent call last):
  File "/home/alex/projects/tarantool-meta/tarantool/./test/test-run.py", line 344, in <module>
    status = main_parallel()
  File "/home/alex/projects/tarantool-meta/tarantool/./test/test-run.py", line 154, in main_parallel
    res = main_loop_parallel()
  File "/home/alex/projects/tarantool-meta/tarantool/./test/test-run.py", line 133, in main_loop_parallel
    dispatcher.artifacts.save_artifacts()
  File "/home/alex/projects/tarantool-meta/tarantool/test-run/listeners.py", line 219, in save_artifacts
    shutil.copytree(os.path.join(vardir, worker_name),
  File "/usr/lib/python3.10/shutil.py", line 558, in copytree
    return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
  File "/usr/lib/python3.10/shutil.py", line 512, in _copytree
    raise Error(errors)
shutil.Error: [('/tmp/t/001_app-tap/tarantool.soc', '/tmp/t/artifacts/001_app-tap/tarantool.soc', "[Errno 6] No such device or address: '/tmp/t/001_app-tap/tarantool.soc'")]

The important point is to choose a test, which creates a socket, which is not matched by test-run's exclusion mask:

https://github.com/tarantool/test-run/blob/e970cdb735e3c4014a2d172215ffad5470f26a26/listeners.py#L224-L228

The gh-2717-no-quit-sigint.test.lua test creates tarantool.soc socket file.

Thoughts on a fix

The similar problem was fixed for Python 3 in pip using the copy_function argument of shutil.copytree(): https://github.com/pypa/pip/pull/6844. However we can solve it for Python 2 & 3 by converting the ignore argument to a function, which will look at file types.

I would drop the file name mask, it is semi-working.