*: fix all errcheck warnings in testing code

This commit is contained in:
Roman Khimov 2021-05-12 21:34:07 +03:00
parent 0500c8f9d7
commit e9cefc4bfc
12 changed files with 78 additions and 52 deletions

View file

@ -62,9 +62,11 @@ func TestHandleLoggingParams(t *testing.T) {
func TestInitBCWithMetrics(t *testing.T) {
d, err := ioutil.TempDir("./", "")
require.NoError(t, err)
os.Chdir(d)
err = os.Chdir(d)
require.NoError(t, err)
t.Cleanup(func() {
os.Chdir("..")
err = os.Chdir("..")
require.NoError(t, err)
os.RemoveAll(d)
})
@ -91,9 +93,11 @@ func TestDumpDB(t *testing.T) {
t.Run("too low chain", func(t *testing.T) {
d, err := ioutil.TempDir("./", "")
require.NoError(t, err)
os.Chdir(d)
err = os.Chdir(d)
require.NoError(t, err)
t.Cleanup(func() {
os.Chdir("..")
err = os.Chdir("..")
require.NoError(t, err)
os.RemoveAll(d)
})
testDump := "file.acc"
@ -112,9 +116,11 @@ func TestDumpDB(t *testing.T) {
t.Run("positive", func(t *testing.T) {
d, err := ioutil.TempDir("./", "")
require.NoError(t, err)
os.Chdir(d)
err = os.Chdir(d)
require.NoError(t, err)
t.Cleanup(func() {
os.Chdir("..")
err = os.Chdir("..")
require.NoError(t, err)
os.RemoveAll(d)
})
testDump := "file.acc"
@ -136,9 +142,11 @@ func TestRestoreDB(t *testing.T) {
require.NoError(t, err)
testDump := "file1.acc"
saveDump := "file2.acc"
os.Chdir(d)
err = os.Chdir(d)
require.NoError(t, err)
t.Cleanup(func() {
os.Chdir("..")
err = os.Chdir("..")
require.NoError(t, err)
os.RemoveAll(d)
})