Skip to content

Commit

Permalink
[tests] Update peer bootstrapper new cluster integration test (#3282)
Browse files Browse the repository at this point in the history
  • Loading branch information
vpranckaitis authored Mar 1, 2021
1 parent da44ea0 commit 017f60d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/dbnode/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
33 changes: 11 additions & 22 deletions src/dbnode/integration/peers_bootstrap_none_available_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@
package integration

import (
"sync"
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/m3db/m3/src/cluster/services"
"github.com/m3db/m3/src/cluster/shard"
"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"
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 017f60d

Please sign in to comment.