clientv3/integration: fix "TestMaintenanceSnapshotErrorInflight"

Errors from gRPC should be typed *status.statusError

=== RUN   TestMaintenanceSnapshotErrorInflight
WARNING: 2018/05/29 11:43:21 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial unix localhost:55815860381826373260: connect: no such file or directory"; Reconnecting to {localhost:55815860381826373260 0  <nil>}
--- FAIL: TestMaintenanceSnapshotErrorInflight (2.42s)
	maintenance_test.go:192: expected context deadline exceeded, got rpc error: code = DeadlineExceeded desc = context deadline exceeded

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
Gyuho Lee 2018-05-29 11:48:28 -07:00
parent 1951ebab7e
commit 7284e5a0a9

View File

@ -21,6 +21,7 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"path/filepath" "path/filepath"
"strings"
"testing" "testing"
"time" "time"
@ -188,7 +189,7 @@ func TestMaintenanceSnapshotErrorInflight(t *testing.T) {
// 300ms left and expect timeout while snapshot reading is in progress // 300ms left and expect timeout while snapshot reading is in progress
time.Sleep(700 * time.Millisecond) time.Sleep(700 * time.Millisecond)
_, err = io.Copy(ioutil.Discard, rc2) _, err = io.Copy(ioutil.Discard, rc2)
if err != nil && err != context.DeadlineExceeded { if err != nil && !strings.Contains(err.Error(), context.DeadlineExceeded.Error()) {
t.Errorf("expected %v, got %v", context.DeadlineExceeded, err) t.Errorf("expected %v from gRPC, got %v", context.DeadlineExceeded, err)
} }
} }