Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests] Remove a few more usages of NoOpAllBootstrapper from tests #3314

Merged
merged 2 commits into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/dbnode/integration/fetch_tagged_quorum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
"github.com/m3db/m3/src/dbnode/client"
"github.com/m3db/m3/src/dbnode/encoding"
"github.com/m3db/m3/src/dbnode/namespace"
"github.com/m3db/m3/src/dbnode/storage/bootstrap/bootstrapper/uninitialized"
"github.com/m3db/m3/src/dbnode/storage/index"
"github.com/m3db/m3/src/dbnode/topology"
"github.com/m3db/m3/src/m3ninx/idx"
Expand Down Expand Up @@ -251,7 +250,6 @@ func makeMultiNodeSetup(
numShards int,
indexingEnabled bool,
asyncInserts bool,
finalBootstrapperName string,
instances []services.ServiceInstance,
) (testSetups, closeFn, client.Options) {
nsOpts := namespace.NewOptions()
Expand All @@ -263,7 +261,7 @@ func makeMultiNodeSetup(
require.NoError(t, err)

nspaces := []namespace.Metadata{md1, md2}
nodes, topoInit, closeFn := newNodes(t, numShards, instances, nspaces, asyncInserts, finalBootstrapperName)
nodes, topoInit, closeFn := newNodes(t, numShards, instances, nspaces, asyncInserts)
for _, node := range nodes {
node.SetOpts(node.Opts().SetNumShards(numShards))
}
Expand All @@ -284,8 +282,7 @@ func makeTestFetchTagged(
numShards int,
instances []services.ServiceInstance,
) (testSetups, closeFn, testFetchFn) {
nodes, closeFn, clientopts := makeMultiNodeSetup(t, numShards, true, false,
uninitialized.UninitializedTopologyBootstrapperName, instances)
nodes, closeFn, clientopts := makeMultiNodeSetup(t, numShards, true, false, instances)
testFetch := func(cLevel topology.ReadConsistencyLevel) (encoding.SeriesIterators, bool, error) {
clientopts := clientopts.SetReadConsistencyLevel(cLevel)
c, err := client.NewClient(clientopts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
"github.com/m3db/m3/src/cluster/services"
"github.com/m3db/m3/src/cluster/shard"
"github.com/m3db/m3/src/dbnode/client"
"github.com/m3db/m3/src/dbnode/storage/bootstrap/bootstrapper/uninitialized"
"github.com/m3db/m3/src/dbnode/topology"
xclock "github.com/m3db/m3/src/x/clock"
xtime "github.com/m3db/m3/src/x/time"
Expand Down Expand Up @@ -73,8 +72,7 @@ func TestIndexMultipleNodeHighConcurrency(t *testing.T) {
node(t, 2, newClusterShardsRange(minShard, maxShard, shard.Available)),
}
// nodes = m3db nodes
nodes, closeFn, clientopts := makeMultiNodeSetup(t, numShards, true, true,
uninitialized.UninitializedTopologyBootstrapperName, instances)
nodes, closeFn, clientopts := makeMultiNodeSetup(t, numShards, true, true, instances)
clientopts = clientopts.SetReadConsistencyLevel(lvl)

defer closeFn()
Expand Down
4 changes: 2 additions & 2 deletions src/dbnode/integration/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import (
"github.com/m3db/m3/src/dbnode/storage/bootstrap/bootstrapper"
bcl "github.com/m3db/m3/src/dbnode/storage/bootstrap/bootstrapper/commitlog"
bfs "github.com/m3db/m3/src/dbnode/storage/bootstrap/bootstrapper/fs"
"github.com/m3db/m3/src/dbnode/storage/bootstrap/bootstrapper/uninitialized"
"github.com/m3db/m3/src/dbnode/storage/cluster"
"github.com/m3db/m3/src/dbnode/storage/index"
"github.com/m3db/m3/src/dbnode/storage/series"
Expand Down Expand Up @@ -1084,7 +1085,6 @@ func newNodes(
instances []services.ServiceInstance,
nspaces []namespace.Metadata,
asyncInserts bool,
finalBootstrapperName string,
) (testSetups, topology.Initializer, closeFn) {
var (
log = zap.L()
Expand All @@ -1110,7 +1110,7 @@ func newNodes(

nodeOpt := BootstrappableTestSetupOptions{
DisablePeersBootstrapper: true,
FinalBootstrapper: finalBootstrapperName,
FinalBootstrapper: uninitialized.UninitializedTopologyBootstrapperName,
TopologyInitializer: topoInit,
}

Expand Down
10 changes: 6 additions & 4 deletions src/dbnode/integration/write_quorum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ import (
"testing"
"time"

"github.com/m3db/m3/src/dbnode/storage/bootstrap/bootstrapper"

"github.com/m3db/m3/src/cluster/services"
"github.com/m3db/m3/src/cluster/shard"
"github.com/m3db/m3/src/dbnode/client"
"github.com/m3db/m3/src/dbnode/integration/generate"
"github.com/m3db/m3/src/dbnode/namespace"
"github.com/m3db/m3/src/dbnode/topology"
"github.com/m3db/m3/src/x/ident"
Expand Down Expand Up @@ -231,12 +230,15 @@ func makeTestWrite(
require.NoError(t, err)

nspaces := []namespace.Metadata{md}
nodes, topoInit, closeFn := newNodes(t, numShards, instances, nspaces, false,
bootstrapper.NoOpAllBootstrapperName)
nodes, topoInit, closeFn := newNodes(t, numShards, instances, nspaces, false)
now := nodes[0].NowFn()()

for _, node := range nodes {
node.SetOpts(node.Opts().SetNumShards(numShards))
for _, ns := range node.Namespaces() {
// write empty data files to disk so nodes could bootstrap
writeTestDataToDisk(ns, node, generate.SeriesBlocksByStart{}, 0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed because UninitializedTopology would not work here?
I'm afraid this workaround might become what NoOpAllBootstrapper was, let's discuss this offline.

}
}

clientopts := client.NewOptions().
Expand Down
4 changes: 1 addition & 3 deletions src/dbnode/integration/write_read_high_concurrency_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
"github.com/m3db/m3/src/cluster/services"
"github.com/m3db/m3/src/cluster/shard"
"github.com/m3db/m3/src/dbnode/client"
"github.com/m3db/m3/src/dbnode/storage/bootstrap/bootstrapper/uninitialized"
"github.com/m3db/m3/src/dbnode/topology"
xclock "github.com/m3db/m3/src/x/clock"
"github.com/m3db/m3/src/x/ident"
Expand Down Expand Up @@ -61,8 +60,7 @@ func TestWriteReadHighConcurrencyTestMultiNS(t *testing.T) {
node(t, 2, newClusterShardsRange(minShard, maxShard, shard.Available)),
}
)
nodes, closeFn, clientopts := makeMultiNodeSetup(t, numShards, true, true,
uninitialized.UninitializedTopologyBootstrapperName, instances)
nodes, closeFn, clientopts := makeMultiNodeSetup(t, numShards, true, true, instances)
clientopts = clientopts.
SetWriteConsistencyLevel(topology.ConsistencyLevelAll).
SetReadConsistencyLevel(topology.ReadConsistencyLevelAll)
Expand Down
12 changes: 9 additions & 3 deletions src/dbnode/integration/write_tagged_quorum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import (
"github.com/m3db/m3/src/cluster/services"
"github.com/m3db/m3/src/cluster/shard"
"github.com/m3db/m3/src/dbnode/client"
"github.com/m3db/m3/src/dbnode/integration/generate"
"github.com/m3db/m3/src/dbnode/namespace"
"github.com/m3db/m3/src/dbnode/storage/bootstrap/bootstrapper"
"github.com/m3db/m3/src/dbnode/storage/index"
"github.com/m3db/m3/src/dbnode/test"
"github.com/m3db/m3/src/dbnode/topology"
Expand Down Expand Up @@ -256,8 +256,14 @@ func makeTestWriteTagged(
numShards int,
instances []services.ServiceInstance,
) (testSetups, closeFn, testWriteFn) {
nodes, closeFn, clientopts := makeMultiNodeSetup(t, numShards, true, false,
bootstrapper.NoOpAllBootstrapperName, instances)
nodes, closeFn, clientopts := makeMultiNodeSetup(t, numShards, true, false, instances)

for _, node := range nodes {
for _, ns := range node.Namespaces() {
// write empty data files to disk so nodes could bootstrap
writeTestDataToDisk(ns, node, generate.SeriesBlocksByStart{}, 0)
}
}

testWrite := func(cLevel topology.ConsistencyLevel) error {
clientopts = clientopts.SetWriteConsistencyLevel(cLevel)
Expand Down