From f9fbaea815dc64690251617c29d1d4c732bbed9f Mon Sep 17 00:00:00 2001 From: wonkuk_seo Date: Wed, 12 May 2021 16:56:47 +0900 Subject: [PATCH] test: Allow to add new validator in test network (#193) --- testutil/network/network.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/testutil/network/network.go b/testutil/network/network.go index 28924a593b..5c390569f3 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -403,6 +403,17 @@ func NewWithoutInit(t *testing.T, cfg Config, baseDir string, validators []*Vali return network } +func AddNewValidator(t *testing.T, network *Network, validator *Validator) { + t.Log("adding new validator") + + require.NoError(t, startInProcess(network.Config, validator)) + network.Validators = append(network.Validators, validator) + + t.Log("added new validator") + + server.TrapSignal(network.Cleanup) +} + // LatestHeight returns the latest height of the network or an error if the // query fails or no validators exist. func (n *Network) LatestHeight() (int64, error) {