(t testing.TB, tmpDir string)
| 596 | } |
| 597 | |
| 598 | func defaultConfig(t testing.TB, tmpDir string) Config { |
| 599 | cfg := Config{} |
| 600 | cfg.RegisterFlagsAndApplyDefaults("", flag.NewFlagSet("", flag.ContinueOnError)) |
| 601 | cfg.WAL.Filepath = tmpDir |
| 602 | cfg.WAL.Version = encoding.LatestEncoding().Version() |
| 603 | cfg.ShutdownMarkerDir = tmpDir |
| 604 | |
| 605 | cfg.BlockConfig.RegisterFlagsAndApplyDefaults("", flag.NewFlagSet("", flag.ContinueOnError)) |
| 606 | cfg.BlockConfig.Version = encoding.LatestEncoding().Version() |
| 607 | |
| 608 | // Set up test Kafka configuration |
| 609 | const testTopic = "traces" |
| 610 | _, kafkaAddr := testkafka.CreateCluster(t, 1, testTopic) |
| 611 | |
| 612 | cfg.IngestConfig.Kafka.Address = kafkaAddr |
| 613 | cfg.IngestConfig.Kafka.Topic = testTopic |
| 614 | cfg.IngestConfig.Kafka.ConsumerGroup = "test-consumer-group" |
| 615 | |
| 616 | cfg.holdAllBackgroundProcesses = true // note that the default testing live store disables background processes so we can deterministically run tests |
| 617 | |
| 618 | cfg.Ring.RegisterFlagsAndApplyDefaults("", flag.NewFlagSet("", flag.ContinueOnError)) |
| 619 | // flagext.DefaultValues(&cfg.Ring) |
| 620 | mockParititionStore, _ := consul.NewInMemoryClient( |
| 621 | ring.GetPartitionRingCodec(), |
| 622 | log.NewNopLogger(), |
| 623 | nil, |
| 624 | ) |
| 625 | mockStore, _ := consul.NewInMemoryClient( |
| 626 | ring.GetCodec(), |
| 627 | log.NewNopLogger(), |
| 628 | nil, |
| 629 | ) |
| 630 | |
| 631 | cfg.Ring.KVStore.Mock = mockStore |
| 632 | cfg.Ring.ListenPort = 0 |
| 633 | cfg.Ring.InstanceAddr = "localhost" |
| 634 | cfg.Ring.InstanceID = "test-1" |
| 635 | cfg.PartitionRing.KVStore.Mock = mockParititionStore |
| 636 | return cfg |
| 637 | } |
| 638 | |
| 639 | func defaultLiveStore(t testing.TB, tmpDir string) (*LiveStore, error) { |
| 640 | cfg := defaultConfig(t, tmpDir) |
no test coverage detected