From 0ada0cf525912bf376fff4cd5e733e53fad3f0e3 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Sun, 12 Nov 2017 00:43:16 +0000 Subject: [PATCH] certifiers: test uses WaitForHeight --- certifiers/client/provider.go | 5 +++++ certifiers/client/provider_test.go | 13 ++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/certifiers/client/provider.go b/certifiers/client/provider.go index 6240da11..0c0add6a 100644 --- a/certifiers/client/provider.go +++ b/certifiers/client/provider.go @@ -40,6 +40,11 @@ func NewHTTPProvider(remote string) certifiers.Provider { } } +// StatusClient returns the internal node as a StatusClient +func (p *provider) StatusClient() rpcclient.StatusClient { + return p.node +} + // StoreCommit is a noop, as clients can only read from the chain... func (p *provider) StoreCommit(_ certifiers.FullCommit) error { return nil } diff --git a/certifiers/client/provider_test.go b/certifiers/client/provider_test.go index c63cd6a1..82955c22 100644 --- a/certifiers/client/provider_test.go +++ b/certifiers/client/provider_test.go @@ -1,17 +1,15 @@ -package client_test +package client import ( "testing" - "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - rpctest "github.com/tendermint/tendermint/rpc/test" - "github.com/tendermint/tendermint/certifiers" - "github.com/tendermint/tendermint/certifiers/client" certerr "github.com/tendermint/tendermint/certifiers/errors" + rpcclient "github.com/tendermint/tendermint/rpc/client" + rpctest "github.com/tendermint/tendermint/rpc/test" ) func TestProvider(t *testing.T) { @@ -20,11 +18,12 @@ func TestProvider(t *testing.T) { cfg := rpctest.GetConfig() rpcAddr := cfg.RPC.ListenAddress chainID := cfg.ChainID - p := client.NewHTTPProvider(rpcAddr) + p := NewHTTPProvider(rpcAddr) require.NotNil(t, p) // let it produce some blocks - time.Sleep(500 * time.Millisecond) + err := rpcclient.WaitForHeight(p.(*provider).node, 6, nil) + require.Nil(err) // let's get the highest block seed, err := p.LatestCommit()