@@ -16,25 +16,6 @@ const (
16
16
ClientCertificateSecretKey = "nlk-tls-client-secret"
17
17
)
18
18
19
- func TestTlsFactory_EmptyStringModeDefaultsToNoTls (t * testing.T ) {
20
- settings := configuration.Settings {
21
- TlsMode : "" ,
22
- }
23
-
24
- tlsConfig , err := NewTlsConfig (& settings )
25
- if err != nil {
26
- t .Fatalf (`Unexpected error: %v` , err )
27
- }
28
-
29
- if tlsConfig == nil {
30
- t .Fatalf (`tlsConfig should not be nil` )
31
- }
32
-
33
- if tlsConfig .InsecureSkipVerify != true {
34
- t .Fatalf (`tlsConfig.InsecureSkipVerify should be true` )
35
- }
36
- }
37
-
38
19
func TestTlsFactory_UnspecifiedModeDefaultsToNoTls (t * testing.T ) {
39
20
settings := configuration.Settings {}
40
21
@@ -57,7 +38,7 @@ func TestTlsFactory_SelfSignedTlsMode(t *testing.T) {
57
38
certificates [CaCertificateSecretKey ] = buildCaCertificateEntry (caCertificatePEM ())
58
39
59
40
settings := configuration.Settings {
60
- TlsMode : "ss-tls" ,
41
+ TlsMode : configuration . SelfSignedTLS ,
61
42
Certificates : & certification.Certificates {
62
43
Certificates : certificates ,
63
44
CaCertificateSecretKey : CaCertificateSecretKey ,
@@ -92,7 +73,7 @@ func TestTlsFactory_SelfSignedTlsModeCertPoolError(t *testing.T) {
92
73
certificates [CaCertificateSecretKey ] = buildCaCertificateEntry (invalidCertificatePEM ())
93
74
94
75
settings := configuration.Settings {
95
- TlsMode : "ss-tls" ,
76
+ TlsMode : configuration . SelfSignedTLS ,
96
77
Certificates : & certification.Certificates {
97
78
Certificates : certificates ,
98
79
},
@@ -113,7 +94,7 @@ func TestTlsFactory_SelfSignedTlsModeCertPoolCertificateParseError(t *testing.T)
113
94
certificates [CaCertificateSecretKey ] = buildCaCertificateEntry (invalidCertificateDataPEM ())
114
95
115
96
settings := configuration.Settings {
116
- TlsMode : "ss-tls" ,
97
+ TlsMode : configuration . SelfSignedTLS ,
117
98
Certificates : & certification.Certificates {
118
99
Certificates : certificates ,
119
100
CaCertificateSecretKey : CaCertificateSecretKey ,
@@ -137,7 +118,7 @@ func TestTlsFactory_SelfSignedMtlsMode(t *testing.T) {
137
118
certificates [ClientCertificateSecretKey ] = buildClientCertificateEntry (clientKeyPEM (), clientCertificatePEM ())
138
119
139
120
settings := configuration.Settings {
140
- TlsMode : "ss-mtls" ,
121
+ TlsMode : configuration . SelfSignedMutualTLS ,
141
122
Certificates : & certification.Certificates {
142
123
Certificates : certificates ,
143
124
CaCertificateSecretKey : CaCertificateSecretKey ,
@@ -173,7 +154,7 @@ func TestTlsFactory_SelfSignedMtlsModeCertPoolError(t *testing.T) {
173
154
certificates [ClientCertificateSecretKey ] = buildClientCertificateEntry (clientKeyPEM (), clientCertificatePEM ())
174
155
175
156
settings := configuration.Settings {
176
- TlsMode : "ss-mtls" ,
157
+ TlsMode : configuration . SelfSignedMutualTLS ,
177
158
Certificates : & certification.Certificates {
178
159
Certificates : certificates ,
179
160
},
@@ -195,7 +176,7 @@ func TestTlsFactory_SelfSignedMtlsModeClientCertificateError(t *testing.T) {
195
176
certificates [ClientCertificateSecretKey ] = buildClientCertificateEntry (clientKeyPEM (), invalidCertificatePEM ())
196
177
197
178
settings := configuration.Settings {
198
- TlsMode : "ss-mtls" ,
179
+ TlsMode : configuration . SelfSignedMutualTLS ,
199
180
Certificates : & certification.Certificates {
200
181
Certificates : certificates ,
201
182
CaCertificateSecretKey : CaCertificateSecretKey ,
@@ -215,7 +196,7 @@ func TestTlsFactory_SelfSignedMtlsModeClientCertificateError(t *testing.T) {
215
196
216
197
func TestTlsFactory_CaTlsMode (t * testing.T ) {
217
198
settings := configuration.Settings {
218
- TlsMode : "ca-tls" ,
199
+ TlsMode : configuration . CertificateAuthorityTLS ,
219
200
}
220
201
221
202
tlsConfig , err := NewTlsConfig (& settings )
@@ -245,7 +226,7 @@ func TestTlsFactory_CaMtlsMode(t *testing.T) {
245
226
certificates [ClientCertificateSecretKey ] = buildClientCertificateEntry (clientKeyPEM (), clientCertificatePEM ())
246
227
247
228
settings := configuration.Settings {
248
- TlsMode : "ca-mtls" ,
229
+ TlsMode : configuration . CertificateAuthorityMutualTLS ,
249
230
Certificates : & certification.Certificates {
250
231
Certificates : certificates ,
251
232
CaCertificateSecretKey : CaCertificateSecretKey ,
@@ -281,7 +262,7 @@ func TestTlsFactory_CaMtlsModeClientCertificateError(t *testing.T) {
281
262
certificates [ClientCertificateSecretKey ] = buildClientCertificateEntry (clientKeyPEM (), invalidCertificatePEM ())
282
263
283
264
settings := configuration.Settings {
284
- TlsMode : "ca-mtls" ,
265
+ TlsMode : configuration . CertificateAuthorityMutualTLS ,
285
266
Certificates : & certification.Certificates {
286
267
Certificates : certificates ,
287
268
},
0 commit comments