laconicd/testutil/network/network_test.go
Federico Kunze Küllmer 32c905ab87
tests: integration tests with JSON-RPC client (#704)
* tests: integration tests with JSON-RPC client

* fix package

* tests: networking configuration fixed (#706)

* update testnet hdPath, fixes #688

* lint

* header

* e2e wip

* fix getBlock response

* enable personal API

* changelog

Co-authored-by: Guillermo Paoletti <guillermo.paoletti@gmail.com>
Co-authored-by: Freddy Caceres <freddy.caceres@crypto.com>
2021-11-14 14:34:10 +01:00

49 lines
1.1 KiB
Go

//go:build norace
// +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")
var err error
s.network, err = network.New(s.T(), s.T().TempDir(), network.DefaultConfig())
s.Require().NoError(err)
_, 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))
}