*: make tests use TempDir(), fix #1319

Simplify things, drop TempFile at the same time (refs. #1764)
This commit is contained in:
Roman Khimov 2021-08-25 22:17:37 +03:00
parent f4ba21a41a
commit 6d074a96e9
16 changed files with 93 additions and 308 deletions

View file

@ -1,8 +1,6 @@
package server
import (
"io/ioutil"
"os"
"path"
"testing"
@ -10,12 +8,7 @@ import (
)
func TestGetPath(t *testing.T) {
testPath, err := ioutil.TempDir("./", "")
require.NoError(t, err)
t.Cleanup(func() {
err := os.RemoveAll(testPath)
require.NoError(t, err)
})
testPath := t.TempDir()
actual, err := getPath(testPath, 123)
require.NoError(t, err)
require.Equal(t, path.Join(testPath, "/BlockStorage_100000/dump-block-1000.json"), actual)