Skip to content

Commit

Permalink
Rename for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
ivov committed Nov 28, 2024
1 parent 84e4798 commit 1aaaa2b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions internal/http/check_until_broker_ready_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ func TestCheckUntilBrokerReadyHappyPath(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
requestCount := 0
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
requestCount++
tt.serverFn(w, r, requestCount)
}))
defer server.Close()
defer srv.Close()

ctx, cancel := context.WithTimeout(context.Background(), tt.timeout)
defer cancel()

done := make(chan error)
go func() {
done <- CheckUntilBrokerReady(server.URL)
done <- CheckUntilBrokerReady(srv.URL)
}()

select {
Expand Down Expand Up @@ -83,11 +83,11 @@ func TestCheckUntilBrokerReadyErrors(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
server := httptest.NewServer(http.HandlerFunc(tt.handler))
srv := httptest.NewServer(http.HandlerFunc(tt.handler))
if tt.name == "error - closed server" {
server.Close()
srv.Close()
} else {
defer server.Close()
defer srv.Close()
}

// CheckUntilBrokerReady retries forever, so set up
Expand All @@ -99,7 +99,7 @@ func TestCheckUntilBrokerReadyErrors(t *testing.T) {

brokerUnexpectedlyReady := make(chan error)
go func() {
brokerUnexpectedlyReady <- CheckUntilBrokerReady(server.URL)
brokerUnexpectedlyReady <- CheckUntilBrokerReady(srv.URL)
}()

select {
Expand Down Expand Up @@ -137,7 +137,7 @@ func TestSendReadinessRequest(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodGet {
t.Errorf("expected GET request, got %s", r.Method)
}
Expand All @@ -146,9 +146,9 @@ func TestSendReadinessRequest(t *testing.T) {
}
w.WriteHeader(tt.serverResponse)
}))
defer server.Close()
defer srv.Close()

resp, err := sendHealthRequest(server.URL)
resp, err := sendHealthRequest(srv.URL)

if err == nil {
defer resp.Body.Close()
Expand Down

0 comments on commit 1aaaa2b

Please sign in to comment.