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

Function TestShim_integration

modules/distributor/receiver/shim_test.go:39–149  ·  view source on GitHub ↗

These tests use the OpenTelemetry Collector Exporters to validate the different protocols

(t *testing.T)

Source from the content-addressed store, hash-verified

37
38// These tests use the OpenTelemetry Collector Exporters to validate the different protocols
39func TestShim_integration(t *testing.T) {
40 randomTraces := testdata.GenerateTraces(5)
41 var headers configopaque.MapList
42 headers.Set(generator.NoGenerateMetricsContextKey, "true")
43
44 testCases := []struct {
45 name string
46 receiverCfg map[string]interface{}
47 factory exporter.Factory
48 exporterCfg component.Config
49 expectedTransport string
50 }{
51 {
52 name: "otlpexporter",
53 receiverCfg: map[string]interface{}{
54 "otlp": map[string]interface{}{
55 "protocols": map[string]interface{}{
56 "grpc": nil,
57 },
58 },
59 },
60 factory: otlpexporter.NewFactory(),
61 exporterCfg: &otlpexporter.Config{
62 ClientConfig: configgrpc.ClientConfig{
63 Endpoint: "127.0.0.1:4317",
64 TLS: configtls.ClientConfig{
65 Insecure: true,
66 },
67 Headers: headers,
68 },
69 },
70 expectedTransport: "grpc",
71 },
72 {
73 name: "otlphttpexporter - JSON encoding",
74 receiverCfg: map[string]interface{}{
75 "otlp": map[string]interface{}{
76 "protocols": map[string]interface{}{
77 "http": nil,
78 },
79 },
80 },
81 factory: otlphttpexporter.NewFactory(),
82 exporterCfg: &otlphttpexporter.Config{
83 ClientConfig: confighttp.ClientConfig{
84 Endpoint: "http://127.0.0.1:4318",
85 Headers: headers,
86 },
87 Encoding: otlphttpexporter.EncodingJSON,
88 },
89 expectedTransport: "http",
90 },
91 {
92 name: "otlphttpexporter - proto encoding",
93 receiverCfg: map[string]interface{}{
94 "otlp": map[string]interface{}{
95 "protocols": map[string]interface{}{
96 "http": nil,

Callers

nothing calls this directly

Calls 8

GetAndClearTracesMethod · 0.95
runReceiverShimFunction · 0.85
runOTelExporterFunction · 0.85
SetMethod · 0.65
LenMethod · 0.65
RunMethod · 0.45
ConsumeTracesMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected