MCPcopy
hub / github.com/grafana/tempo / TestConfigureGenerator

Function TestConfigureGenerator

cmd/tempo/app/modules_test.go:69–112  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

67}
68
69func TestConfigureGenerator(t *testing.T) {
70 t.Run("single binary does not consume from kafka", func(t *testing.T) {
71 cfg := NewDefaultConfig()
72 cfg.Target = SingleBinary
73 cfg.Ingest.Kafka.Topic = "tempo"
74 cfg.Ingest.Kafka.ConsumerGroup = "custom"
75
76 app := &App{cfg: *cfg}
77 app.configureGenerator()
78
79 assert.False(t, app.cfg.Generator.ConsumeFromKafka)
80 assert.Equal(t, "tempo", app.cfg.Generator.Ingest.Kafka.Topic)
81 assert.Equal(t, "custom", app.cfg.Generator.Ingest.Kafka.ConsumerGroup)
82 })
83
84 t.Run("partition ring mode consumes from kafka with fixed consumer group", func(t *testing.T) {
85 cfg := NewDefaultConfig()
86 cfg.Target = MetricsGenerator
87 cfg.Generator.RingMode = generator.RingModePartition
88 cfg.Ingest.Kafka.Topic = "tempo"
89 cfg.Ingest.Kafka.ConsumerGroup = "custom"
90
91 app := &App{cfg: *cfg}
92 app.configureGenerator()
93
94 assert.True(t, app.cfg.Generator.ConsumeFromKafka)
95 assert.Equal(t, "tempo", app.cfg.Generator.Ingest.Kafka.Topic)
96 assert.Equal(t, generator.ConsumerGroup, app.cfg.Generator.Ingest.Kafka.ConsumerGroup)
97 })
98
99 t.Run("generator ring mode consumes from kafka without overriding consumer group", func(t *testing.T) {
100 cfg := NewDefaultConfig()
101 cfg.Target = MetricsGenerator
102 cfg.Generator.RingMode = generator.RingModeGenerator
103 cfg.Ingest.Kafka.Topic = "tempo"
104 cfg.Ingest.Kafka.ConsumerGroup = "custom"
105
106 app := &App{cfg: *cfg}
107 app.configureGenerator()
108
109 assert.True(t, app.cfg.Generator.ConsumeFromKafka)
110 assert.Equal(t, "custom", app.cfg.Generator.Ingest.Kafka.ConsumerGroup)
111 })
112}
113
114func TestGeneratorRingReader(t *testing.T) {
115 partitionRing := &dskitring.PartitionInstanceRing{}

Callers

nothing calls this directly

Calls 4

configureGeneratorMethod · 0.95
NewDefaultConfigFunction · 0.85
RunMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected