@ -61,6 +61,7 @@ func TestTracingConfig(t *testing.T) {
Env map [ string ] string
ExpectedExporter string
ExpectedAddress string
ExpectedInsecure bool
ExpectedPropagator string
ExpectedAttrs [ ] attribute . KeyValue
@ -72,6 +73,7 @@ func TestTracingConfig(t *testing.T) {
Name : "default config uses noop exporter" ,
Cfg : "" ,
ExpectedExporter : noopExporter ,
ExpectedInsecure : true ,
ExpectedAttrs : [ ] attribute . KeyValue { } ,
} ,
{
@ -81,6 +83,7 @@ func TestTracingConfig(t *testing.T) {
custom_attributes = key1 : value1 , key2 : value2
` ,
ExpectedExporter : noopExporter ,
ExpectedInsecure : true ,
ExpectedAttrs : [ ] attribute . KeyValue { attribute . String ( "key1" , "value1" ) , attribute . String ( "key2" , "value2" ) } ,
} ,
{
@ -101,6 +104,19 @@ func TestTracingConfig(t *testing.T) {
` ,
ExpectedExporter : otlpExporter ,
ExpectedAddress : "otlp.example.com:4317" ,
ExpectedInsecure : true ,
ExpectedAttrs : [ ] attribute . KeyValue { } ,
} ,
{
Name : "OTLP insecure is parsed" ,
Cfg : `
[ tracing . opentelemetry . otlp ]
address = otlp . example . com : 4317
insecure = false
` ,
ExpectedExporter : otlpExporter ,
ExpectedAddress : "otlp.example.com:4317" ,
ExpectedInsecure : false ,
ExpectedAttrs : [ ] attribute . KeyValue { } ,
} ,
{
@ -154,6 +170,7 @@ func TestTracingConfig(t *testing.T) {
` ,
ExpectedExporter : otlpExporter ,
ExpectedAddress : "otlp.example.com:4317" ,
ExpectedInsecure : true ,
ExpectedAttrs : [ ] attribute . KeyValue { } ,
ExpectedSampler : "remote" ,
ExpectedSamplerParam : 0.5 ,
@ -179,6 +196,7 @@ func TestTracingConfig(t *testing.T) {
assert . Equal ( t , test . ExpectedAddress , tracingConfig . Address )
assert . Equal ( t , test . ExpectedPropagator , tracingConfig . Propagation )
assert . Equal ( t , test . ExpectedAttrs , tracingConfig . CustomAttribs )
assert . Equal ( t , test . ExpectedInsecure , tracingConfig . Insecure )
if test . ExpectedSampler != "" {
assert . Equal ( t , test . ExpectedSampler , tracingConfig . Sampler )