File tree Expand file tree Collapse file tree 2 files changed +4
-20
lines changed
Expand file tree Collapse file tree 2 files changed +4
-20
lines changed Original file line number Diff line number Diff line change @@ -7,14 +7,12 @@ package db
77
88import (
99 "context"
10- "os"
1110 "testing"
1211
1312 "github.com/pkg/errors"
1413 "github.com/stretchr/testify/require"
1514
1615 "github.com/iotexproject/iotex-core/v2/db/batch"
17- "github.com/iotexproject/iotex-core/v2/testutil"
1816)
1917
2018type kvTest struct {
@@ -24,11 +22,7 @@ type kvTest struct {
2422
2523func TestPebbleDB (t * testing.T ) {
2624 r := require .New (t )
27- testPath , err := os .MkdirTemp ("" , "test-pebble" )
28- r .NoError (err )
29- defer func () {
30- testutil .CleanupPath (testPath )
31- }()
25+ testPath := t .TempDir ()
3226
3327 cfg := DefaultConfig
3428 cfg .DbPath = testPath
@@ -131,11 +125,7 @@ func TestPebbleDB(t *testing.T) {
131125
132126func TestPebbleDB_Filter (t * testing.T ) {
133127 r := require .New (t )
134- testPath , err := os .MkdirTemp ("" , "test-pebble" )
135- r .NoError (err )
136- defer func () {
137- testutil .CleanupPath (testPath )
138- }()
128+ testPath := t .TempDir ()
139129
140130 cfg := DefaultConfig
141131 cfg .DbPath = testPath
@@ -189,11 +179,7 @@ func TestPebbleDB_Filter(t *testing.T) {
189179
190180func TestPebbleDB_Foreach (t * testing.T ) {
191181 r := require .New (t )
192- testPath , err := os .MkdirTemp ("" , "test-pebble" )
193- r .NoError (err )
194- defer func () {
195- testutil .CleanupPath (testPath )
196- }()
182+ testPath := t .TempDir ()
197183
198184 cfg := DefaultConfig
199185 cfg .DbPath = testPath
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ package itx
77
88import (
99 "context"
10- "os"
1110 "testing"
1211 "time"
1312
@@ -84,8 +83,7 @@ func newConfig(t *testing.T) (config.Config, func()) {
8483 require .NoError (err )
8584 contractIndexPath , err := testutil .PathOfTempFile ("contractindxer.db" )
8685 require .NoError (err )
87- testActionStorePath , err := os .MkdirTemp (os .TempDir (), "actionstore" )
88- require .NoError (err )
86+ testActionStorePath := t .TempDir ()
8987 cfg := config .Default
9088 cfg .Genesis = genesis .TestDefault ()
9189 cfg .API .GRPCPort = testutil .RandomPort ()
You can’t perform that action at this time.
0 commit comments