Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

unit-test: cleaning up stale files under /tmp #2398

Closed
Pennyzct opened this issue Jan 17, 2020 · 0 comments
Closed

unit-test: cleaning up stale files under /tmp #2398

Pennyzct opened this issue Jan 17, 2020 · 0 comments
Labels
enhancement Improvement to an existing feature needs-review Needs to be assessed by the team. wip Work in Progress (PR incomplete - needs more work or rework)

Comments

@Pennyzct
Copy link
Contributor

I've found a few unit tests which were generating stale files under /tmp

- Using defer in TestMain.
os.Exit will skip all deferred instructions.
So we should reconstruct TestMain to leave all setup-related code in setup(), and all cleanup-related code in shutdown().

- Missing deleting what ioutil.TempDir() creates
Normally, ioutil.TempDir will create a new temporary dir under /tmp.

PR is on the fly~~~~

@Pennyzct Pennyzct added enhancement Improvement to an existing feature needs-review Needs to be assessed by the team. labels Jan 17, 2020
Pennyzct added a commit to Pennyzct/runtime that referenced this issue Jan 17, 2020
Normally, ioutil.TempDir will create a new temporary
dir under /tmp.
And we should do cleaning up after ioutil.TempDir().

Fixes: kata-containers#2398

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
@Pennyzct Pennyzct added the wip Work in Progress (PR incomplete - needs more work or rework) label Jan 17, 2020
Pennyzct added a commit to Pennyzct/runtime that referenced this issue Jan 17, 2020
ioutil.TempFile creates a new temporary file in the directory dir.
It is the caller's responsibility to remove the file
when no longer needed.

Fixes: kata-containers#2398

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
@devimc devimc closed this as completed in aa62781 Jan 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Improvement to an existing feature needs-review Needs to be assessed by the team. wip Work in Progress (PR incomplete - needs more work or rework)
Projects
None yet
Development

No branches or pull requests

1 participant