-
Notifications
You must be signed in to change notification settings - Fork 251
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
Graphdriver test cleanups #2228
base: main
Are you sure you want to change the base?
Conversation
os.MkdirTemp() already creates the directory. Signed-off-by: Han-Wen Nienhuys <[email protected]>
Introduce GetDriverNoCleanup to obtain an instance that should survive individual test cases. Signed-off-by: Han-Wen Nienhuys <[email protected]>
7c30b8a
to
1cd2a64
Compare
drivers/graphtest/graphtest_unix.go
Outdated
os.RemoveAll(runroot) | ||
os.RemoveAll(root) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the correct way is to call os.RemoveAll
in the same function which calls MkdirTemp
, i.e. newDriver
.
In there, you can do something like
if t.Failed() || t.Skipped() {
os.RemoveAll...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, that won't work.
In any case, it would be better to place the cleanup into the same function as the setup, and it might require some refactoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this looks good and is actually working (I was wrong it won't), thanks!
In the default ('go test'), the /tmp/ is typically not on btrfs, and running the test leaves the temp dirs in place. Signed-off-by: Han-Wen Nienhuys <[email protected]>
Signed-off-by: Han-Wen Nienhuys <[email protected]>
1cd2a64
to
193d890
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hanwen-flow, kolyshkin The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
thanks! the 'tide' check says that it still needs the 'lgtm' label. |
These are a couple of things I saw when perusing the test code.