nats-server icon indicating copy to clipboard operation
nats-server copied to clipboard

Use testing.TempDir() where possible

Open mprimi opened this issue 1 year ago • 1 comments

Rather than relying on manual deferred cleanup of files, switch most tests to use testing.TempDir() which is automatically cleaned up.

  • [ ] Link to issue, e.g. Resolves #NNN
  • [ ] Documentation added (if applicable)
  • [x] Tests added
  • [x] Branch rebased on top of current main (git pull --rebase origin main)
  • [x] Changes squashed to a single commit (described here)
  • [ ] Build is green in Travis CI
  • [x] You have certified that the contribution is your original work and that you license the work to the project under the Apache 2 license

Resolves #

Changes proposed in this pull request:

  • Change test utility methods to use testing.TempDir()
  • Remove (now superfluous) deferred directory and file cleanup

/cc @nats-io/core

mprimi avatar Sep 06 '22 04:09 mprimi

@kozlovic holding until after 2.9 sounds good (PR is still marked draft, I only opened to see if Travis would surface any error I wasn't seeing locally (it did, fixed)

mprimi avatar Sep 06 '22 16:09 mprimi