Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running unit tests leaves files in /tmp #923

Open
brianphaley opened this issue Jul 3, 2024 · 1 comment
Open

Running unit tests leaves files in /tmp #923

brianphaley opened this issue Jul 3, 2024 · 1 comment

Comments

@brianphaley
Copy link
Contributor

Running the unit tests with 'tox -e py3' creates some temporary test files in /tmp, but doesn't clean-up when done. These are the files:

hotsos-unit-test-juju-bug-lp1852502.txt
hotsos-unit-test-lxcfs-libfuse-deadlock.txt
hotsos-unit-test-oslo-privsep-errors-l3-agent.txt
hotsos-unit-test-oslo-privsep-errors-ovs-agent.txt
hotsos-unit-test-ovs-service-restarts.txt

I traced this back to this change:

commit 8efea48 (tag: 1.16.0)
Author: Edward Hope-Morley [email protected]
Date: Fri Jul 14 14:18:45 2023 +0100

CLI context manager to support returning path

Adds a new CLIHelperFile class that will return a path
to a file containing the output of the command. This
is so that we can stop using mktemp_dump() to dump
contents of command output to a file which is redundant
if the output came from a file in the first place e.g.
with a sosreport.

At least I think that's the one.

I wasn't able to figure this out yet, but you can see an example here that will make sense of this:

hotsos/defs/tests/scenarios/juju/bugs/lp1852502.yaml

And to run just that one test for debugging:

tox -e py3 -- tests.unit.test_juju.TestJujuScenarios.test_yscenario_bugs_lp1852502

@xmkg
Copy link
Contributor

xmkg commented Jul 4, 2024

I think we can use tox's tmp directory({temp_dir}), so tox can automatically do the cleanup for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants