From 2aa12e7695ccee7a7ba04852b0e754b25785a3f7 Mon Sep 17 00:00:00 2001 From: Gediminas Date: Wed, 23 Dec 2020 12:32:00 +0200 Subject: [PATCH 01/14] [tests] test setups exported to allow us to use it from other packages --- .../integration/cluster_add_one_node_test.go | 4 +- .../commitlog_bootstrap_unowned_shard_test.go | 4 +- src/dbnode/integration/integration.go | 50 +++++++++++-------- src/dbnode/integration/options.go | 19 +++++++ .../peers_bootstrap_high_concurrency_test.go | 4 +- .../peers_bootstrap_index_aggregate_test.go | 4 +- .../integration/peers_bootstrap_index_test.go | 4 +- .../peers_bootstrap_merge_local_test.go | 4 +- .../peers_bootstrap_merge_peer_blocks_test.go | 2 +- .../peers_bootstrap_node_down_test.go | 10 ++-- .../peers_bootstrap_none_available_test.go | 2 +- .../peers_bootstrap_select_best_test.go | 10 ++-- .../peers_bootstrap_simple_test.go | 8 +-- .../peers_bootstrap_single_node_test.go | 6 +-- src/dbnode/integration/repair_test.go | 10 ++-- src/dbnode/integration/setup.go | 12 ++--- 16 files changed, 89 insertions(+), 64 deletions(-) diff --git a/src/dbnode/integration/cluster_add_one_node_test.go b/src/dbnode/integration/cluster_add_one_node_test.go index d2b4c1beb9..7dc4760cda 100644 --- a/src/dbnode/integration/cluster_add_one_node_test.go +++ b/src/dbnode/integration/cluster_add_one_node_test.go @@ -112,7 +112,7 @@ func testClusterAddOneNode(t *testing.T, verifyCommitlogCanBootstrapAfterNodeJoi topoOpts := topology.NewDynamicOptions(). SetConfigServiceClient(fake.NewM3ClusterClient(svcs, nil)) topoInit := topology.NewDynamicInitializer(topoOpts) - setupOpts := []bootstrappableTestSetupOptions{ + setupOpts := []BootstrappableTestSetupOptions{ { disablePeersBootstrapper: true, topologyInitializer: topoInit, @@ -122,7 +122,7 @@ func testClusterAddOneNode(t *testing.T, verifyCommitlogCanBootstrapAfterNodeJoi topologyInitializer: topoInit, }, } - setups, closeFn := newDefaultBootstrappableTestSetups(t, opts, setupOpts) + setups, closeFn := NewDefaultBootstrappableTestSetups(t, opts, setupOpts) defer closeFn() // Write test data for first node. diff --git a/src/dbnode/integration/commitlog_bootstrap_unowned_shard_test.go b/src/dbnode/integration/commitlog_bootstrap_unowned_shard_test.go index 74c4b19162..1d94d60524 100644 --- a/src/dbnode/integration/commitlog_bootstrap_unowned_shard_test.go +++ b/src/dbnode/integration/commitlog_bootstrap_unowned_shard_test.go @@ -89,12 +89,12 @@ func TestCommitLogBootstrapUnownedShard(t *testing.T) { opts := NewTestOptions(t). SetNamespaces([]namespace.Metadata{ns1}). SetNumShards(numShards) - setupOpts := []bootstrappableTestSetupOptions{ + setupOpts := []BootstrappableTestSetupOptions{ {disablePeersBootstrapper: true, topologyInitializer: topoInit}, {disablePeersBootstrapper: true, topologyInitializer: topoInit}, } - setups, closeFn := newDefaultBootstrappableTestSetups(t, opts, setupOpts) + setups, closeFn := NewDefaultBootstrappableTestSetups(t, opts, setupOpts) defer closeFn() // Only set this up for the first setup because we're only writing commit diff --git a/src/dbnode/integration/integration.go b/src/dbnode/integration/integration.go index 36cdf5fffb..0016ee07fb 100644 --- a/src/dbnode/integration/integration.go +++ b/src/dbnode/integration/integration.go @@ -111,16 +111,17 @@ func newMultiAddrAdminClient( return adminClient } -type bootstrappableTestSetupOptions struct { - finalBootstrapper string - bootstrapBlocksBatchSize int - bootstrapBlocksConcurrency int - bootstrapConsistencyLevel topology.ReadConsistencyLevel - topologyInitializer topology.Initializer - testStatsReporter xmetrics.TestStatsReporter - disablePeersBootstrapper bool - useTChannelClientForWriting bool - enableRepairs bool +// BootstrappableTestSetupOptions defines options for test setups +type BootstrappableTestSetupOptions struct { + FinalBootstrapper string + BootstrapBlocksBatchSize int + BootstrapBlocksConcurrency int + BootstrapConsistencyLevel topology.ReadConsistencyLevel + TopologyInitializer topology.Initializer + TestStatsReporter xmetrics.TestStatsReporter + DisablePeersBootstrapper bool + UseTChannelClientForWriting bool + EnableRepairs bool } type closeFn func() @@ -135,10 +136,11 @@ func newDefaulTestResultOptions( SetSeriesCachePolicy(storageOpts.SeriesCachePolicy()) } -func newDefaultBootstrappableTestSetups( +// NewDefaultBootstrappableTestSetups creates dbnode test setups +func NewDefaultBootstrappableTestSetups( // nolint:gocyclo t *testing.T, opts TestOptions, - setupOpts []bootstrappableTestSetupOptions, + setupOpts []BootstrappableTestSetupOptions, ) (testSetups, closeFn) { var ( replicas = len(setupOpts) @@ -158,15 +160,15 @@ func newDefaultBootstrappableTestSetups( for i := 0; i < replicas; i++ { var ( instance = i - usingPeersBootstrapper = !setupOpts[i].disablePeersBootstrapper - finalBootstrapperToUse = setupOpts[i].finalBootstrapper - useTChannelClientForWriting = setupOpts[i].useTChannelClientForWriting - bootstrapBlocksBatchSize = setupOpts[i].bootstrapBlocksBatchSize - bootstrapBlocksConcurrency = setupOpts[i].bootstrapBlocksConcurrency - bootstrapConsistencyLevel = setupOpts[i].bootstrapConsistencyLevel - topologyInitializer = setupOpts[i].topologyInitializer - testStatsReporter = setupOpts[i].testStatsReporter - enableRepairs = setupOpts[i].enableRepairs + usingPeersBootstrapper = !setupOpts[i].DisablePeersBootstrapper + finalBootstrapperToUse = setupOpts[i].FinalBootstrapper + useTChannelClientForWriting = setupOpts[i].UseTChannelClientForWriting + bootstrapBlocksBatchSize = setupOpts[i].BootstrapBlocksBatchSize + bootstrapBlocksConcurrency = setupOpts[i].BootstrapBlocksConcurrency + bootstrapConsistencyLevel = setupOpts[i].BootstrapConsistencyLevel + topologyInitializer = setupOpts[i].TopologyInitializer + testStatsReporter = setupOpts[i].TestStatsReporter + enableRepairs = setupOpts[i].EnableRepairs origin topology.Host instanceOpts = newMultiAddrTestOptions(opts, instance) ) @@ -223,7 +225,11 @@ func newDefaultBootstrappableTestSetups( scope, _ := tally.NewRootScope(tally.ScopeOptions{Reporter: testStatsReporter}, 100*time.Millisecond) instrumentOpts = instrumentOpts.SetMetricsScope(scope) } - setup.SetStorageOpts(setup.StorageOpts().SetInstrumentOptions(instrumentOpts)) + storageOpts := setup.StorageOpts().SetInstrumentOptions(instrumentOpts) + if opts.StorageOptsFn() != nil { + storageOpts = opts.StorageOptsFn()(storageOpts) + } + setup.SetStorageOpts(storageOpts) var ( bsOpts = newDefaulTestResultOptions(setup.StorageOpts()) diff --git a/src/dbnode/integration/options.go b/src/dbnode/integration/options.go index 355b745c59..f67b2b70c5 100644 --- a/src/dbnode/integration/options.go +++ b/src/dbnode/integration/options.go @@ -26,6 +26,7 @@ import ( "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" + "github.com/m3db/m3/src/dbnode/storage" "github.com/m3db/m3/src/dbnode/storage/block" "github.com/m3db/m3/src/dbnode/topology" @@ -91,6 +92,9 @@ var ( DefaultIntegrationTestRetentionOpts = retention.NewOptions().SetRetentionPeriod(6 * time.Hour) ) +// StorageOptsFunc is a storageOptions modifier for tests +type StorageOptsFunc func(opts storage.Options) storage.Options + // TestOptions contains integration test options. type TestOptions interface { // SetNamespaces sets the namespaces. @@ -293,6 +297,12 @@ type TestOptions interface { // ReportInterval returns the time between reporting metrics within the system. ReportInterval() time.Duration + + // SetStorageOptsFn sets the StorageOpts modifier + SetStorageOptsFn(StorageOptsFunc) + + // StorageOptsFn returns the StorageOpts modifier + StorageOptsFn() StorageOptsFunc } type options struct { @@ -327,6 +337,7 @@ type options struct { assertEqual assertTestDataEqual nowFn func() time.Time reportInterval time.Duration + storageOptsFn StorageOptsFunc } // NewTestOptions returns a new set of integration test options. @@ -676,3 +687,11 @@ func (o *options) SetReportInterval(value time.Duration) TestOptions { func (o *options) ReportInterval() time.Duration { return o.reportInterval } + +func (o *options) SetStorageOptsFn(storageOptsFn StorageOptsFunc) { + o.storageOptsFn = storageOptsFn +} + +func (o *options) StorageOptsFn() StorageOptsFunc { + return o.storageOptsFn +} diff --git a/src/dbnode/integration/peers_bootstrap_high_concurrency_test.go b/src/dbnode/integration/peers_bootstrap_high_concurrency_test.go index 0394153c95..2c885556c7 100644 --- a/src/dbnode/integration/peers_bootstrap_high_concurrency_test.go +++ b/src/dbnode/integration/peers_bootstrap_high_concurrency_test.go @@ -102,7 +102,7 @@ func testPeersBootstrapHighConcurrency( batchSize := 16 concurrency := 64 - setupOpts := []bootstrappableTestSetupOptions{ + setupOpts := []BootstrappableTestSetupOptions{ { disablePeersBootstrapper: true, }, @@ -112,7 +112,7 @@ func testPeersBootstrapHighConcurrency( bootstrapBlocksConcurrency: concurrency, }, } - setups, closeFn := newDefaultBootstrappableTestSetups(t, opts, setupOpts) + setups, closeFn := NewDefaultBootstrappableTestSetups(t, opts, setupOpts) defer closeFn() // Write test data for first node diff --git a/src/dbnode/integration/peers_bootstrap_index_aggregate_test.go b/src/dbnode/integration/peers_bootstrap_index_aggregate_test.go index 10a2d2890b..e7ff2a9212 100644 --- a/src/dbnode/integration/peers_bootstrap_index_aggregate_test.go +++ b/src/dbnode/integration/peers_bootstrap_index_aggregate_test.go @@ -65,11 +65,11 @@ func TestPeersBootstrapIndexAggregateQuery(t *testing.T) { SetUseTChannelClientForWriting(true). SetUseTChannelClientForReading(true) - setupOpts := []bootstrappableTestSetupOptions{ + setupOpts := []BootstrappableTestSetupOptions{ {disablePeersBootstrapper: true}, {disablePeersBootstrapper: false}, } - setups, closeFn := newDefaultBootstrappableTestSetups(t, opts, setupOpts) + setups, closeFn := NewDefaultBootstrappableTestSetups(t, opts, setupOpts) defer closeFn() // Write test data for first node diff --git a/src/dbnode/integration/peers_bootstrap_index_test.go b/src/dbnode/integration/peers_bootstrap_index_test.go index d5907d9dc1..6141027a85 100644 --- a/src/dbnode/integration/peers_bootstrap_index_test.go +++ b/src/dbnode/integration/peers_bootstrap_index_test.go @@ -70,11 +70,11 @@ func TestPeersBootstrapIndexWithIndexingEnabled(t *testing.T) { SetUseTChannelClientForWriting(true). SetUseTChannelClientForReading(true) - setupOpts := []bootstrappableTestSetupOptions{ + setupOpts := []BootstrappableTestSetupOptions{ {disablePeersBootstrapper: true}, {disablePeersBootstrapper: false}, } - setups, closeFn := newDefaultBootstrappableTestSetups(t, opts, setupOpts) + setups, closeFn := NewDefaultBootstrappableTestSetups(t, opts, setupOpts) defer closeFn() // Write test data for first node diff --git a/src/dbnode/integration/peers_bootstrap_merge_local_test.go b/src/dbnode/integration/peers_bootstrap_merge_local_test.go index b6638d7476..3e7e8eb4df 100644 --- a/src/dbnode/integration/peers_bootstrap_merge_local_test.go +++ b/src/dbnode/integration/peers_bootstrap_merge_local_test.go @@ -73,7 +73,7 @@ func testPeersBootstrapMergeLocal(t *testing.T, setTestOpts setTestOptions, upda // Enable useTchannelClientForWriting because this test relies upon being // able to write data to a single node, and the M3DB client does not support // that, but we can accomplish it by using an individual nodes TChannel endpoints. - setupOpts = []bootstrappableTestSetupOptions{ + setupOpts = []BootstrappableTestSetupOptions{ { disablePeersBootstrapper: true, useTChannelClientForWriting: true, @@ -91,7 +91,7 @@ func testPeersBootstrapMergeLocal(t *testing.T, setTestOpts setTestOptions, upda namesp = opts.Namespaces()[0] } - setups, closeFn := newDefaultBootstrappableTestSetups(t, opts, setupOpts) + setups, closeFn := NewDefaultBootstrappableTestSetups(t, opts, setupOpts) defer closeFn() // Write test data for first node, ensure to overflow past diff --git a/src/dbnode/integration/peers_bootstrap_merge_peer_blocks_test.go b/src/dbnode/integration/peers_bootstrap_merge_peer_blocks_test.go index 40f1daca66..854ee33a9d 100644 --- a/src/dbnode/integration/peers_bootstrap_merge_peer_blocks_test.go +++ b/src/dbnode/integration/peers_bootstrap_merge_peer_blocks_test.go @@ -74,7 +74,7 @@ func testPeersBootstrapMergePeerBlocks(t *testing.T, setTestOpts setTestOptions, {disablePeersBootstrapper: true}, {disablePeersBootstrapper: false}, } - setups, closeFn := newDefaultBootstrappableTestSetups(t, opts, setupOpts) + setups, closeFn := NewDefaultBootstrappableTestSetups(t, opts, setupOpts) defer closeFn() // Write test data alternating missing data for left/right nodes diff --git a/src/dbnode/integration/peers_bootstrap_node_down_test.go b/src/dbnode/integration/peers_bootstrap_node_down_test.go index 5518b1bb44..45c0f3753f 100644 --- a/src/dbnode/integration/peers_bootstrap_node_down_test.go +++ b/src/dbnode/integration/peers_bootstrap_node_down_test.go @@ -57,12 +57,12 @@ func TestPeersBootstrapNodeDown(t *testing.T) { SetUseTChannelClientForWriting(true). SetUseTChannelClientForReading(true) - setupOpts := []bootstrappableTestSetupOptions{ - {disablePeersBootstrapper: true}, - {disablePeersBootstrapper: true}, - {disablePeersBootstrapper: false}, + setupOpts := []BootstrappableTestSetupOptions{ + {DisablePeersBootstrapper: true}, + {DisablePeersBootstrapper: true}, + {DisablePeersBootstrapper: false}, } - setups, closeFn := newDefaultBootstrappableTestSetups(t, opts, setupOpts) + setups, closeFn := NewDefaultBootstrappableTestSetups(t, opts, setupOpts) defer closeFn() // Write test data for first node diff --git a/src/dbnode/integration/peers_bootstrap_none_available_test.go b/src/dbnode/integration/peers_bootstrap_none_available_test.go index b4d929c391..b2dbb906b2 100644 --- a/src/dbnode/integration/peers_bootstrap_none_available_test.go +++ b/src/dbnode/integration/peers_bootstrap_none_available_test.go @@ -99,7 +99,7 @@ func TestPeersBootstrapNoneAvailable(t *testing.T) { topologyInitializer: topoInit, }, } - setups, closeFn := newDefaultBootstrappableTestSetups(t, opts, setupOpts) + setups, closeFn := NewDefaultBootstrappableTestSetups(t, opts, setupOpts) defer closeFn() serversAreUp := &sync.WaitGroup{} diff --git a/src/dbnode/integration/peers_bootstrap_select_best_test.go b/src/dbnode/integration/peers_bootstrap_select_best_test.go index 62efd41497..58caec15f2 100644 --- a/src/dbnode/integration/peers_bootstrap_select_best_test.go +++ b/src/dbnode/integration/peers_bootstrap_select_best_test.go @@ -56,12 +56,12 @@ func TestPeersBootstrapSelectBest(t *testing.T) { SetUseTChannelClientForWriting(true). SetUseTChannelClientForReading(true) - setupOpts := []bootstrappableTestSetupOptions{ - {disablePeersBootstrapper: true}, - {disablePeersBootstrapper: true}, - {disablePeersBootstrapper: false}, + setupOpts := []BootstrappableTestSetupOptions{ + {DisablePeersBootstrapper: true}, + {DisablePeersBootstrapper: true}, + {DisablePeersBootstrapper: false}, } - setups, closeFn := newDefaultBootstrappableTestSetups(t, opts, setupOpts) + setups, closeFn := NewDefaultBootstrappableTestSetups(t, opts, setupOpts) defer closeFn() // Write test data alternating missing data for left/right nodes diff --git a/src/dbnode/integration/peers_bootstrap_simple_test.go b/src/dbnode/integration/peers_bootstrap_simple_test.go index 620bdc0b15..38bba77f9c 100644 --- a/src/dbnode/integration/peers_bootstrap_simple_test.go +++ b/src/dbnode/integration/peers_bootstrap_simple_test.go @@ -67,11 +67,11 @@ func testPeersBootstrapSimple(t *testing.T, setTestOpts setTestOptions, updateIn namesp = opts.Namespaces()[0] } - setupOpts := []bootstrappableTestSetupOptions{ - {disablePeersBootstrapper: true}, - {disablePeersBootstrapper: false}, + setupOpts := []BootstrappableTestSetupOptions{ + {DisablePeersBootstrapper: true}, + {DisablePeersBootstrapper: false}, } - setups, closeFn := newDefaultBootstrappableTestSetups(t, opts, setupOpts) + setups, closeFn := NewDefaultBootstrappableTestSetups(t, opts, setupOpts) defer closeFn() // Write test data for first node diff --git a/src/dbnode/integration/peers_bootstrap_single_node_test.go b/src/dbnode/integration/peers_bootstrap_single_node_test.go index 288d3c293c..7e48530f8c 100644 --- a/src/dbnode/integration/peers_bootstrap_single_node_test.go +++ b/src/dbnode/integration/peers_bootstrap_single_node_test.go @@ -57,10 +57,10 @@ func TestPeersBootstrapSingleNode(t *testing.T) { SetUseTChannelClientForWriting(true). SetUseTChannelClientForReading(true) - setupOpts := []bootstrappableTestSetupOptions{ - {disablePeersBootstrapper: false}, + setupOpts := []BootstrappableTestSetupOptions{ + {DisablePeersBootstrapper: false}, } - setups, closeFn := newDefaultBootstrappableTestSetups(t, opts, setupOpts) + setups, closeFn := NewDefaultBootstrappableTestSetups(t, opts, setupOpts) defer closeFn() // Write test data diff --git a/src/dbnode/integration/repair_test.go b/src/dbnode/integration/repair_test.go index b3a93e7bca..d469773777 100644 --- a/src/dbnode/integration/repair_test.go +++ b/src/dbnode/integration/repair_test.go @@ -196,12 +196,12 @@ func testRepair( SetUseTChannelClientForWriting(true). SetUseTChannelClientForReading(true) - setupOpts := []bootstrappableTestSetupOptions{ - {disablePeersBootstrapper: true, enableRepairs: true}, - {disablePeersBootstrapper: true, enableRepairs: true}, - {disablePeersBootstrapper: true, enableRepairs: true}, + setupOpts := []BootstrappableTestSetupOptions{ + {DisablePeersBootstrapper: true, EnableRepairs: true}, + {DisablePeersBootstrapper: true, EnableRepairs: true}, + {DisablePeersBootstrapper: true, EnableRepairs: true}, } - setups, closeFn := newDefaultBootstrappableTestSetups(t, opts, setupOpts) + setups, closeFn := NewDefaultBootstrappableTestSetups(t, opts, setupOpts) defer closeFn() // Ensure that the current time is set such that the previous block is flushable. diff --git a/src/dbnode/integration/setup.go b/src/dbnode/integration/setup.go index e4d27478cf..8fa7f0ccba 100644 --- a/src/dbnode/integration/setup.go +++ b/src/dbnode/integration/setup.go @@ -1098,18 +1098,18 @@ func newNodes( SetConfigServiceClient(fake.NewM3ClusterClient(svcs, nil)) topoInit := topology.NewDynamicInitializer(topoOpts) - nodeOpt := bootstrappableTestSetupOptions{ - disablePeersBootstrapper: true, - finalBootstrapper: bootstrapper.NoOpAllBootstrapperName, - topologyInitializer: topoInit, + nodeOpt := BootstrappableTestSetupOptions{ + DisablePeersBootstrapper: true, + FinalBootstrapper: bootstrapper.NoOpAllBootstrapperName, + TopologyInitializer: topoInit, } - nodeOpts := make([]bootstrappableTestSetupOptions, len(instances)) + nodeOpts := make([]BootstrappableTestSetupOptions, len(instances)) for i := range instances { nodeOpts[i] = nodeOpt } - nodes, closeFn := newDefaultBootstrappableTestSetups(t, opts, nodeOpts) + nodes, closeFn := NewDefaultBootstrappableTestSetups(t, opts, nodeOpts) nodeClose := func() { // Clean up running servers at end of test log.Debug("servers closing") From 7bae4b5ff92fc1476f1363c81fd5057e03183c3d Mon Sep 17 00:00:00 2001 From: Gediminas Date: Wed, 23 Dec 2020 13:49:21 +0200 Subject: [PATCH 02/14] renaming fix --- src/dbnode/integration/cluster_add_one_node_test.go | 8 ++++---- .../commitlog_bootstrap_unowned_shard_test.go | 4 ++-- .../peers_bootstrap_high_concurrency_test.go | 8 ++++---- .../peers_bootstrap_index_aggregate_test.go | 4 ++-- src/dbnode/integration/peers_bootstrap_index_test.go | 4 ++-- .../integration/peers_bootstrap_merge_local_test.go | 10 +++++----- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/dbnode/integration/cluster_add_one_node_test.go b/src/dbnode/integration/cluster_add_one_node_test.go index 7dc4760cda..1d04c92d25 100644 --- a/src/dbnode/integration/cluster_add_one_node_test.go +++ b/src/dbnode/integration/cluster_add_one_node_test.go @@ -114,12 +114,12 @@ func testClusterAddOneNode(t *testing.T, verifyCommitlogCanBootstrapAfterNodeJoi topoInit := topology.NewDynamicInitializer(topoOpts) setupOpts := []BootstrappableTestSetupOptions{ { - disablePeersBootstrapper: true, - topologyInitializer: topoInit, + DisablePeersBootstrapper: true, + TopologyInitializer: topoInit, }, { - disablePeersBootstrapper: false, - topologyInitializer: topoInit, + DisablePeersBootstrapper: false, + TopologyInitializer: topoInit, }, } setups, closeFn := NewDefaultBootstrappableTestSetups(t, opts, setupOpts) diff --git a/src/dbnode/integration/commitlog_bootstrap_unowned_shard_test.go b/src/dbnode/integration/commitlog_bootstrap_unowned_shard_test.go index 1d94d60524..fc062f5b26 100644 --- a/src/dbnode/integration/commitlog_bootstrap_unowned_shard_test.go +++ b/src/dbnode/integration/commitlog_bootstrap_unowned_shard_test.go @@ -90,8 +90,8 @@ func TestCommitLogBootstrapUnownedShard(t *testing.T) { SetNamespaces([]namespace.Metadata{ns1}). SetNumShards(numShards) setupOpts := []BootstrappableTestSetupOptions{ - {disablePeersBootstrapper: true, topologyInitializer: topoInit}, - {disablePeersBootstrapper: true, topologyInitializer: topoInit}, + {DisablePeersBootstrapper: true, TopologyInitializer: topoInit}, + {DisablePeersBootstrapper: true, TopologyInitializer: topoInit}, } setups, closeFn := NewDefaultBootstrappableTestSetups(t, opts, setupOpts) diff --git a/src/dbnode/integration/peers_bootstrap_high_concurrency_test.go b/src/dbnode/integration/peers_bootstrap_high_concurrency_test.go index 2c885556c7..98e9ffca8e 100644 --- a/src/dbnode/integration/peers_bootstrap_high_concurrency_test.go +++ b/src/dbnode/integration/peers_bootstrap_high_concurrency_test.go @@ -104,12 +104,12 @@ func testPeersBootstrapHighConcurrency( concurrency := 64 setupOpts := []BootstrappableTestSetupOptions{ { - disablePeersBootstrapper: true, + DisablePeersBootstrapper: true, }, { - disablePeersBootstrapper: false, - bootstrapBlocksBatchSize: batchSize, - bootstrapBlocksConcurrency: concurrency, + DisablePeersBootstrapper: false, + BootstrapBlocksBatchSize: batchSize, + BootstrapBlocksConcurrency: concurrency, }, } setups, closeFn := NewDefaultBootstrappableTestSetups(t, opts, setupOpts) diff --git a/src/dbnode/integration/peers_bootstrap_index_aggregate_test.go b/src/dbnode/integration/peers_bootstrap_index_aggregate_test.go index e7ff2a9212..498fc538d6 100644 --- a/src/dbnode/integration/peers_bootstrap_index_aggregate_test.go +++ b/src/dbnode/integration/peers_bootstrap_index_aggregate_test.go @@ -66,8 +66,8 @@ func TestPeersBootstrapIndexAggregateQuery(t *testing.T) { SetUseTChannelClientForReading(true) setupOpts := []BootstrappableTestSetupOptions{ - {disablePeersBootstrapper: true}, - {disablePeersBootstrapper: false}, + {DisablePeersBootstrapper: true}, + {DisablePeersBootstrapper: false}, } setups, closeFn := NewDefaultBootstrappableTestSetups(t, opts, setupOpts) defer closeFn() diff --git a/src/dbnode/integration/peers_bootstrap_index_test.go b/src/dbnode/integration/peers_bootstrap_index_test.go index 6141027a85..5b5e58761e 100644 --- a/src/dbnode/integration/peers_bootstrap_index_test.go +++ b/src/dbnode/integration/peers_bootstrap_index_test.go @@ -71,8 +71,8 @@ func TestPeersBootstrapIndexWithIndexingEnabled(t *testing.T) { SetUseTChannelClientForReading(true) setupOpts := []BootstrappableTestSetupOptions{ - {disablePeersBootstrapper: true}, - {disablePeersBootstrapper: false}, + {DisablePeersBootstrapper: true}, + {DisablePeersBootstrapper: false}, } setups, closeFn := NewDefaultBootstrappableTestSetups(t, opts, setupOpts) defer closeFn() diff --git a/src/dbnode/integration/peers_bootstrap_merge_local_test.go b/src/dbnode/integration/peers_bootstrap_merge_local_test.go index 3e7e8eb4df..845ab95497 100644 --- a/src/dbnode/integration/peers_bootstrap_merge_local_test.go +++ b/src/dbnode/integration/peers_bootstrap_merge_local_test.go @@ -75,13 +75,13 @@ func testPeersBootstrapMergeLocal(t *testing.T, setTestOpts setTestOptions, upda // that, but we can accomplish it by using an individual nodes TChannel endpoints. setupOpts = []BootstrappableTestSetupOptions{ { - disablePeersBootstrapper: true, - useTChannelClientForWriting: true, + DisablePeersBootstrapper: true, + UseTChannelClientForWriting: true, }, { - disablePeersBootstrapper: false, - useTChannelClientForWriting: true, - testStatsReporter: reporter, + DisablePeersBootstrapper: false, + UseTChannelClientForWriting: true, + TestStatsReporter: reporter, }, } ) From 156ddabf5a9ddca28725e70071871af85d2b8218 Mon Sep 17 00:00:00 2001 From: Gediminas Date: Wed, 23 Dec 2020 14:27:41 +0200 Subject: [PATCH 03/14] rename fix --- .../peers_bootstrap_merge_peer_blocks_test.go | 8 ++++---- .../integration/peers_bootstrap_none_available_test.go | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/dbnode/integration/peers_bootstrap_merge_peer_blocks_test.go b/src/dbnode/integration/peers_bootstrap_merge_peer_blocks_test.go index 854ee33a9d..52e671f958 100644 --- a/src/dbnode/integration/peers_bootstrap_merge_peer_blocks_test.go +++ b/src/dbnode/integration/peers_bootstrap_merge_peer_blocks_test.go @@ -69,10 +69,10 @@ func testPeersBootstrapMergePeerBlocks(t *testing.T, setTestOpts setTestOptions, opts = setTestOpts(t, opts) namesp = opts.Namespaces()[0] } - setupOpts := []bootstrappableTestSetupOptions{ - {disablePeersBootstrapper: true}, - {disablePeersBootstrapper: true}, - {disablePeersBootstrapper: false}, + setupOpts := []BootstrappableTestSetupOptions{ + {DisablePeersBootstrapper: true}, + {DisablePeersBootstrapper: true}, + {DisablePeersBootstrapper: false}, } setups, closeFn := NewDefaultBootstrappableTestSetups(t, opts, setupOpts) defer closeFn() diff --git a/src/dbnode/integration/peers_bootstrap_none_available_test.go b/src/dbnode/integration/peers_bootstrap_none_available_test.go index b2dbb906b2..17a41c4c49 100644 --- a/src/dbnode/integration/peers_bootstrap_none_available_test.go +++ b/src/dbnode/integration/peers_bootstrap_none_available_test.go @@ -89,14 +89,14 @@ func TestPeersBootstrapNoneAvailable(t *testing.T) { SetShardSet(shardSet) topoInit := topology.NewStaticInitializer(topoOpts) - setupOpts := []bootstrappableTestSetupOptions{ + setupOpts := []BootstrappableTestSetupOptions{ { - disablePeersBootstrapper: false, - topologyInitializer: topoInit, + DisablePeersBootstrapper: false, + TopologyInitializer: topoInit, }, { - disablePeersBootstrapper: false, - topologyInitializer: topoInit, + DisablePeersBootstrapper: false, + TopologyInitializer: topoInit, }, } setups, closeFn := NewDefaultBootstrappableTestSetups(t, opts, setupOpts) From 68df2c3777ae8198ccaad5adb3ad8e839b884589 Mon Sep 17 00:00:00 2001 From: Gediminas Date: Wed, 23 Dec 2020 16:19:43 +0200 Subject: [PATCH 04/14] minor refactoring --- src/dbnode/integration/integration.go | 7 +------ src/dbnode/integration/options.go | 14 +++++--------- src/dbnode/integration/setup.go | 8 +++++--- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/src/dbnode/integration/integration.go b/src/dbnode/integration/integration.go index 0016ee07fb..570725943f 100644 --- a/src/dbnode/integration/integration.go +++ b/src/dbnode/integration/integration.go @@ -213,7 +213,7 @@ func NewDefaultBootstrappableTestSetups( // nolint:gocyclo // claim manager instances after the initial node. persistfs.ResetIndexClaimsManagersUnsafe() } - setup, err := NewTestSetup(t, instanceOpts, nil) + setup, err := NewTestSetup(t, instanceOpts, nil, opts.StorageOptsFn()) require.NoError(t, err) topologyInitializer = setup.TopologyInitializer() @@ -225,11 +225,6 @@ func NewDefaultBootstrappableTestSetups( // nolint:gocyclo scope, _ := tally.NewRootScope(tally.ScopeOptions{Reporter: testStatsReporter}, 100*time.Millisecond) instrumentOpts = instrumentOpts.SetMetricsScope(scope) } - storageOpts := setup.StorageOpts().SetInstrumentOptions(instrumentOpts) - if opts.StorageOptsFn() != nil { - storageOpts = opts.StorageOptsFn()(storageOpts) - } - setup.SetStorageOpts(storageOpts) var ( bsOpts = newDefaulTestResultOptions(setup.StorageOpts()) diff --git a/src/dbnode/integration/options.go b/src/dbnode/integration/options.go index f67b2b70c5..f173f97e11 100644 --- a/src/dbnode/integration/options.go +++ b/src/dbnode/integration/options.go @@ -26,7 +26,6 @@ import ( "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" - "github.com/m3db/m3/src/dbnode/storage" "github.com/m3db/m3/src/dbnode/storage/block" "github.com/m3db/m3/src/dbnode/topology" @@ -92,9 +91,6 @@ var ( DefaultIntegrationTestRetentionOpts = retention.NewOptions().SetRetentionPeriod(6 * time.Hour) ) -// StorageOptsFunc is a storageOptions modifier for tests -type StorageOptsFunc func(opts storage.Options) storage.Options - // TestOptions contains integration test options. type TestOptions interface { // SetNamespaces sets the namespaces. @@ -299,10 +295,10 @@ type TestOptions interface { ReportInterval() time.Duration // SetStorageOptsFn sets the StorageOpts modifier - SetStorageOptsFn(StorageOptsFunc) + SetStorageOptsFn(StorageOption) // StorageOptsFn returns the StorageOpts modifier - StorageOptsFn() StorageOptsFunc + StorageOptsFn() StorageOption } type options struct { @@ -337,7 +333,7 @@ type options struct { assertEqual assertTestDataEqual nowFn func() time.Time reportInterval time.Duration - storageOptsFn StorageOptsFunc + storageOptsFn StorageOption } // NewTestOptions returns a new set of integration test options. @@ -688,10 +684,10 @@ func (o *options) ReportInterval() time.Duration { return o.reportInterval } -func (o *options) SetStorageOptsFn(storageOptsFn StorageOptsFunc) { +func (o *options) SetStorageOptsFn(storageOptsFn StorageOption) { o.storageOptsFn = storageOptsFn } -func (o *options) StorageOptsFn() StorageOptsFunc { +func (o *options) StorageOptsFn() StorageOption { return o.storageOptsFn } diff --git a/src/dbnode/integration/setup.go b/src/dbnode/integration/setup.go index 8fa7f0ccba..ffb30ca80a 100644 --- a/src/dbnode/integration/setup.go +++ b/src/dbnode/integration/setup.go @@ -186,14 +186,14 @@ type TestSetup interface { InitializeBootstrappers(opts InitializeBootstrappersOptions) error } -type storageOption func(storage.Options) storage.Options +type StorageOption func(storage.Options) storage.Options // NewTestSetup returns a new test setup for non-dockerized integration tests. func NewTestSetup( t *testing.T, opts TestOptions, fsOpts fs.Options, - storageOptFns ...storageOption, + storageOptFns ...StorageOption, ) (TestSetup, error) { if opts == nil { opts = NewTestOptions(t) @@ -465,7 +465,9 @@ func NewTestSetup( } for _, fn := range storageOptFns { - storageOpts = fn(storageOpts) + if fn != nil { + storageOpts = fn(storageOpts) + } } return &testSetup{ From a356b8803035ca5c65c7f9d929fb2a055ed398b8 Mon Sep 17 00:00:00 2001 From: Gediminas Date: Mon, 4 Jan 2021 17:03:31 +0200 Subject: [PATCH 05/14] fix --- src/dbnode/integration/options.go | 9 ++++++--- src/dbnode/integration/setup.go | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/dbnode/integration/options.go b/src/dbnode/integration/options.go index f173f97e11..4f258f8909 100644 --- a/src/dbnode/integration/options.go +++ b/src/dbnode/integration/options.go @@ -26,6 +26,7 @@ import ( "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" + "github.com/m3db/m3/src/dbnode/storage" "github.com/m3db/m3/src/dbnode/storage/block" "github.com/m3db/m3/src/dbnode/topology" @@ -295,7 +296,7 @@ type TestOptions interface { ReportInterval() time.Duration // SetStorageOptsFn sets the StorageOpts modifier - SetStorageOptsFn(StorageOption) + SetStorageOptsFn(StorageOption) TestOptions // StorageOptsFn returns the StorageOpts modifier StorageOptsFn() StorageOption @@ -684,8 +685,10 @@ func (o *options) ReportInterval() time.Duration { return o.reportInterval } -func (o *options) SetStorageOptsFn(storageOptsFn StorageOption) { - o.storageOptsFn = storageOptsFn +func (o *options) SetStorageOptsFn(storageOptsFn StorageOption) TestOptions { + opts := *o + opts.storageOptsFn = storageOptsFn + return &opts } func (o *options) StorageOptsFn() StorageOption { diff --git a/src/dbnode/integration/setup.go b/src/dbnode/integration/setup.go index ffb30ca80a..b98e716c3f 100644 --- a/src/dbnode/integration/setup.go +++ b/src/dbnode/integration/setup.go @@ -467,6 +467,9 @@ func NewTestSetup( for _, fn := range storageOptFns { if fn != nil { storageOpts = fn(storageOpts) + if storageOpts != nil && storageOpts.AdminClient() == nil { + storageOpts = storageOpts.SetAdminClient(adminClient) + } } } From b2df582cccc2580f614769ae8657253f334067e7 Mon Sep 17 00:00:00 2001 From: Gediminas Date: Wed, 6 Jan 2021 11:53:46 +0200 Subject: [PATCH 06/14] set storage with multi-addr client --- src/dbnode/integration/integration.go | 12 +++++++++++- src/dbnode/integration/options.go | 1 - 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/dbnode/integration/integration.go b/src/dbnode/integration/integration.go index 82e8892827..bca99fece1 100644 --- a/src/dbnode/integration/integration.go +++ b/src/dbnode/integration/integration.go @@ -93,6 +93,7 @@ func newMultiAddrAdminClient( topologyInitializer topology.Initializer, origin topology.Host, instrumentOpts instrument.Options, + customOpts ...client.CustomAdminOption, ) client.AdminClient { if adminOpts == nil { adminOpts = client.NewAdminOptions() @@ -105,6 +106,10 @@ func newMultiAddrAdminClient( SetTopologyInitializer(topologyInitializer). SetClusterConnectTimeout(time.Second).(client.AdminOptions) + for _, o := range customOpts { + adminOpts = o(adminOpts) + } + adminClient, err := client.NewAdminClient(adminOpts) require.NoError(t, err) @@ -122,6 +127,7 @@ type BootstrappableTestSetupOptions struct { DisablePeersBootstrapper bool UseTChannelClientForWriting bool EnableRepairs bool + AdminClientCustomOpts []client.CustomAdminOption } type closeFn func() @@ -171,6 +177,7 @@ func NewDefaultBootstrappableTestSetups( // nolint:gocyclo enableRepairs = setupOpts[i].EnableRepairs origin topology.Host instanceOpts = newMultiAddrTestOptions(opts, instance) + adminClientCustomOpts = setupOpts[i].AdminClientCustomOpts ) if finalBootstrapperToUse == "" { @@ -261,8 +268,11 @@ func NewDefaultBootstrappableTestSetups( // nolint:gocyclo adminOpts = adminOpts.SetFetchSeriesBlocksBatchConcurrency(bootstrapBlocksConcurrency) } adminOpts = adminOpts.SetStreamBlocksRetrier(retrier) + adminClient := newMultiAddrAdminClient( - t, adminOpts, topologyInitializer, origin, instrumentOpts) + t, adminOpts, topologyInitializer, origin, instrumentOpts, adminClientCustomOpts...) + setup.SetStorageOpts(setup.StorageOpts().SetAdminClient(adminClient)) + storageIdxOpts := setup.StorageOpts().IndexOptions() fsOpts := setup.StorageOpts().CommitLogOptions().FilesystemOptions() if usingPeersBootstrapper { diff --git a/src/dbnode/integration/options.go b/src/dbnode/integration/options.go index 4f258f8909..fed89e1ad3 100644 --- a/src/dbnode/integration/options.go +++ b/src/dbnode/integration/options.go @@ -26,7 +26,6 @@ import ( "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" - "github.com/m3db/m3/src/dbnode/storage" "github.com/m3db/m3/src/dbnode/storage/block" "github.com/m3db/m3/src/dbnode/topology" From a27a1881d518ed2c3c3df3d1e964ca6209b5562c Mon Sep 17 00:00:00 2001 From: Gediminas Date: Mon, 11 Jan 2021 16:18:09 +0200 Subject: [PATCH 07/14] lint --- src/dbnode/integration/setup.go | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dbnode/integration/setup.go b/src/dbnode/integration/setup.go index b98e716c3f..faa0c275d4 100644 --- a/src/dbnode/integration/setup.go +++ b/src/dbnode/integration/setup.go @@ -186,6 +186,7 @@ type TestSetup interface { InitializeBootstrappers(opts InitializeBootstrappersOptions) error } +// StorageOption is a reference to storage options function type StorageOption func(storage.Options) storage.Options // NewTestSetup returns a new test setup for non-dockerized integration tests. From 78704e312c2689819aea29dd2ec69428f0585b7b Mon Sep 17 00:00:00 2001 From: Gediminas Date: Tue, 12 Jan 2021 10:44:16 +0200 Subject: [PATCH 08/14] test fix --- src/dbnode/integration/integration.go | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dbnode/integration/integration.go b/src/dbnode/integration/integration.go index bca99fece1..5f039bc16c 100644 --- a/src/dbnode/integration/integration.go +++ b/src/dbnode/integration/integration.go @@ -232,6 +232,7 @@ func NewDefaultBootstrappableTestSetups( // nolint:gocyclo scope, _ := tally.NewRootScope(tally.ScopeOptions{Reporter: testStatsReporter}, 100*time.Millisecond) instrumentOpts = instrumentOpts.SetMetricsScope(scope) } + setup.SetStorageOpts(setup.StorageOpts().SetInstrumentOptions(instrumentOpts)) var ( bsOpts = newDefaulTestResultOptions(setup.StorageOpts()) From 4dd702ebf4ca8e3f4f14429ec069cfef4e7948d7 Mon Sep 17 00:00:00 2001 From: Gediminas Guoba Date: Tue, 12 Jan 2021 11:20:21 +0200 Subject: [PATCH 09/14] Update src/dbnode/integration/integration.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Linas Medžiūnas --- src/dbnode/integration/integration.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dbnode/integration/integration.go b/src/dbnode/integration/integration.go index 5f039bc16c..58963a82fd 100644 --- a/src/dbnode/integration/integration.go +++ b/src/dbnode/integration/integration.go @@ -116,7 +116,7 @@ func newMultiAddrAdminClient( return adminClient } -// BootstrappableTestSetupOptions defines options for test setups +// BootstrappableTestSetupOptions defines options for test setups. type BootstrappableTestSetupOptions struct { FinalBootstrapper string BootstrapBlocksBatchSize int From 519c7b637108b679fb2172c8169a90a86f4f0f10 Mon Sep 17 00:00:00 2001 From: Gediminas Guoba Date: Tue, 12 Jan 2021 11:20:33 +0200 Subject: [PATCH 10/14] Update src/dbnode/integration/integration.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Linas Medžiūnas --- src/dbnode/integration/integration.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dbnode/integration/integration.go b/src/dbnode/integration/integration.go index 58963a82fd..f121c80d4d 100644 --- a/src/dbnode/integration/integration.go +++ b/src/dbnode/integration/integration.go @@ -142,7 +142,7 @@ func newDefaulTestResultOptions( SetSeriesCachePolicy(storageOpts.SeriesCachePolicy()) } -// NewDefaultBootstrappableTestSetups creates dbnode test setups +// NewDefaultBootstrappableTestSetups creates dbnode test setups. func NewDefaultBootstrappableTestSetups( // nolint:gocyclo t *testing.T, opts TestOptions, From d7e69a0eed76858922b746177888801d547a6cf0 Mon Sep 17 00:00:00 2001 From: Gediminas Guoba Date: Tue, 12 Jan 2021 11:20:41 +0200 Subject: [PATCH 11/14] Update src/dbnode/integration/options.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Linas Medžiūnas --- src/dbnode/integration/options.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dbnode/integration/options.go b/src/dbnode/integration/options.go index fed89e1ad3..51585ad9bc 100644 --- a/src/dbnode/integration/options.go +++ b/src/dbnode/integration/options.go @@ -294,7 +294,7 @@ type TestOptions interface { // ReportInterval returns the time between reporting metrics within the system. ReportInterval() time.Duration - // SetStorageOptsFn sets the StorageOpts modifier + // SetStorageOptsFn sets the StorageOpts modifier. SetStorageOptsFn(StorageOption) TestOptions // StorageOptsFn returns the StorageOpts modifier From 6ae7dbb22d5d7fa7b592fd262d7ee300f787d680 Mon Sep 17 00:00:00 2001 From: Gediminas Guoba Date: Tue, 12 Jan 2021 11:20:54 +0200 Subject: [PATCH 12/14] Update src/dbnode/integration/setup.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Linas Medžiūnas --- src/dbnode/integration/setup.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dbnode/integration/setup.go b/src/dbnode/integration/setup.go index faa0c275d4..3b677ab6f3 100644 --- a/src/dbnode/integration/setup.go +++ b/src/dbnode/integration/setup.go @@ -186,7 +186,7 @@ type TestSetup interface { InitializeBootstrappers(opts InitializeBootstrappersOptions) error } -// StorageOption is a reference to storage options function +// StorageOption is a reference to storage options function. type StorageOption func(storage.Options) storage.Options // NewTestSetup returns a new test setup for non-dockerized integration tests. From 76a030b396bd9a81bb9bf6e354036b77c82e26b6 Mon Sep 17 00:00:00 2001 From: Gediminas Date: Tue, 12 Jan 2021 13:32:21 +0200 Subject: [PATCH 13/14] refactoring --- src/dbnode/integration/setup.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dbnode/integration/setup.go b/src/dbnode/integration/setup.go index 3b677ab6f3..3c4c05ce6c 100644 --- a/src/dbnode/integration/setup.go +++ b/src/dbnode/integration/setup.go @@ -468,11 +468,11 @@ func NewTestSetup( for _, fn := range storageOptFns { if fn != nil { storageOpts = fn(storageOpts) - if storageOpts != nil && storageOpts.AdminClient() == nil { - storageOpts = storageOpts.SetAdminClient(adminClient) - } } } + if storageOpts != nil && storageOpts.AdminClient() == nil { + storageOpts = storageOpts.SetAdminClient(adminClient) + } return &testSetup{ t: t, From b8f874f3dd96ed5570b3a16abd1878e715c8adb3 Mon Sep 17 00:00:00 2001 From: Gediminas Guoba Date: Tue, 12 Jan 2021 14:27:05 +0200 Subject: [PATCH 14/14] Update src/dbnode/integration/options.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Linas Medžiūnas --- src/dbnode/integration/options.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dbnode/integration/options.go b/src/dbnode/integration/options.go index 51585ad9bc..f2432bd0b4 100644 --- a/src/dbnode/integration/options.go +++ b/src/dbnode/integration/options.go @@ -297,7 +297,7 @@ type TestOptions interface { // SetStorageOptsFn sets the StorageOpts modifier. SetStorageOptsFn(StorageOption) TestOptions - // StorageOptsFn returns the StorageOpts modifier + // StorageOptsFn returns the StorageOpts modifier. StorageOptsFn() StorageOption }