cosmos-sdk/testutil/testnet/nodes_test.go
Mark Rushakoff 68af247459
feat: add testutil/testnet package (#15655)
Co-authored-by: Marko <marbar3778@yahoo.com>
2023-04-05 19:16:45 +00:00

30 lines
673 B
Go

package testnet_test
import (
"testing"
"github.com/cometbft/cometbft/node"
"github.com/cosmos/cosmos-sdk/testutil/testnet"
"github.com/stretchr/testify/require"
)
// Nil entries in a Nodes slice don't fail Stop or Wait.
func TestNodes_StopWaitNil(t *testing.T) {
for _, tc := range []struct {
Name string
Nodes []*node.Node
}{
{Name: "nil slice", Nodes: nil},
{Name: "slice with nil elements", Nodes: []*node.Node{nil}},
} {
ns := testnet.Nodes(tc.Nodes)
t.Run(tc.Name, func(t *testing.T) {
require.NoError(t, ns.Stop())
// Nothing special to assert about Wait().
// It should return immediately, without panicking.
ns.Wait()
})
}
}