@@ -25,6 +25,13 @@ func TestLoadConfig(t *testing.T) {
25
25
cm , err := confmaptest .LoadConf (filepath .Join ("testdata" , "config.yaml" ))
26
26
require .NoError (t , err )
27
27
28
+ clientConfig := confighttp .NewDefaultClientConfig ()
29
+ clientConfig .Endpoint = "https://log-stream.sys.example.internal"
30
+ clientConfig .TLSSetting = configtls.ClientConfig {
31
+ InsecureSkipVerify : true ,
32
+ }
33
+ clientConfig .Timeout = time .Second * 20
34
+
28
35
tests := []struct {
29
36
id component.ID
30
37
expected component.Config
@@ -34,14 +41,8 @@ func TestLoadConfig(t *testing.T) {
34
41
id : component .NewIDWithName (metadata .Type , "one" ),
35
42
expected : & Config {
36
43
RLPGateway : RLPGatewayConfig {
37
- ClientConfig : confighttp.ClientConfig {
38
- Endpoint : "https://log-stream.sys.example.internal" ,
39
- TLSSetting : configtls.ClientConfig {
40
- InsecureSkipVerify : true ,
41
- },
42
- Timeout : time .Second * 20 ,
43
- },
44
- ShardID : "otel-test" ,
44
+ ClientConfig : clientConfig ,
45
+ ShardID : "otel-test" ,
45
46
},
46
47
UAA : UAAConfig {
47
48
LimitedClientConfig : LimitedClientConfig {
@@ -67,14 +68,8 @@ func TestLoadConfig(t *testing.T) {
67
68
id : component .NewIDWithName (metadata .Type , "shardidnotdefined" ),
68
69
expected : & Config {
69
70
RLPGateway : RLPGatewayConfig {
70
- ClientConfig : confighttp.ClientConfig {
71
- Endpoint : "https://log-stream.sys.example.internal" ,
72
- TLSSetting : configtls.ClientConfig {
73
- InsecureSkipVerify : true ,
74
- },
75
- Timeout : time .Second * 20 ,
76
- },
77
- ShardID : "opentelemetry" ,
71
+ ClientConfig : clientConfig ,
72
+ ShardID : "opentelemetry" ,
78
73
},
79
74
UAA : UAAConfig {
80
75
LimitedClientConfig : LimitedClientConfig {
@@ -133,22 +128,22 @@ func TestInvalidConfigValidation(t *testing.T) {
133
128
func TestHTTPConfigurationStructConsistency (t * testing.T ) {
134
129
// LimitedClientConfig must have the same structure as ClientConfig, but without the fields that the UAA
135
130
// library does not support.
136
- checkTypeFieldMatch (t , "Endpoint" , reflect .TypeOf (LimitedClientConfig {}), reflect .TypeOf (confighttp.ClientConfig {} ))
137
- checkTypeFieldMatch (t , "TLSSetting" , reflect .TypeOf (LimitedClientConfig {}), reflect .TypeOf (confighttp.ClientConfig {} ))
131
+ checkTypeFieldMatch (t , "Endpoint" , reflect .TypeOf (LimitedClientConfig {}), reflect .TypeOf (confighttp .NewDefaultClientConfig () ))
132
+ checkTypeFieldMatch (t , "TLSSetting" , reflect .TypeOf (LimitedClientConfig {}), reflect .TypeOf (confighttp .NewDefaultClientConfig () ))
138
133
checkTypeFieldMatch (t , "InsecureSkipVerify" , reflect .TypeOf (LimitedTLSClientSetting {}), reflect .TypeOf (configtls.ClientConfig {}))
139
134
}
140
135
141
136
func loadSuccessfulConfig (t * testing.T ) * Config {
137
+ clientConfig := confighttp .NewDefaultClientConfig ()
138
+ clientConfig .Endpoint = "https://log-stream.sys.example.internal"
139
+ clientConfig .Timeout = time .Second * 20
140
+ clientConfig .TLSSetting = configtls.ClientConfig {
141
+ InsecureSkipVerify : true ,
142
+ }
142
143
configuration := & Config {
143
144
RLPGateway : RLPGatewayConfig {
144
- ClientConfig : confighttp.ClientConfig {
145
- Endpoint : "https://log-stream.sys.example.internal" ,
146
- Timeout : time .Second * 20 ,
147
- TLSSetting : configtls.ClientConfig {
148
- InsecureSkipVerify : true ,
149
- },
150
- },
151
- ShardID : "otel-test" ,
145
+ ClientConfig : clientConfig ,
146
+ ShardID : "otel-test" ,
152
147
},
153
148
UAA : UAAConfig {
154
149
LimitedClientConfig : LimitedClientConfig {
0 commit comments