@@ -28,10 +28,66 @@ func TestLoadConfig(t *testing.T) {
28
28
29
29
tests := []struct {
30
30
id component.ID
31
+ option func (conf * Config )
31
32
expected component.Config
32
33
}{
33
34
{
34
35
id : component .NewIDWithName (metadata .Type , "" ),
36
+ option : func (conf * Config ) {
37
+ // intentionally left blank so we use default config
38
+ },
39
+ expected : & Config {
40
+ TimeoutSettings : exporterhelper.TimeoutSettings {
41
+ Timeout : 10 * time .Second ,
42
+ },
43
+ RetrySettings : exporterhelper.RetrySettings {
44
+ Enabled : true ,
45
+ InitialInterval : 10 * time .Second ,
46
+ MaxInterval : 1 * time .Minute ,
47
+ MaxElapsedTime : 10 * time .Minute ,
48
+ RandomizationFactor : backoff .DefaultRandomizationFactor ,
49
+ Multiplier : backoff .DefaultMultiplier ,
50
+ },
51
+ QueueSettings : exporterhelper.QueueSettings {
52
+ Enabled : true ,
53
+ NumConsumers : 2 ,
54
+ QueueSize : 10 ,
55
+ },
56
+ Topic : "spans" ,
57
+ Encoding : "otlp_proto" ,
58
+ Brokers : []string {"foo:123" , "bar:456" },
59
+ Authentication : Authentication {
60
+ PlainText : & PlainTextConfig {
61
+ Username : "jdoe" ,
62
+ Password : "pass" ,
63
+ },
64
+ },
65
+ Metadata : Metadata {
66
+ Full : false ,
67
+ Retry : MetadataRetry {
68
+ Max : 15 ,
69
+ Backoff : defaultMetadataRetryBackoff ,
70
+ },
71
+ },
72
+ Producer : Producer {
73
+ MaxMessageBytes : 10000000 ,
74
+ RequiredAcks : sarama .WaitForAll ,
75
+ Compression : "none" ,
76
+ },
77
+ },
78
+ },
79
+ {
80
+ id : component .NewIDWithName (metadata .Type , "" ),
81
+ option : func (conf * Config ) {
82
+ conf .Authentication = Authentication {
83
+ SASL : & SASLConfig {
84
+ Username : "jdoe" ,
85
+ Password : "pass" ,
86
+ Mechanism : "PLAIN" ,
87
+ Version : 0 ,
88
+ },
89
+ }
90
+ },
35
91
expected : & Config {
36
92
TimeoutSettings : exporterhelper.TimeoutSettings {
37
93
Timeout : 10 * time .Second ,
@@ -82,18 +138,7 @@ func TestLoadConfig(t *testing.T) {
82
138
83
139
for _ , tt := range tests {
84
140
t .Run (tt .id .String (), func (t * testing.T ) {
85
- cfg := applyConfigOption (func (conf * Config ) {
86
- // config.Validate() reads the Authentication.SASL struct, but it's not present
87
- // in the default config. This sets it to avoid a segfault during testing.
88
- conf .Authentication = Authentication {
89
- SASL : & SASLConfig {
90
- Username : "jdoe" ,
91
- Password : "pass" ,
92
- Mechanism : "PLAIN" ,
93
- Version : 0 ,
94
- },
95
- }
96
- })
141
+ cfg := applyConfigOption (tt .option )
97
142
98
143
sub , err := cm .Sub (tt .id .String ())
99
144
require .NoError (t , err )
0 commit comments