From 227893dc3d900bde6fd2ee31eba4269902dc4b6c Mon Sep 17 00:00:00 2001 From: Lars Ekman Date: Tue, 11 Dec 2018 10:07:04 +0100 Subject: [PATCH] Corrected test TestOnlyLocalLoadBalancing --- pkg/proxy/ipvs/proxier_test.go | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/pkg/proxy/ipvs/proxier_test.go b/pkg/proxy/ipvs/proxier_test.go index 921ff01f0d..1bfc547f36 100644 --- a/pkg/proxy/ipvs/proxier_test.go +++ b/pkg/proxy/ipvs/proxier_test.go @@ -1267,18 +1267,32 @@ func TestOnlyLocalLoadBalancing(t *testing.T) { ) epIP := "10.180.0.1" + epIP1 := "10.180.1.1" + thisHostname := testHostname + otherHostname := "other-hostname" + makeEndpointsMap(fp, makeTestEndpoints(svcPortName.Namespace, svcPortName.Name, func(ept *v1.Endpoints) { - ept.Subsets = []v1.EndpointSubset{{ - Addresses: []v1.EndpointAddress{{ - IP: epIP, - NodeName: nil, - }}, - Ports: []v1.EndpointPort{{ - Name: svcPortName.Port, - Port: int32(svcPort), - }}, - }} + ept.Subsets = []v1.EndpointSubset{ + { // **local** endpoint address, should be added as RS + Addresses: []v1.EndpointAddress{{ + IP: epIP, + NodeName: &thisHostname, + }}, + Ports: []v1.EndpointPort{{ + Name: svcPortName.Port, + Port: int32(svcPort), + }}}, + { // **remote** endpoint address, should not be added as RS + Addresses: []v1.EndpointAddress{{ + IP: epIP1, + NodeName: &otherHostname, + }}, + Ports: []v1.EndpointPort{{ + Name: svcPortName.Port, + Port: int32(svcPort), + }}, + }} }), )