From f1eddbad0633d3ddad2422303b62d3990bd1c906 Mon Sep 17 00:00:00 2001 From: Giuseppe Guerra Date: Tue, 4 Apr 2023 23:16:57 +0200 Subject: [PATCH] Plugins: Tracing: Add test for composite propagation (#65917) --- .../loader/initializer/initializer_test.go | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/pkg/plugins/manager/loader/initializer/initializer_test.go b/pkg/plugins/manager/loader/initializer/initializer_test.go index d9d7a49692a..00f7c80e42a 100644 --- a/pkg/plugins/manager/loader/initializer/initializer_test.go +++ b/pkg/plugins/manager/loader/initializer/initializer_test.go @@ -304,6 +304,27 @@ func TestInitializer_tracingEnvironmentVariables(t *testing.T) { assert.Equal(t, "GF_INSTANCE_OTLP_PROPAGATION=w3c", envVars[4]) }, }, + { + name: "otlp enabled composite propagation", + cfg: &config.Cfg{ + Opentelemetry: config.OpentelemetryCfg{ + Address: "127.0.0.1:4317", + Propagation: "w3c,jaeger", + }, + PluginSettings: map[string]map[string]string{ + pluginID: {"tracing": "true"}, + }, + }, + plugin: defaultPlugin, + exp: func(t *testing.T, envVars []string) { + assert.Len(t, envVars, 5) + assert.Equal(t, "GF_PLUGIN_TRACING=true", envVars[0]) + assert.Equal(t, "GF_VERSION=", envVars[1]) + assert.Equal(t, "GF_PLUGIN_VERSION=1.0.0", envVars[2]) + assert.Equal(t, "GF_INSTANCE_OTLP_ADDRESS=127.0.0.1:4317", envVars[3]) + assert.Equal(t, "GF_INSTANCE_OTLP_PROPAGATION=w3c,jaeger", envVars[4]) + }, + }, { name: "otlp no propagation disabled by default", cfg: &config.Cfg{