File tree 2 files changed +4
-20
lines changed
2 files changed +4
-20
lines changed Original file line number Diff line number Diff line change @@ -7,14 +7,12 @@ package db
7
7
8
8
import (
9
9
"context"
10
- "os"
11
10
"testing"
12
11
13
12
"github.com/pkg/errors"
14
13
"github.com/stretchr/testify/require"
15
14
16
15
"github.com/iotexproject/iotex-core/v2/db/batch"
17
- "github.com/iotexproject/iotex-core/v2/testutil"
18
16
)
19
17
20
18
type kvTest struct {
@@ -24,11 +22,7 @@ type kvTest struct {
24
22
25
23
func TestPebbleDB (t * testing.T ) {
26
24
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 ()
32
26
33
27
cfg := DefaultConfig
34
28
cfg .DbPath = testPath
@@ -131,11 +125,7 @@ func TestPebbleDB(t *testing.T) {
131
125
132
126
func TestPebbleDB_Filter (t * testing.T ) {
133
127
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 ()
139
129
140
130
cfg := DefaultConfig
141
131
cfg .DbPath = testPath
@@ -189,11 +179,7 @@ func TestPebbleDB_Filter(t *testing.T) {
189
179
190
180
func TestPebbleDB_Foreach (t * testing.T ) {
191
181
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 ()
197
183
198
184
cfg := DefaultConfig
199
185
cfg .DbPath = testPath
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ package itx
7
7
8
8
import (
9
9
"context"
10
- "os"
11
10
"testing"
12
11
"time"
13
12
@@ -84,8 +83,7 @@ func newConfig(t *testing.T) (config.Config, func()) {
84
83
require .NoError (err )
85
84
contractIndexPath , err := testutil .PathOfTempFile ("contractindxer.db" )
86
85
require .NoError (err )
87
- testActionStorePath , err := os .MkdirTemp (os .TempDir (), "actionstore" )
88
- require .NoError (err )
86
+ testActionStorePath := t .TempDir ()
89
87
cfg := config .Default
90
88
cfg .Genesis = genesis .TestDefault ()
91
89
cfg .API .GRPCPort = testutil .RandomPort ()
You can’t perform that action at this time.
0 commit comments