client: Fix tests for latest golang

This commit is contained in:
Manjunath A Kumatagi 2019-04-22 07:52:12 -05:00
parent 216808eab5
commit 867b45d865
2 changed files with 5 additions and 4 deletions

View File

@ -422,7 +422,7 @@ func TestHTTPClusterClientDo(t *testing.T) {
tt.ctx = context.Background()
}
resp, _, err := tt.client.Do(tt.ctx, nil)
if !reflect.DeepEqual(tt.wantErr, err) {
if (tt.wantErr == nil && tt.wantErr != err) || (tt.wantErr != nil && tt.wantErr.Error() != err.Error()) {
t.Errorf("#%d: got err=%v, want=%v", i, err, tt.wantErr)
continue
}
@ -726,7 +726,7 @@ func TestRedirectFollowingHTTPClient(t *testing.T) {
for i, tt := range tests {
client := &redirectFollowingHTTPClient{client: tt.client, checkRedirect: tt.checkRedirect}
resp, _, err := client.Do(context.Background(), nil)
if !reflect.DeepEqual(tt.wantErr, err) {
if (tt.wantErr == nil && tt.wantErr != err) || (tt.wantErr != nil && tt.wantErr.Error() != err.Error()) {
t.Errorf("#%d: got err=%v, want=%v", i, err, tt.wantErr)
continue
}

View File

@ -994,12 +994,13 @@ func TestHTTPKeysAPIWatcherAction(t *testing.T) {
}
for i, tt := range tests {
testError := errors.New("fail!")
kAPI := &httpKeysAPI{
client: &staticHTTPClient{err: errors.New("fail!")},
client: &staticHTTPClient{err: testError},
}
want := &httpWatcher{
client: &staticHTTPClient{err: errors.New("fail!")},
client: &staticHTTPClient{err: testError},
nextWait: tt.want,
}