Skip to content

Commit

Permalink
Add assertion for host requests
Browse files Browse the repository at this point in the history
  • Loading branch information
nstogner committed Feb 3, 2024
1 parent b09fd70 commit 0cf2866
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/proxy/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ func TestHandler(t *testing.T) {
assert.Equal(t, spec.expCode, resp.StatusCode, "Unexpected response code to client")
assert.Equal(t, spec.expBody, string(respBody), "Unexpected response body to client")
assert.Equal(t, spec.expBackendRequestCount, backendRequestCount, "Unexpected number of requests sent to backend")
assert.Equal(t, spec.expBackendRequestCount, endpoints.hostRequestCount, "Unexpected number of requests for backend hosts")

// Assert on metrics.
gathered, err := metricsRegistry.Gather()
Expand Down Expand Up @@ -216,9 +217,12 @@ type testEndpointManager struct {

requestedService string
requestedPort string

hostRequestCount int
}

func (t *testEndpointManager) AwaitHostAddress(ctx context.Context, service, portName string) (string, error) {
t.hostRequestCount++
t.requestedService = service
t.requestedPort = portName
return t.address, nil
Expand Down

0 comments on commit 0cf2866

Please sign in to comment.