forked from celestiaorg/celestia-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstore_test.go
50 lines (38 loc) · 894 Bytes
/
store_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package node
import (
"strconv"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestRepo(t *testing.T) {
var tests = []struct {
tp Type
}{
{tp: Bridge}, {tp: Light}, {tp: Full},
}
for i, tt := range tests {
t.Run(strconv.Itoa(i), func(t *testing.T) {
dir := t.TempDir()
_, err := OpenStore(dir)
assert.ErrorIs(t, err, ErrNotInited)
err = Init(dir, tt.tp)
require.NoError(t, err)
store, err := OpenStore(dir)
require.NoError(t, err)
_, err = OpenStore(dir)
assert.ErrorIs(t, err, ErrOpened)
ks, err := store.Keystore()
assert.NoError(t, err)
assert.NotNil(t, ks)
data, err := store.Datastore()
assert.NoError(t, err)
assert.NotNil(t, data)
cfg, err := store.Config()
assert.NoError(t, err)
assert.NotNil(t, cfg)
err = store.Close()
assert.NoError(t, err)
})
}
}