action #69133
os-autoinst self-tests fail to remove tempdir on test failure
Start date:
2020-07-20
Due date:
% Done:
0%
Estimated time:
Difficulty:
easy
Description
Observation¶
Running 99-full-stack.t when it fails I observe an error like the following:
# Failed test 'Result in testresults/result-reload_needles.json is ok' # at 99-full-stack.t line 82. # got: 'fail' # expected: 'ok' Bailout called. Further testing stopped: testresults/result-reload_needles.json failed cannot remove path when cwd is /tmp/99-full-stack.t-KMSs/pool for /tmp/99-full-stack.t-KMSs: at /usr/lib/perl5/5.26.1/File/Temp.pm line 1616.
so the temporary directory can not be removed in this case
Acceptance criteria¶
- AC1: No error about failing to remove the temporary directory if the test fails
- AC2: No error about failing to remove the temporary directory if no tests fail
- AC3: The temporary directory is removed after the test exits regardless of the result (fail or pass)
Suggestions¶
- Reproduce the failure locally, e.g. with an artificial error within t/99-full-stack.t in os-autoinst
- Compare how we handle the temporary directory within other test modules within os-autoinst as well as openQA
- Apply a fix and where necessary enhance all other uses of the temp dir in both os-autoinst and openQA
History
#3
Updated by tinita 6 months ago
If possible, just make sure the current working directory is changed before the bail out.
OTOH I think BAIL_OUT should be avoided and only called if things go really wrong. In that case it is IMHO not that important that all tmp files are removed. They are tmp files after all.
#5
Updated by kraih 6 months ago
Yes, it was that simple. A few other tests had the same problem. https://github.com/os-autoinst/os-autoinst/pull/1495