Browse Source

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>
Gyuho Lee 7 years ago
parent
commit
7284e5a0a9
1 changed files with 3 additions and 2 deletions
  1. 3 2
      clientv3/integration/maintenance_test.go

+ 3 - 2
clientv3/integration/maintenance_test.go

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