From 0cf286608113b5ca2c7eff2cdf6f1be248403f9b Mon Sep 17 00:00:00 2001 From: Nick Stogner Date: Sat, 3 Feb 2024 10:50:02 -0500 Subject: [PATCH] Add assertion for host requests --- pkg/proxy/handler_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/proxy/handler_test.go b/pkg/proxy/handler_test.go index e4de6793..4d15d778 100644 --- a/pkg/proxy/handler_test.go +++ b/pkg/proxy/handler_test.go @@ -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() @@ -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