update TestOnlyLocalNodePorts to make sure only add local RS

This commit is contained in:
Hong Zhiguo 2018-07-12 11:29:23 +08:00
parent c6990f973f
commit 8bb6a5fa9c

View File

@ -1001,12 +1001,26 @@ func TestOnlyLocalNodePorts(t *testing.T) {
) )
epIP := "10.180.0.1" epIP := "10.180.0.1"
epIP1 := "10.180.1.1"
thisHostname := testHostname
otherHostname := "other-hostname"
makeEndpointsMap(fp, makeEndpointsMap(fp,
makeTestEndpoints(svcPortName.Namespace, svcPortName.Name, func(ept *api.Endpoints) { makeTestEndpoints(svcPortName.Namespace, svcPortName.Name, func(ept *api.Endpoints) {
ept.Subsets = []api.EndpointSubset{{ ept.Subsets = []api.EndpointSubset{
{ // **local** endpoint address, should be added as RS
Addresses: []api.EndpointAddress{{ Addresses: []api.EndpointAddress{{
IP: epIP, IP: epIP,
NodeName: nil, NodeName: &thisHostname,
}},
Ports: []api.EndpointPort{{
Name: svcPortName.Port,
Port: int32(svcPort),
}}},
{ // **remote** endpoint address, should not be added as RS
Addresses: []api.EndpointAddress{{
IP: epIP1,
NodeName: &otherHostname,
}}, }},
Ports: []api.EndpointPort{{ Ports: []api.EndpointPort{{
Name: svcPortName.Port, Name: svcPortName.Port,