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

all: do assorted cleanup, make tests pass #214

Merged
merged 1 commit into from
Dec 14, 2022

Conversation

josharian
Copy link
Contributor

  • add go.sum
  • check error from os.RemoveAll in test
  • make NewNotifyTest and friends handle cleanup
  • use t.TempDir instead of ioutil.TempDir
  • use os.SameFile to test for path equality
  • be more careful about cleaning up test trees
  • remove ioutil

@josharian
Copy link
Contributor Author

This is work done in preparation for #212. I wanted to get all the tests passing before I started altering things, and got sidetracked by stranded test files and code modernization, and one thing led to another, and, well, there's a large PR. Sorry about that.

@rjeczalik
Copy link
Owner

@josharian Can you please squash all the commits into one?

@josharian
Copy link
Contributor Author

Each commit is conceptually standalone, with an appropriate commit message...but if you would prefer, yes, I can squash them. I just wanted to confirm first. :)

Add go.sum to placate cmd/go.

Check error from os.RemoveAll in test.

Make NewNotifyTest and friends handle cleanup.
This way the callers don't need to manage it.
It is also more robust in the face of test failure,
and thus less likely to strand testdata test files.

Use t.TempDir instead of ioutil.TempDir.

Use os.SameFile to test for path equality.
On macOS, the temp dir is located in /var, which can also
have path /private/var. Make the tests resilient to
changes in the exact path name.
With this fix, all tests now pass locally on macOS.

Be more careful about cleaning up test trees.
Fatalf calls runtime.Goexit, which doesn't run deferred funcs.
Remove the defer and just call RemoveAll directly.
This should help prevent stranded testdata dirs on test failure.

Remove ioutil.
It is deprecated.
@josharian
Copy link
Contributor Author

OK, commits squashed down to one.

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

Successfully merging this pull request may close these issues.

2 participants