(t *testing.T)
| 231 | } |
| 232 | |
| 233 | func TestOptionsTLSConfigInvalidPaths(t *testing.T) { |
| 234 | cr := certregistry.NewCertRegistry() |
| 235 | |
| 236 | for _, tt := range []struct { |
| 237 | name string |
| 238 | options *Options |
| 239 | }{ |
| 240 | {"missing cert path", &Options{KeyPathTLS: "fixtures/test.key"}}, |
| 241 | {"missing key path", &Options{CertPathTLS: "fixtures/test.crt"}}, |
| 242 | {"wrong cert path", &Options{CertPathTLS: "fixtures/notFound.crt", KeyPathTLS: "fixtures/test.key"}}, |
| 243 | {"wrong key path", &Options{CertPathTLS: "fixtures/test.crt", KeyPathTLS: "fixtures/notFound.key"}}, |
| 244 | {"cert key mismatch", &Options{CertPathTLS: "fixtures/test.crt", KeyPathTLS: "fixtures/test2.key"}}, |
| 245 | {"multiple cert key count mismatch", &Options{CertPathTLS: "fixtures/test.crt,fixtures/test2.crt", KeyPathTLS: "fixtures/test.key"}}, |
| 246 | {"multiple cert key mismatch", &Options{CertPathTLS: "fixtures/test.crt,fixtures/test2.crt", KeyPathTLS: "fixtures/test2.key,fixtures/test.key"}}, |
| 247 | } { |
| 248 | t.Run(tt.name, func(t *testing.T) { |
| 249 | _, err := tt.options.TlsConfig(cr) |
| 250 | t.Logf("tlsConfig error: %v", err) |
| 251 | require.Error(t, err) |
| 252 | }) |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | // to run this test, set `-args listener` for the test command |
| 257 | func TestHTTPSServer(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…