Skip to content

Commit

Permalink
Adjust error checking in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
janos committed May 21, 2018
1 parent 8d5ff75 commit 2c1d00e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions client/http/http_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ func TestClientRetryFailure(t *testing.T) {
}()

r, err := New(&Options{RetryTimeMax: 1 * time.Second}).Get(fmt.Sprintf("http://localhost:%d", port))
if err == nil || !strings.Contains(err.Error(), "getsockopt: connection refused") {
if err == nil || !strings.Contains(err.Error(), "connection refused") {
t.Errorf("expected connection refused error, got %#v", err)
}
if r != nil {
t.Error("unexpected not-nil response")
}

r, err = (&http.Client{Transport: Transport(&Options{RetryTimeMax: 1 * time.Second})}).Get(fmt.Sprintf("http://localhost:%d", port))
if err == nil || !strings.Contains(err.Error(), "getsockopt: connection refused") {
if err == nil || !strings.Contains(err.Error(), "connection refused") {
t.Errorf("expected connection refused error, got %#v", err)
}
if r != nil {
Expand Down
4 changes: 2 additions & 2 deletions servers/grpc/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ func TestServerShutdown(t *testing.T) {
s.Shutdown(context.Background())

r, err = c.Greet(context.Background(), &hello.GreetRequest{Name: name})
if err.Error() != "rpc error: code = Unavailable desc = all SubConns are in TransientFailure" {
t.Fatal(err)
if !strings.Contains(err.Error(), "connection refused") {
t.Fatalf("unexpected error: %q", err)
}
}

Expand Down

0 comments on commit 2c1d00e

Please sign in to comment.