diff --git a/exporters/otlp/otlplog/otlploggrpc/config_test.go b/exporters/otlp/otlplog/otlploggrpc/config_test.go index c71482bd44c4..d3b12e4c6c95 100644 --- a/exporters/otlp/otlplog/otlploggrpc/config_test.go +++ b/exporters/otlp/otlplog/otlploggrpc/config_test.go @@ -332,47 +332,47 @@ func TestNewConfig(t *testing.T) { `invalid OTEL_EXPORTER_OTLP_LOGS_TIMEOUT value 100 seconds: strconv.Atoi: parsing "100 seconds": invalid syntax`, }, }, - { - name: "HeadersWithSpaces", - envars: map[string]string{ - "OTEL_EXPORTER_OTLP_HEADERS": " keyWithSpaces =value1", - }, - want: config{ - headers: newSetting(map[string]string{ - "keyWithSpaces": "value1", - }), - endpoint: newSetting(defaultEndpoint), - timeout: newSetting(defaultTimeout), - retryCfg: newSetting(defaultRetryCfg), - }, - }, { - name: "HeadersWithPercentEncoding", - envars: map[string]string{ - "OTEL_EXPORTER_OTLP_HEADERS": "percent%20encoded=value,normal=ok", - }, - want: config{ - headers: newSetting(map[string]string{ - "percent%20encoded": "value", - "normal": "ok", - }), - endpoint: newSetting(defaultEndpoint), - timeout: newSetting(defaultTimeout), - retryCfg: newSetting(defaultRetryCfg), - }, - }, + name: "HeadersWithSpaces", + envars: map[string]string{ + "OTEL_EXPORTER_OTLP_HEADERS": " keyWithSpaces =value1", + }, + want: config{ + headers: newSetting(map[string]string{ + "keyWithSpaces": "value1", + }), + endpoint: newSetting(defaultEndpoint), + timeout: newSetting(defaultTimeout), + retryCfg: newSetting(defaultRetryCfg), + }, + }, { - name: "HeadersWithInvalidKey", - envars: map[string]string{ - "OTEL_EXPORTER_OTLP_HEADERS": "valid=ok,inva lid=not_ok,also_valid=fine", - }, - want: config{ - endpoint: newSetting(defaultEndpoint), - timeout: newSetting(defaultTimeout), - retryCfg: newSetting(defaultRetryCfg), - }, - errs: []string{`invalid header key: inva lid`}, - }, + name: "HeadersWithPercentEncoding", + envars: map[string]string{ + "OTEL_EXPORTER_OTLP_HEADERS": "percent%20encoded=value,normal=ok", + }, + want: config{ + headers: newSetting(map[string]string{ + "percent%20encoded": "value", + "normal": "ok", + }), + endpoint: newSetting(defaultEndpoint), + timeout: newSetting(defaultTimeout), + retryCfg: newSetting(defaultRetryCfg), + }, + }, + { + name: "HeadersWithInvalidKey", + envars: map[string]string{ + "OTEL_EXPORTER_OTLP_HEADERS": "valid=ok,inva lid=not_ok,also_valid=fine", + }, + want: config{ + endpoint: newSetting(defaultEndpoint), + timeout: newSetting(defaultTimeout), + retryCfg: newSetting(defaultRetryCfg), + }, + errs: []string{`invalid header key: inva lid`}, + }, } for _, tc := range testcases { diff --git a/exporters/otlp/otlplog/otlploghttp/config_test.go b/exporters/otlp/otlplog/otlploghttp/config_test.go index 88a4ce648c45..f1b9b1d90d38 100644 --- a/exporters/otlp/otlplog/otlploghttp/config_test.go +++ b/exporters/otlp/otlplog/otlploghttp/config_test.go @@ -338,49 +338,46 @@ func TestNewConfig(t *testing.T) { }, }, { - name: "HeadersWithSpaces", - envars: map[string]string{ - "OTEL_EXPORTER_OTLP_HEADERS": " keyWithSpaces =value1", - }, - want: config{ - headers: newSetting(map[string]string{ - "keyWithSpaces": "value1", - }), - endpoint: newSetting(defaultEndpoint), - path: newSetting(defaultPath), - timeout: newSetting(defaultTimeout), - retryCfg: newSetting(defaultRetryCfg), - }, - }, + name: "HeadersWithSpaces", + envars: map[string]string{ + "OTEL_EXPORTER_OTLP_HEADERS": " keyWithSpaces =value1", + }, + want: config{ + headers: newSetting(map[string]string{ + "keyWithSpaces": "value1", + }), + endpoint: newSetting(defaultEndpoint), + timeout: newSetting(defaultTimeout), + retryCfg: newSetting(defaultRetryCfg), + }, + }, { - name: "HeadersWithPercentEncoding", - envars: map[string]string{ - "OTEL_EXPORTER_OTLP_HEADERS": "percent%20encoded=value,normal=ok", - }, - want: config{ - headers: newSetting(map[string]string{ - "percent%20encoded": "value", - "normal": "ok", - }), - endpoint: newSetting(defaultEndpoint), - path: newSetting(defaultPath), - timeout: newSetting(defaultTimeout), - retryCfg: newSetting(defaultRetryCfg), - }, - }, + name: "HeadersWithPercentEncoding", + envars: map[string]string{ + "OTEL_EXPORTER_OTLP_HEADERS": "percent%20encoded=value,normal=ok", + }, + want: config{ + headers: newSetting(map[string]string{ + "percent%20encoded": "value", + "normal": "ok", + }), + endpoint: newSetting(defaultEndpoint), + timeout: newSetting(defaultTimeout), + retryCfg: newSetting(defaultRetryCfg), + }, + }, { - name: "HeadersWithInvalidKey", - envars: map[string]string{ - "OTEL_EXPORTER_OTLP_HEADERS": "valid=ok,inva lid=not_ok,also_valid=fine", - }, - want: config{ - endpoint: newSetting(defaultEndpoint), - path: newSetting(defaultPath), - timeout: newSetting(defaultTimeout), - retryCfg: newSetting(defaultRetryCfg), - }, - errs: []string{`invalid header key: inva lid`}, - }, + name: "HeadersWithInvalidKey", + envars: map[string]string{ + "OTEL_EXPORTER_OTLP_HEADERS": "valid=ok,inva lid=not_ok,also_valid=fine", + }, + want: config{ + endpoint: newSetting(defaultEndpoint), + timeout: newSetting(defaultTimeout), + retryCfg: newSetting(defaultRetryCfg), + }, + errs: []string{`invalid header key: inva lid`}, + }, } for _, tc := range testcases {