(h http.Handler)
| 1036 | } |
| 1037 | |
| 1038 | func tlsServer(h http.Handler) (string, ResolverOptions, func()) { |
| 1039 | s := httptest.NewUnstartedServer(h) |
| 1040 | s.StartTLS() |
| 1041 | |
| 1042 | capool := x509.NewCertPool() |
| 1043 | cert, _ := x509.ParseCertificate(s.TLS.Certificates[0].Certificate[0]) |
| 1044 | capool.AddCert(cert) |
| 1045 | |
| 1046 | client := &http.Client{ |
| 1047 | Transport: &http.Transport{ |
| 1048 | TLSClientConfig: &tls.Config{ |
| 1049 | RootCAs: capool, |
| 1050 | }, |
| 1051 | }, |
| 1052 | } |
| 1053 | |
| 1054 | options := ResolverOptions{ |
| 1055 | Hosts: ConfigureDefaultRegistries(WithClient(client)), |
| 1056 | // Set deprecated field for tests to use for configuration |
| 1057 | Client: client, |
| 1058 | } |
| 1059 | base := s.URL[8:] // strip "https://" |
| 1060 | return base, options, s.Close |
| 1061 | } |
| 1062 | |
| 1063 | type logHandler struct { |
| 1064 | t *testing.T |
no test coverage detected
searching dependent graphs…