From 017f60d086a9491a825516842be0577e41ed4e8f Mon Sep 17 00:00:00 2001 From: Vilius Pranckaitis Date: Mon, 1 Mar 2021 19:26:47 +1100 Subject: [PATCH] [tests] Update peer bootstrapper new cluster integration test (#3282) --- src/dbnode/integration/integration.go | 2 +- .../peers_bootstrap_none_available_test.go | 33 +++++++------------ 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/src/dbnode/integration/integration.go b/src/dbnode/integration/integration.go index d2011f1efe..952c9d4fe0 100644 --- a/src/dbnode/integration/integration.go +++ b/src/dbnode/integration/integration.go @@ -256,7 +256,7 @@ func NewDefaultBootstrappableTestSetups( // nolint:gocyclo case bootstrapper.NoOpNoneBootstrapperName: finalBootstrapper = bootstrapper.NewNoOpNoneBootstrapperProvider() case uninitialized.UninitializedTopologyBootstrapperName: - uninitialized.NewUninitializedTopologyBootstrapperProvider( + finalBootstrapper = uninitialized.NewUninitializedTopologyBootstrapperProvider( uninitialized.NewOptions(). SetInstrumentOptions(instrumentOpts), nil) default: diff --git a/src/dbnode/integration/peers_bootstrap_none_available_test.go b/src/dbnode/integration/peers_bootstrap_none_available_test.go index 149f78f90e..aab492547d 100644 --- a/src/dbnode/integration/peers_bootstrap_none_available_test.go +++ b/src/dbnode/integration/peers_bootstrap_none_available_test.go @@ -23,10 +23,10 @@ package integration import ( - "sync" "testing" "time" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/m3db/m3/src/cluster/services" @@ -34,7 +34,7 @@ import ( "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" "github.com/m3db/m3/src/dbnode/sharding" - "github.com/m3db/m3/src/dbnode/storage/bootstrap/bootstrapper" + "github.com/m3db/m3/src/dbnode/storage/bootstrap/bootstrapper/uninitialized" "github.com/m3db/m3/src/dbnode/topology" "github.com/m3db/m3/src/dbnode/topology/testutil" xtest "github.com/m3db/m3/src/x/test" @@ -94,37 +94,26 @@ func TestPeersBootstrapNoneAvailable(t *testing.T) { { DisablePeersBootstrapper: false, TopologyInitializer: topoInit, - FinalBootstrapper: bootstrapper.NoOpAllBootstrapperName, + FinalBootstrapper: uninitialized.UninitializedTopologyBootstrapperName, }, { DisablePeersBootstrapper: false, TopologyInitializer: topoInit, - FinalBootstrapper: bootstrapper.NoOpAllBootstrapperName, + FinalBootstrapper: uninitialized.UninitializedTopologyBootstrapperName, }, } setups, closeFn := NewDefaultBootstrappableTestSetups(t, opts, setupOpts) defer closeFn() - serversAreUp := &sync.WaitGroup{} - serversAreUp.Add(2) - - // Start both servers "simultaneously" - go func() { - if err := setups[0].StartServer(); err != nil { - panic(err) - } - serversAreUp.Done() - }() - go func() { - if err := setups[1].StartServer(); err != nil { - panic(err) - } - serversAreUp.Done() - }() - - serversAreUp.Wait() + setups.parallel(func(s TestSetup) { + s.StartServer() + }) log.Debug("servers are now up") + for i, s := range setups { + assert.True(t, s.ServerIsBootstrapped(), "setups[%v] should be bootstrapped", i) + } + // Stop the servers defer func() { setups.parallel(func(s TestSetup) {