github.com/m3db/m3@v1.5.0/src/dbnode/integration/options.go (about) 1 // Copyright (c) 2016 Uber Technologies, Inc. 2 // 3 // Permission is hereby granted, free of charge, to any person obtaining a copy 4 // of this software and associated documentation files (the "Software"), to deal 5 // in the Software without restriction, including without limitation the rights 6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 // copies of the Software, and to permit persons to whom the Software is 8 // furnished to do so, subject to the following conditions: 9 // 10 // The above copyright notice and this permission notice shall be included in 11 // all copies or substantial portions of the Software. 12 // 13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 // THE SOFTWARE. 20 21 package integration 22 23 import ( 24 "testing" 25 "time" 26 27 "github.com/m3db/m3/src/dbnode/client" 28 "github.com/m3db/m3/src/dbnode/namespace" 29 "github.com/m3db/m3/src/dbnode/retention" 30 "github.com/m3db/m3/src/dbnode/storage/block" 31 "github.com/m3db/m3/src/dbnode/topology" 32 33 "github.com/stretchr/testify/require" 34 ) 35 36 const ( 37 // defaultID is the default node ID 38 defaultID = "testhost" 39 40 // defaultServerStateChangeTimeout is the default time we wait for a server to change its state. 41 defaultServerStateChangeTimeout = 10 * time.Minute 42 43 // defaultClusterConnectionTimeout is the default time we wait for cluster connections to be established. 44 defaultClusterConnectionTimeout = 2 * time.Second 45 46 // defaultReadRequestTimeout is the default read request timeout. 47 defaultReadRequestTimeout = 2 * time.Second 48 49 // defaultWriteRequestTimeout is the default write request timeout. 50 defaultWriteRequestTimeout = 2 * time.Second 51 52 // defaultTruncateRequestTimeout is the default truncate request timeout. 53 defaultTruncateRequestTimeout = 2 * time.Second 54 55 // defaultFetchRequestTimeout is the default fetch request timeout 56 defaultFetchRequestTimeout = 15 * time.Second 57 58 // defaultWorkerPoolSize is the default number of workers in the worker pool. 59 defaultWorkerPoolSize = 10 60 61 // defaultTickMinimumInterval is the default minimum tick interval. 62 defaultTickMinimumInterval = 1 * time.Second 63 64 // defaultTickCancellationCheckInterval is the default minimum tick cancellation check interval. 65 defaultTickCancellationCheckInterval = 1 * time.Second 66 67 // defaultUseTChannelClientForReading determines whether we use the tchannel client for reading by default. 68 defaultUseTChannelClientForReading = false 69 70 // defaultUseTChannelClientForWriting determines whether we use the tchannel client for writing by default. 71 defaultUseTChannelClientForWriting = false 72 73 // defaultUseTChannelClientForTruncation determines whether we use the tchannel client for truncation by default. 74 defaultUseTChannelClientForTruncation = true 75 76 // defaultWriteConsistencyLevel is the default write consistency level. This 77 // should match the default in client/options. 78 defaultWriteConsistencyLevel = topology.ConsistencyLevelMajority 79 80 // defaultNumShards is the default number of shards to use. 81 defaultNumShards = 12 82 83 // defaultMaxWiredBlocks is the default max number of wired blocks to keep in memory at once 84 defaultMaxWiredBlocks = 10 85 86 // defaultWriteNewSeriesAsync inserts, and index series' synchronously by default. 87 defaultWriteNewSeriesAsync = false 88 89 // defaultReportInterval is the default time interval of reporting metrics within the system. 90 defaultReportInterval = time.Second 91 ) 92 93 var ( 94 // DefaultIntegrationTestRetentionOpts are default integration test retention options. 95 DefaultIntegrationTestRetentionOpts = retention.NewOptions().SetRetentionPeriod(6 * time.Hour) 96 ) 97 98 // TestOptions contains integration test options. 99 type TestOptions interface { 100 // SetNamespaces sets the namespaces. 101 SetNamespaces(value []namespace.Metadata) TestOptions 102 103 // Namespaces returns the namespaces. 104 Namespaces() []namespace.Metadata 105 106 // SetNamespaceInitializer sets the namespace initializer, 107 // if this is set, it superseeds Namespaces() 108 SetNamespaceInitializer(value namespace.Initializer) TestOptions 109 110 // NamespaceInitializer returns the namespace initializer 111 NamespaceInitializer() namespace.Initializer 112 113 // SetID sets the node ID. 114 SetID(value string) TestOptions 115 116 // ID returns the node ID. 117 ID() string 118 119 // SetTickMinimumInterval sets the tick interval. 120 SetTickMinimumInterval(value time.Duration) TestOptions 121 122 // TickMinimumInterval returns the tick interval. 123 TickMinimumInterval() time.Duration 124 125 // SetTickCancellationCheckInterval sets the tick cancellation check interval. 126 SetTickCancellationCheckInterval(value time.Duration) TestOptions 127 128 // TickCancellationCheckInterval returns the tick cancellation check interval. 129 TickCancellationCheckInterval() time.Duration 130 131 // SetHTTPClusterAddr sets the http cluster address. 132 SetHTTPClusterAddr(value string) TestOptions 133 134 // HTTPClusterAddr returns the http cluster address. 135 HTTPClusterAddr() string 136 137 // SetTChannelClusterAddr sets the tchannel cluster address. 138 SetTChannelClusterAddr(value string) TestOptions 139 140 // TChannelClusterAddr returns the tchannel cluster address. 141 TChannelClusterAddr() string 142 143 // SetHTTPNodeAddr sets the http node address. 144 SetHTTPNodeAddr(value string) TestOptions 145 146 // HTTPNodeAddr returns the http node address. 147 HTTPNodeAddr() string 148 149 // SetTChannelNodeAddr sets the tchannel node address. 150 SetTChannelNodeAddr(value string) TestOptions 151 152 // TChannelNodeAddr returns the tchannel node address. 153 TChannelNodeAddr() string 154 155 // SetHTTPDebugAddr sets the http debug address. 156 SetHTTPDebugAddr(value string) TestOptions 157 158 // HTTPDebugAddr returns the http debug address. 159 HTTPDebugAddr() string 160 161 // SetServerStateChangeTimeout sets the server state change timeout. 162 SetServerStateChangeTimeout(value time.Duration) TestOptions 163 164 // ServerStateChangeTimeout returns the server state change timeout. 165 ServerStateChangeTimeout() time.Duration 166 167 // SetClusterConnectionTimeout sets the cluster connection timeout. 168 SetClusterConnectionTimeout(value time.Duration) TestOptions 169 170 // ClusterConnectionTimeout returns the cluster connection timeout. 171 ClusterConnectionTimeout() time.Duration 172 173 // SetReadRequestTimeout sets the read request timeout. 174 SetReadRequestTimeout(value time.Duration) TestOptions 175 176 // ReadRequestTimeout returns the read request timeout. 177 ReadRequestTimeout() time.Duration 178 179 // SetWriteRequestTimeout sets the write request timeout. 180 SetWriteRequestTimeout(value time.Duration) TestOptions 181 182 // WriteRequestTimeout returns the write request timeout. 183 WriteRequestTimeout() time.Duration 184 185 // SetTruncateRequestTimeout sets the truncate request timeout. 186 SetTruncateRequestTimeout(value time.Duration) TestOptions 187 188 // TruncateRequestTimeout returns the truncate request timeout. 189 TruncateRequestTimeout() time.Duration 190 191 // SetFetchRequestTimeout sets the fetch request timeout. 192 SetFetchRequestTimeout(value time.Duration) TestOptions 193 194 // FetchRequestTimeout returns the fetch request timeout. 195 FetchRequestTimeout() time.Duration 196 197 // SetWorkerPoolSize sets the number of workers in the worker pool. 198 SetWorkerPoolSize(value int) TestOptions 199 200 // WorkerPoolSize returns the number of workers in the worker pool. 201 WorkerPoolSize() int 202 203 // SetClusterDatabaseTopologyInitializer sets the topology initializer that 204 // is used when creating a cluster database 205 SetClusterDatabaseTopologyInitializer(value topology.Initializer) TestOptions 206 207 // ClusterDatabaseTopologyInitializer returns the topology initializer that 208 // is used when creating a cluster database 209 ClusterDatabaseTopologyInitializer() topology.Initializer 210 211 // SetCustomClientAdminOptions sets any custom admin options to set. 212 SetCustomClientAdminOptions(value []client.CustomAdminOption) TestOptions 213 214 // CustomClientAdminOptions returns any custom admin options to set. 215 CustomClientAdminOptions() []client.CustomAdminOption 216 217 // SetUseTChannelClientForReading sets whether we use the tchannel client for reading. 218 SetUseTChannelClientForReading(value bool) TestOptions 219 220 // UseTChannelClientForReading returns whether we use the tchannel client for reading. 221 UseTChannelClientForReading() bool 222 223 // SetUseTChannelClientForWriting sets whether we use the tchannel client for writing. 224 SetUseTChannelClientForWriting(value bool) TestOptions 225 226 // UseTChannelClientForWriting returns whether we use the tchannel client for writing. 227 UseTChannelClientForWriting() bool 228 229 // SetUseTChannelClientForTruncation sets whether we use the tchannel client for truncation. 230 SetUseTChannelClientForTruncation(value bool) TestOptions 231 232 // UseTChannelClientForTruncation returns whether we use the tchannel client for truncation. 233 UseTChannelClientForTruncation() bool 234 235 // SetDatabaseBlockRetrieverManager sets the block retriever manager to 236 // use when bootstrapping retrievable blocks instead of blocks 237 // containing data. 238 // If you don't wish to bootstrap retrievable blocks instead of 239 // blocks containing data then do not set this manager. 240 // You can opt into which namespace you wish to have this enabled for 241 // by returning nil instead of a result when creating a new block retriever 242 // for a namespace from the manager. 243 SetDatabaseBlockRetrieverManager( 244 value block.DatabaseBlockRetrieverManager, 245 ) TestOptions 246 247 // NewBlockRetrieverFn returns the new block retriever constructor to 248 // use when bootstrapping retrievable blocks instead of blocks 249 // containing data. 250 DatabaseBlockRetrieverManager() block.DatabaseBlockRetrieverManager 251 252 // SetVerifySeriesDebugFilePathPrefix sets the file path prefix for writing a debug file of series comparisons. 253 SetVerifySeriesDebugFilePathPrefix(value string) TestOptions 254 255 // VerifySeriesDebugFilePathPrefix returns the file path prefix for writing a debug file of series comparisons. 256 VerifySeriesDebugFilePathPrefix() string 257 258 // WriteConsistencyLevel returns the consistency level for writing with the m3db client. 259 WriteConsistencyLevel() topology.ConsistencyLevel 260 261 // SetWriteConsistencyLevel sets the consistency level for writing with the m3db client. 262 SetWriteConsistencyLevel(value topology.ConsistencyLevel) TestOptions 263 264 // NumShards returns the number of shards to use. 265 NumShards() int 266 267 // SetNumShards sets the number of shards to use. 268 SetNumShards(value int) TestOptions 269 270 // ShardSetOptions returns the test shard set options. 271 ShardSetOptions() *TestShardSetOptions 272 273 // SetShardSetOptions returns the test shard set options. 274 SetShardSetOptions(value *TestShardSetOptions) TestOptions 275 276 // MaxWiredBlocks returns the maximum number of wired blocks to keep in memory using the LRU cache. 277 MaxWiredBlocks() uint 278 279 // SetMaxWiredBlocks sets the maximum number of wired blocks to keep in memory using the LRU cache. 280 SetMaxWiredBlocks(value uint) TestOptions 281 282 // SetWriteNewSeriesAsync sets whether we insert/index asynchronously. 283 SetWriteNewSeriesAsync(bool) TestOptions 284 285 // WriteNewSeriesAsync returns whether we insert/index asynchronously. 286 WriteNewSeriesAsync() bool 287 288 // SetFilePathPrefix sets the file path prefix. 289 SetFilePathPrefix(value string) TestOptions 290 291 // FilePathPrefix returns the file path prefix. 292 FilePathPrefix() string 293 294 // SetProtoEncoding turns on proto encoder. 295 SetProtoEncoding(value bool) TestOptions 296 297 // ProtoEncoding returns whether proto encoder is turned on. 298 ProtoEncoding() bool 299 300 // SetAssertTestDataEqual sets a comparator to compare two byte arrays, 301 // useful for proto-encoded annotations. 302 SetAssertTestDataEqual(value assertTestDataEqual) TestOptions 303 304 // AssertTestDataEqual returns a comparator to compare two byte arrays. 305 AssertTestDataEqual() assertTestDataEqual 306 307 // SetNowFn will set the now fn. 308 SetNowFn(value func() time.Time) TestOptions 309 310 // NowFn returns the now fn. 311 NowFn() func() time.Time 312 313 // SetReportInterval sets the time between reporting metrics within the system. 314 SetReportInterval(value time.Duration) TestOptions 315 316 // ReportInterval returns the time between reporting metrics within the system. 317 ReportInterval() time.Duration 318 319 // SetStorageOptsFn sets the StorageOpts modifier. 320 SetStorageOptsFn(StorageOption) TestOptions 321 322 // StorageOptsFn returns the StorageOpts modifier. 323 StorageOptsFn() StorageOption 324 325 // SetCustomAdminOptions sets custom options to apply to the admin client connection. 326 SetCustomAdminOptions(value []client.CustomAdminOption) TestOptions 327 328 // CustomAdminOptions gets custom options to apply to the admin client connection. 329 CustomAdminOptions() []client.CustomAdminOption 330 } 331 332 type options struct { 333 namespaces []namespace.Metadata 334 nsInitializer namespace.Initializer 335 id string 336 tickMinimumInterval time.Duration 337 tickCancellationCheckInterval time.Duration 338 httpClusterAddr string 339 tchannelClusterAddr string 340 httpNodeAddr string 341 tchannelNodeAddr string 342 httpDebugAddr string 343 filePathPrefix string 344 serverStateChangeTimeout time.Duration 345 clusterConnectionTimeout time.Duration 346 readRequestTimeout time.Duration 347 writeRequestTimeout time.Duration 348 truncateRequestTimeout time.Duration 349 fetchRequestTimeout time.Duration 350 workerPoolSize int 351 clusterDatabaseTopologyInitializer topology.Initializer 352 blockRetrieverManager block.DatabaseBlockRetrieverManager 353 verifySeriesDebugFilePathPrefix string 354 writeConsistencyLevel topology.ConsistencyLevel 355 numShards int 356 shardSetOptions *TestShardSetOptions 357 maxWiredBlocks uint 358 customClientAdminOptions []client.CustomAdminOption 359 useTChannelClientForReading bool 360 useTChannelClientForWriting bool 361 useTChannelClientForTruncation bool 362 writeNewSeriesAsync bool 363 protoEncoding bool 364 assertEqual assertTestDataEqual 365 nowFn func() time.Time 366 reportInterval time.Duration 367 storageOptsFn StorageOption 368 customAdminOpts []client.CustomAdminOption 369 } 370 371 // NewTestOptions returns a new set of integration test options. 372 func NewTestOptions(t *testing.T) TestOptions { 373 var namespaces []namespace.Metadata 374 nsOpts := namespace.NewOptions(). 375 SetRepairEnabled(false). 376 SetRetentionOptions(DefaultIntegrationTestRetentionOpts) 377 378 for _, ns := range testNamespaces { 379 md, err := namespace.NewMetadata(ns, nsOpts) 380 require.NoError(t, err) 381 namespaces = append(namespaces, md) 382 } 383 384 return &options{ 385 namespaces: namespaces, 386 id: defaultID, 387 tickMinimumInterval: defaultTickMinimumInterval, 388 tickCancellationCheckInterval: defaultTickCancellationCheckInterval, 389 serverStateChangeTimeout: defaultServerStateChangeTimeout, 390 clusterConnectionTimeout: defaultClusterConnectionTimeout, 391 readRequestTimeout: defaultReadRequestTimeout, 392 writeRequestTimeout: defaultWriteRequestTimeout, 393 truncateRequestTimeout: defaultTruncateRequestTimeout, 394 fetchRequestTimeout: defaultFetchRequestTimeout, 395 workerPoolSize: defaultWorkerPoolSize, 396 writeConsistencyLevel: defaultWriteConsistencyLevel, 397 numShards: defaultNumShards, 398 maxWiredBlocks: defaultMaxWiredBlocks, 399 useTChannelClientForReading: defaultUseTChannelClientForReading, 400 useTChannelClientForWriting: defaultUseTChannelClientForWriting, 401 useTChannelClientForTruncation: defaultUseTChannelClientForTruncation, 402 writeNewSeriesAsync: defaultWriteNewSeriesAsync, 403 reportInterval: defaultReportInterval, 404 } 405 } 406 407 func (o *options) SetNamespaces(value []namespace.Metadata) TestOptions { 408 opts := *o 409 opts.namespaces = opts.namespaces[:0] 410 opts.namespaces = value 411 return &opts 412 } 413 414 func (o *options) Namespaces() []namespace.Metadata { 415 return o.namespaces 416 } 417 418 func (o *options) SetNamespaceInitializer(value namespace.Initializer) TestOptions { 419 opts := *o 420 opts.nsInitializer = value 421 return &opts 422 } 423 424 func (o *options) NamespaceInitializer() namespace.Initializer { 425 return o.nsInitializer 426 } 427 428 func (o *options) SetID(value string) TestOptions { 429 opts := *o 430 opts.id = value 431 return &opts 432 } 433 434 func (o *options) ID() string { 435 return o.id 436 } 437 438 func (o *options) SetTickMinimumInterval(value time.Duration) TestOptions { 439 opts := *o 440 opts.tickMinimumInterval = value 441 return &opts 442 } 443 444 func (o *options) TickMinimumInterval() time.Duration { 445 return o.tickMinimumInterval 446 } 447 448 func (o *options) SetTickCancellationCheckInterval(value time.Duration) TestOptions { 449 opts := *o 450 opts.tickCancellationCheckInterval = value 451 return &opts 452 } 453 454 func (o *options) TickCancellationCheckInterval() time.Duration { 455 return o.tickCancellationCheckInterval 456 } 457 458 func (o *options) SetHTTPClusterAddr(value string) TestOptions { 459 opts := *o 460 opts.httpClusterAddr = value 461 return &opts 462 } 463 464 func (o *options) HTTPClusterAddr() string { 465 return o.httpClusterAddr 466 } 467 468 func (o *options) SetTChannelClusterAddr(value string) TestOptions { 469 opts := *o 470 opts.tchannelClusterAddr = value 471 return &opts 472 } 473 474 func (o *options) TChannelClusterAddr() string { 475 return o.tchannelClusterAddr 476 } 477 478 func (o *options) SetHTTPNodeAddr(value string) TestOptions { 479 opts := *o 480 opts.httpNodeAddr = value 481 return &opts 482 } 483 484 func (o *options) HTTPNodeAddr() string { 485 return o.httpNodeAddr 486 } 487 488 func (o *options) SetTChannelNodeAddr(value string) TestOptions { 489 opts := *o 490 opts.tchannelNodeAddr = value 491 return &opts 492 } 493 494 func (o *options) TChannelNodeAddr() string { 495 return o.tchannelNodeAddr 496 } 497 498 func (o *options) SetHTTPDebugAddr(value string) TestOptions { 499 opts := *o 500 opts.httpDebugAddr = value 501 return &opts 502 } 503 504 func (o *options) HTTPDebugAddr() string { 505 return o.httpDebugAddr 506 } 507 508 func (o *options) SetServerStateChangeTimeout(value time.Duration) TestOptions { 509 opts := *o 510 opts.serverStateChangeTimeout = value 511 return &opts 512 } 513 514 func (o *options) ServerStateChangeTimeout() time.Duration { 515 return o.serverStateChangeTimeout 516 } 517 518 func (o *options) SetClusterConnectionTimeout(value time.Duration) TestOptions { 519 opts := *o 520 opts.clusterConnectionTimeout = value 521 return &opts 522 } 523 524 func (o *options) ClusterConnectionTimeout() time.Duration { 525 return o.clusterConnectionTimeout 526 } 527 528 func (o *options) SetReadRequestTimeout(value time.Duration) TestOptions { 529 opts := *o 530 opts.readRequestTimeout = value 531 return &opts 532 } 533 534 func (o *options) ReadRequestTimeout() time.Duration { 535 return o.readRequestTimeout 536 } 537 538 func (o *options) SetWriteRequestTimeout(value time.Duration) TestOptions { 539 opts := *o 540 opts.writeRequestTimeout = value 541 return &opts 542 } 543 544 func (o *options) WriteRequestTimeout() time.Duration { 545 return o.writeRequestTimeout 546 } 547 548 func (o *options) SetTruncateRequestTimeout(value time.Duration) TestOptions { 549 opts := *o 550 opts.truncateRequestTimeout = value 551 return &opts 552 } 553 554 func (o *options) TruncateRequestTimeout() time.Duration { 555 return o.truncateRequestTimeout 556 } 557 558 func (o *options) SetFetchRequestTimeout(value time.Duration) TestOptions { 559 opts := *o 560 opts.fetchRequestTimeout = value 561 return &opts 562 } 563 564 func (o *options) FetchRequestTimeout() time.Duration { 565 return o.fetchRequestTimeout 566 } 567 568 func (o *options) SetWorkerPoolSize(value int) TestOptions { 569 opts := *o 570 opts.workerPoolSize = value 571 return &opts 572 } 573 574 func (o *options) WorkerPoolSize() int { 575 return o.workerPoolSize 576 } 577 578 func (o *options) SetClusterDatabaseTopologyInitializer(value topology.Initializer) TestOptions { 579 opts := *o 580 opts.clusterDatabaseTopologyInitializer = value 581 return &opts 582 } 583 584 func (o *options) ClusterDatabaseTopologyInitializer() topology.Initializer { 585 return o.clusterDatabaseTopologyInitializer 586 } 587 588 func (o *options) SetCustomClientAdminOptions(value []client.CustomAdminOption) TestOptions { 589 opts := *o 590 opts.customClientAdminOptions = value 591 return &opts 592 } 593 594 func (o *options) CustomClientAdminOptions() []client.CustomAdminOption { 595 return o.customClientAdminOptions 596 } 597 598 func (o *options) SetUseTChannelClientForReading(value bool) TestOptions { 599 opts := *o 600 opts.useTChannelClientForReading = value 601 return &opts 602 } 603 604 func (o *options) UseTChannelClientForReading() bool { 605 return o.useTChannelClientForReading 606 } 607 608 func (o *options) SetUseTChannelClientForWriting(value bool) TestOptions { 609 opts := *o 610 opts.useTChannelClientForWriting = value 611 return &opts 612 } 613 614 func (o *options) UseTChannelClientForWriting() bool { 615 return o.useTChannelClientForWriting 616 } 617 618 func (o *options) SetUseTChannelClientForTruncation(value bool) TestOptions { 619 opts := *o 620 opts.useTChannelClientForTruncation = value 621 return &opts 622 } 623 624 func (o *options) UseTChannelClientForTruncation() bool { 625 return o.useTChannelClientForTruncation 626 } 627 628 func (o *options) SetDatabaseBlockRetrieverManager( 629 value block.DatabaseBlockRetrieverManager, 630 ) TestOptions { 631 opts := *o 632 opts.blockRetrieverManager = value 633 return &opts 634 } 635 636 func (o *options) DatabaseBlockRetrieverManager() block.DatabaseBlockRetrieverManager { 637 return o.blockRetrieverManager 638 } 639 640 func (o *options) SetVerifySeriesDebugFilePathPrefix(value string) TestOptions { 641 opts := *o 642 opts.verifySeriesDebugFilePathPrefix = value 643 return &opts 644 } 645 646 func (o *options) VerifySeriesDebugFilePathPrefix() string { 647 return o.verifySeriesDebugFilePathPrefix 648 } 649 650 func (o *options) WriteConsistencyLevel() topology.ConsistencyLevel { 651 return o.writeConsistencyLevel 652 } 653 654 func (o *options) SetWriteConsistencyLevel(cLevel topology.ConsistencyLevel) TestOptions { 655 opts := *o 656 opts.writeConsistencyLevel = cLevel 657 return &opts 658 } 659 660 func (o *options) NumShards() int { 661 return o.numShards 662 } 663 664 func (o *options) SetNumShards(value int) TestOptions { 665 opts := *o 666 opts.numShards = value 667 return &opts 668 } 669 670 func (o *options) ShardSetOptions() *TestShardSetOptions { 671 return o.shardSetOptions 672 } 673 674 func (o *options) SetShardSetOptions(value *TestShardSetOptions) TestOptions { 675 opts := *o 676 opts.shardSetOptions = value 677 return &opts 678 } 679 680 func (o *options) MaxWiredBlocks() uint { 681 return o.maxWiredBlocks 682 } 683 684 func (o *options) SetMaxWiredBlocks(value uint) TestOptions { 685 opts := *o 686 opts.maxWiredBlocks = value 687 return &opts 688 } 689 690 func (o *options) SetWriteNewSeriesAsync(value bool) TestOptions { 691 opts := *o 692 opts.writeNewSeriesAsync = value 693 return &opts 694 } 695 696 func (o *options) WriteNewSeriesAsync() bool { 697 return o.writeNewSeriesAsync 698 } 699 700 func (o *options) SetFilePathPrefix(value string) TestOptions { 701 opts := *o 702 opts.filePathPrefix = value 703 return &opts 704 } 705 706 func (o *options) FilePathPrefix() string { 707 return o.filePathPrefix 708 } 709 710 func (o *options) SetProtoEncoding(value bool) TestOptions { 711 opts := *o 712 opts.protoEncoding = value 713 return &opts 714 } 715 716 func (o *options) ProtoEncoding() bool { 717 return o.protoEncoding 718 } 719 720 func (o *options) SetAssertTestDataEqual(value assertTestDataEqual) TestOptions { 721 opts := *o 722 opts.assertEqual = value 723 return &opts 724 } 725 726 func (o *options) AssertTestDataEqual() assertTestDataEqual { 727 return o.assertEqual 728 } 729 730 func (o *options) SetNowFn(value func() time.Time) TestOptions { 731 opts := *o 732 opts.nowFn = value 733 return &opts 734 } 735 736 func (o *options) NowFn() func() time.Time { 737 return o.nowFn 738 } 739 740 func (o *options) SetReportInterval(value time.Duration) TestOptions { 741 opts := *o 742 opts.reportInterval = value 743 return &opts 744 } 745 746 func (o *options) ReportInterval() time.Duration { 747 return o.reportInterval 748 } 749 750 func (o *options) SetStorageOptsFn(storageOptsFn StorageOption) TestOptions { 751 opts := *o 752 opts.storageOptsFn = storageOptsFn 753 return &opts 754 } 755 756 func (o *options) StorageOptsFn() StorageOption { 757 return o.storageOptsFn 758 } 759 760 func (o *options) SetCustomAdminOptions(value []client.CustomAdminOption) TestOptions { 761 opts := *o 762 opts.customAdminOpts = value 763 return &opts 764 } 765 766 func (o *options) CustomAdminOptions() []client.CustomAdminOption { 767 return o.customAdminOpts 768 }