@@ -159,28 +159,28 @@ func Test_x509Callback(t *testing.T) {
159
159
certificate : googleLeafWithInvalidHashFixture ,
160
160
host : "www.google.com" ,
161
161
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")` ),
163
163
},
164
164
{
165
165
name : "Invalid certificate authority bundle" ,
166
166
certificate : googleLeafFixture ,
167
167
host : "www.google.com" ,
168
168
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 " ),
170
170
},
171
171
{
172
172
name : "Missing intermediate in bundle" ,
173
173
certificate : googleLeafFixture ,
174
174
host : "www.google.com" ,
175
175
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 " ),
177
177
},
178
178
{
179
179
name : "Invalid host" ,
180
180
certificate : googleLeafFixture ,
181
181
host : "www.google.co" ,
182
182
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 " ),
184
184
},
185
185
}
186
186
for _ , tt := range tests {
@@ -195,11 +195,11 @@ func Test_x509Callback(t *testing.T) {
195
195
}
196
196
197
197
callback := x509Callback (tt .caBundle )
198
- result := g . Expect ( callback (cert , false , tt .host ) )
198
+ result := callback (cert , false , tt .host )
199
199
if tt .want == nil {
200
- result .To (BeNil ())
200
+ g . Expect ( result ) .To (BeNil ())
201
201
} else {
202
- result .To (Equal (tt .want ))
202
+ g . Expect ( result .Error ()). To (Equal (tt .want . Error () ))
203
203
}
204
204
})
205
205
}
@@ -236,7 +236,7 @@ func Test_knownHostsCallback(t *testing.T) {
236
236
knownHosts : []byte (knownHostsFixture ),
237
237
hostkey : git2go.HostkeyCertificate {Kind : git2go .HostkeySHA1 | git2go .HostkeyMD5 , HashSHA1 : sha1Fingerprint ("v2toJdKXfFEaR1u++4iq1UqSrHM" )},
238
238
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" ),
240
240
},
241
241
{
242
242
name : "Hostkey mismatch" ,
@@ -399,7 +399,7 @@ func Test_transferProgressCallback(t *testing.T) {
399
399
ReceivedObjects : 21 ,
400
400
},
401
401
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) " ),
403
403
},
404
404
}
405
405
@@ -497,7 +497,7 @@ func Test_pushTransferProgressCallback(t *testing.T) {
497
497
name : "error - context cancelled" ,
498
498
progress : pushProgress {current : 20 , total : 25 },
499
499
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) " ),
501
501
},
502
502
}
503
503
0 commit comments