forked from celestiaorg/celestia-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
node_test.go
45 lines (37 loc) · 842 Bytes
/
node_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
package node
import (
"context"
"strconv"
"testing"
"github.com/stretchr/testify/require"
)
func TestLifecycle(t *testing.T) {
var test = []struct {
tp Type
coreExpected bool
}{
{tp: Bridge, coreExpected: true},
{tp: Full},
{tp: Light},
}
for i, tt := range test {
t.Run(strconv.Itoa(i), func(t *testing.T) {
node := TestNode(t, tt.tp)
require.NotNil(t, node)
require.NotNil(t, node.Config)
require.NotNil(t, node.Host)
require.NotNil(t, node.HeaderServ)
require.NotNil(t, node.StateServ)
require.Equal(t, tt.tp, node.Type)
if tt.coreExpected {
require.NotNil(t, node.CoreClient)
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
err := node.Start(ctx)
require.NoError(t, err)
err = node.Stop(ctx)
require.NoError(t, err)
})
}
}