From 6302e3a94f8edddda5c4edc68bbde4ec1cca2d11 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Thu, 19 Feb 2026 11:45:21 -0500 Subject: [PATCH] Inline a Service jig helper into a test jig.GetEndpointNodesWithIP was only used by one test, and that test didn't even want the data in the form jig.GetEndpointNodesWithIP provided it in. So just inline the code and generate the data correctly the first time, and remove GetEndpointNodesWithIP (along with GetEndpointNodes, which was already unused). --- test/e2e/framework/service/jig.go | 20 -------------------- test/e2e/network/service.go | 11 ++++++----- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/test/e2e/framework/service/jig.go b/test/e2e/framework/service/jig.go index 78cd28d1a05..9a4e9ad12fa 100644 --- a/test/e2e/framework/service/jig.go +++ b/test/e2e/framework/service/jig.go @@ -361,26 +361,6 @@ func (j *TestJig) CreateLoadBalancerService(ctx context.Context, timeout time.Du return j.WaitForLoadBalancer(ctx, timeout) } -// GetEndpointNodes returns a map of nodenames:external-ip on which the -// endpoints of the Service are running. -func (j *TestJig) GetEndpointNodes(ctx context.Context) (map[string][]string, error) { - return j.GetEndpointNodesWithIP(ctx, v1.NodeExternalIP) -} - -// GetEndpointNodesWithIP returns a map of nodenames: on which the -// endpoints of the Service are running. -func (j *TestJig) GetEndpointNodesWithIP(ctx context.Context, addressType v1.NodeAddressType) (map[string][]string, error) { - nodes, err := j.ListNodesWithEndpoint(ctx) - if err != nil { - return nil, err - } - nodeMap := map[string][]string{} - for _, node := range nodes { - nodeMap[node.Name] = e2enode.GetAddresses(&node, addressType) - } - return nodeMap, nil -} - // ListNodesWithEndpoint returns a list of nodes on which the // endpoints of the given Service are running. func (j *TestJig) ListNodesWithEndpoint(ctx context.Context) ([]v1.Node, error) { diff --git a/test/e2e/network/service.go b/test/e2e/network/service.go index f1cd06b3e7d..49cedd0c855 100644 --- a/test/e2e/network/service.go +++ b/test/e2e/network/service.go @@ -698,16 +698,17 @@ func waitForAPIServerUp(ctx context.Context, c clientset.Interface) error { // getEndpointNodesWithInternalIP returns a map of nodenames:internal-ip on which the // endpoints of the Service are running. func getEndpointNodesWithInternalIP(ctx context.Context, jig *e2eservice.TestJig) (map[string]string, error) { - nodesWithIPs, err := jig.GetEndpointNodesWithIP(ctx, v1.NodeInternalIP) + nodes, err := jig.ListNodesWithEndpoint(ctx) if err != nil { return nil, err } - endpointsNodeMap := make(map[string]string, len(nodesWithIPs)) - for nodeName, internalIPs := range nodesWithIPs { + endpointsNodeMap := make(map[string]string, len(nodes)) + for _, node := range nodes { + internalIPs := e2enode.GetAddresses(&node, v1.NodeInternalIP) if len(internalIPs) < 1 { - return nil, fmt.Errorf("no internal ip found for node %s", nodeName) + return nil, fmt.Errorf("no internal ip found for node %s", node.Name) } - endpointsNodeMap[nodeName] = internalIPs[0] + endpointsNodeMap[node.Name] = internalIPs[0] } return endpointsNodeMap, nil }