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

Graphdriver test cleanups #2228

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

hanwen-flow
Copy link
Contributor

These are a couple of things I saw when perusing the test code.

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]>
Comment on lines 50 to 51
os.RemoveAll(runroot)
os.RemoveAll(root)
Copy link
Contributor

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...
}

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL

Copy link
Contributor

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]>
Copy link
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Contributor

openshift-ci bot commented Jan 30, 2025

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@hanwen-flow
Copy link
Contributor Author

lgtm

thanks! the 'tide' check says that it still needs the 'lgtm' label.

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

Successfully merging this pull request may close these issues.

2 participants