|
4 | 4 | package otelconf |
5 | 5 |
|
6 | 6 | import ( |
7 | | - "crypto/tls" |
8 | 7 | "encoding/json" |
9 | 8 | "errors" |
10 | 9 | "os" |
@@ -1242,61 +1241,6 @@ func TestUnmarshalPeriodicMetricReader(t *testing.T) { |
1242 | 1241 | }) |
1243 | 1242 | } |
1244 | 1243 | } |
1245 | | -func TestCreateTLSConfig(t *testing.T) { |
1246 | | - tests := []struct { |
1247 | | - name string |
1248 | | - caCertFile *string |
1249 | | - clientCertFile *string |
1250 | | - clientKeyFile *string |
1251 | | - wantErrContains string |
1252 | | - want func(*tls.Config, *testing.T) |
1253 | | - }{ |
1254 | | - { |
1255 | | - name: "no-input", |
1256 | | - want: func(result *tls.Config, t *testing.T) { |
1257 | | - require.Nil(t, result.Certificates) |
1258 | | - require.Nil(t, result.RootCAs) |
1259 | | - }, |
1260 | | - }, |
1261 | | - { |
1262 | | - name: "only-cacert-provided", |
1263 | | - caCertFile: ptr(filepath.Join("..", "testdata", "ca.crt")), |
1264 | | - want: func(result *tls.Config, t *testing.T) { |
1265 | | - require.Nil(t, result.Certificates) |
1266 | | - require.NotNil(t, result.RootCAs) |
1267 | | - }, |
1268 | | - }, |
1269 | | - { |
1270 | | - name: "nonexistent-cacert-file", |
1271 | | - caCertFile: ptr("nowhere.crt"), |
1272 | | - wantErrContains: "open nowhere.crt:", |
1273 | | - }, |
1274 | | - { |
1275 | | - name: "nonexistent-clientcert-file", |
1276 | | - clientCertFile: ptr("nowhere.crt"), |
1277 | | - clientKeyFile: ptr("nowhere.crt"), |
1278 | | - wantErrContains: "could not use client certificate: open nowhere.crt:", |
1279 | | - }, |
1280 | | - { |
1281 | | - name: "bad-cacert-file", |
1282 | | - caCertFile: ptr(filepath.Join("..", "testdata", "bad_cert.crt")), |
1283 | | - wantErrContains: "could not create certificate authority chain from certificate", |
1284 | | - }, |
1285 | | - } |
1286 | | - |
1287 | | - for _, tt := range tests { |
1288 | | - t.Run(tt.name, func(t *testing.T) { |
1289 | | - got, err := createTLSConfig(tt.caCertFile, tt.clientCertFile, tt.clientKeyFile) |
1290 | | - |
1291 | | - if tt.wantErrContains != "" { |
1292 | | - require.Contains(t, err.Error(), tt.wantErrContains) |
1293 | | - } else { |
1294 | | - require.NoError(t, err) |
1295 | | - tt.want(got, t) |
1296 | | - } |
1297 | | - }) |
1298 | | - } |
1299 | | -} |
1300 | 1244 |
|
1301 | 1245 | func TestUnmarshalCardinalityLimits(t *testing.T) { |
1302 | 1246 | for _, tt := range []struct { |
|
0 commit comments