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

Function runMigrateConfig

cmd/tempo-cli/cmd-migrate-config_test.go:364–390  ·  view source on GitHub ↗

runMigrateConfig runs the full migrate config pipeline end-to-end, capturing stdout. Warnings printed to stderr are not captured here.

(t *testing.T, inputFile, kafkaAddress, kafkaTopic, mode string)

Source from the content-addressed store, hash-verified

362// runMigrateConfig runs the full migrate config pipeline end-to-end, capturing
363// stdout. Warnings printed to stderr are not captured here.
364func runMigrateConfig(t *testing.T, inputFile, kafkaAddress, kafkaTopic, mode string) (stdout string, err error) {
365 t.Helper()
366 cmd := &migrateConfigCmd{
367 ConfigFile: inputFile,
368 KafkaAddress: kafkaAddress,
369 KafkaTopic: kafkaTopic,
370 Mode: mode,
371 }
372
373 // Capture stdout.
374 orig := os.Stdout
375 r, w, _ := os.Pipe()
376 os.Stdout = w
377 defer func() { os.Stdout = orig }()
378
379 done := make(chan struct{})
380 var buf bytes.Buffer
381 go func() {
382 _, _ = io.Copy(&buf, r)
383 close(done)
384 }()
385
386 err = cmd.Run(nil)
387 _ = w.Close()
388 <-done
389 return buf.String(), err
390}
391
392func TestMigrateConfigEndToEnd(t *testing.T) {
393 tests := []struct {

Callers 1

Calls 3

RunMethod · 0.95
CloseMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected