@@ -159,28 +159,28 @@ func Test_x509Callback(t *testing.T) {
159159 certificate : googleLeafWithInvalidHashFixture ,
160160 host : "www.google.com" ,
161161 caBundle : []byte (giag2IntermediateFixture + "\n " + geoTrustRootFixture ),
162- want : fmt .Errorf ("x509 cert could not be verified" ),
162+ want : fmt .Errorf (`verification failed: x509: certificate signed by unknown authority (possibly because of "x509: cannot verify signature: algorithm unimplemented" while trying to verify candidate authority certificate "Google Internet Authority G2")` ),
163163 },
164164 {
165165 name : "Invalid certificate authority bundle" ,
166166 certificate : googleLeafFixture ,
167167 host : "www.google.com" ,
168168 caBundle : bytes .Trim ([]byte (giag2IntermediateFixture + "\n " + geoTrustRootFixture ), "-" ),
169- want : fmt .Errorf ("x509 cert could not be appended" ),
169+ want : fmt .Errorf ("PEM CA bundle could not be appended to x509 certificate pool " ),
170170 },
171171 {
172172 name : "Missing intermediate in bundle" ,
173173 certificate : googleLeafFixture ,
174174 host : "www.google.com" ,
175175 caBundle : []byte (geoTrustRootFixture ),
176- want : fmt .Errorf ("x509 cert could not be verified " ),
176+ want : fmt .Errorf ("verification failed: x509: certificate signed by unknown authority " ),
177177 },
178178 {
179179 name : "Invalid host" ,
180180 certificate : googleLeafFixture ,
181181 host : "www.google.co" ,
182182 caBundle : []byte (giag2IntermediateFixture + "\n " + geoTrustRootFixture ),
183- want : fmt .Errorf ("x509 cert could not be verified " ),
183+ want : fmt .Errorf ("verification failed: x509: certificate is valid for www.google.com, not www.google.co " ),
184184 },
185185 }
186186 for _ , tt := range tests {
@@ -195,11 +195,11 @@ func Test_x509Callback(t *testing.T) {
195195 }
196196
197197 callback := x509Callback (tt .caBundle )
198- result := g . Expect ( callback (cert , false , tt .host ) )
198+ result := callback (cert , false , tt .host )
199199 if tt .want == nil {
200- result .To (BeNil ())
200+ g . Expect ( result ) .To (BeNil ())
201201 } else {
202- result .To (Equal (tt .want ))
202+ g . Expect ( result .Error ()). To (Equal (tt .want . Error () ))
203203 }
204204 })
205205 }
@@ -236,7 +236,7 @@ func Test_knownHostsCallback(t *testing.T) {
236236 knownHosts : []byte (knownHostsFixture ),
237237 hostkey : git2go.HostkeyCertificate {Kind : git2go .HostkeySHA1 | git2go .HostkeyMD5 , HashSHA1 : sha1Fingerprint ("v2toJdKXfFEaR1u++4iq1UqSrHM" )},
238238 expectedHost : "example.com" ,
239- want : fmt .Errorf ("host mismatch: %q %q\n " , "example.com" , "github.com" ),
239+ want : fmt .Errorf ("host mismatch: %q %q" , "example.com" , "github.com" ),
240240 },
241241 {
242242 name : "Hostkey mismatch" ,
@@ -399,7 +399,7 @@ func Test_transferProgressCallback(t *testing.T) {
399399 ReceivedObjects : 21 ,
400400 },
401401 cancelFunc : func (cf context.CancelFunc ) { cf () },
402- wantErr : fmt .Errorf ("transport close - potentially due to a timeout" ),
402+ wantErr : fmt .Errorf ("transport close ( potentially due to a timeout) " ),
403403 },
404404 }
405405
@@ -497,7 +497,7 @@ func Test_pushTransferProgressCallback(t *testing.T) {
497497 name : "error - context cancelled" ,
498498 progress : pushProgress {current : 20 , total : 25 },
499499 cancelFunc : func (cf context.CancelFunc ) { cf () },
500- wantErr : fmt .Errorf ("transport close - potentially due to a timeout" ),
500+ wantErr : fmt .Errorf ("transport close ( potentially due to a timeout) " ),
501501 },
502502 }
503503
0 commit comments