Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: remove panics in client tests #1747

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2003,9 +2003,8 @@ func TestClientNonIdempotentRetry(t *testing.T) {
s: "HTTP/1.1 345 OK\r\nContent-Type: foobar\r\nContent-Length: 7\r\n\r\n0123456",
}, nil
default:
t.Fatalf("unexpected number of dials: %d", dialsCount)
return nil, fmt.Errorf("unexpected number of dials: %d", dialsCount)
}
panic("unreachable")
},
}

Expand Down Expand Up @@ -2053,9 +2052,8 @@ func TestClientNonIdempotentRetry_BodyStream(t *testing.T) {
b: []byte("HTTP/1.1 345 OK\r\nContent-Type: foobar\r\n\r\n"),
}, nil
default:
t.Fatalf("unexpected number of dials: %d", dialsCount)
return nil, fmt.Errorf("unexpected number of dials: %d", dialsCount)
}
panic("unreachable")
},
}

Expand Down Expand Up @@ -2096,9 +2094,8 @@ func TestClientIdempotentRequest(t *testing.T) {
s: "HTTP/1.1 345 OK\r\nContent-Type: foobar\r\nContent-Length: 7\r\n\r\n0123456",
}, nil
default:
t.Fatalf("unexpected number of dials: %d", dialsCount)
return nil, fmt.Errorf("unexpected number of dials: %d", dialsCount)
}
panic("unreachable")
},
}

Expand Down Expand Up @@ -2152,9 +2149,8 @@ func TestClientRetryRequestWithCustomDecider(t *testing.T) {
s: "HTTP/1.1 345 OK\r\nContent-Type: foobar\r\nContent-Length: 7\r\n\r\n0123456",
}, nil
default:
t.Fatalf("unexpected number of dials: %d", dialsCount)
return nil, fmt.Errorf("unexpected number of dials: %d", dialsCount)
}
panic("unreachable")
},
RetryIf: func(req *Request) bool {
return req.URI().String() == "http://foobar/a/b"
Expand Down
Loading