laconicd/testutil/network/network_test.go

47 lines
1.0 KiB
Go
Raw Normal View History

// +build norace
package network_test
import (
"testing"
"time"
"github.com/stretchr/testify/suite"
"github.com/tharsis/ethermint/testutil/network"
)
type IntegrationTestSuite struct {
suite.Suite
network *network.Network
}
func (s *IntegrationTestSuite) SetupSuite() {
s.T().Log("setting up integration test suite")
s.network = network.New(s.T(), network.DefaultConfig())
s.Require().NotNil(s.network)
_, err := s.network.WaitForHeight(1)
s.Require().NoError(err)
}
func (s *IntegrationTestSuite) TearDownSuite() {
s.T().Log("tearing down integration test suite")
s.network.Cleanup()
}
func (s *IntegrationTestSuite) TestNetwork_Liveness() {
h, err := s.network.WaitForHeightWithTimeout(10, time.Minute)
s.Require().NoError(err, "expected to reach 10 blocks; got %d", h)
latestHeight, err := s.network.LatestHeight()
s.Require().NoError(err, "latest height failed")
s.Require().GreaterOrEqual(latestHeight, h)
}
func TestIntegrationTestSuite(t *testing.T) {
suite.Run(t, new(IntegrationTestSuite))
}