mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 18:31:15 +00:00
Merge pull request #115577 from princepereira/ppereira-kubeproxy-ipv6-ut
[#115501] Unit testcase for the fix for issue with missing Loadbalancer policies for IPV6 endpoints in Dualstack mode.
This commit is contained in:
commit
e4c8802407
@ -23,6 +23,7 @@ import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/Microsoft/hcsshim/hcn"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"strings"
|
||||
"testing"
|
||||
@ -37,6 +38,7 @@ const (
|
||||
gatewayAddress = "192.168.1.1"
|
||||
epMacAddress = "00-11-22-33-44-55"
|
||||
epIpAddress = "192.168.1.3"
|
||||
epIpv6Address = "192::3"
|
||||
epIpAddressB = "192.168.1.4"
|
||||
epIpAddressRemote = "192.168.2.3"
|
||||
epPaAddress = "10.0.0.3"
|
||||
@ -63,6 +65,51 @@ func TestGetNetworkByName(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetAllEndpointsByNetwork(t *testing.T) {
|
||||
hns := hns{}
|
||||
Network := mustTestNetwork(t)
|
||||
|
||||
ipv4Config := &hcn.IpConfig{
|
||||
IpAddress: epIpAddress,
|
||||
}
|
||||
ipv6Config := &hcn.IpConfig{
|
||||
IpAddress: epIpv6Address,
|
||||
}
|
||||
Endpoint := &hcn.HostComputeEndpoint{
|
||||
IpConfigurations: []hcn.IpConfig{*ipv4Config, *ipv6Config},
|
||||
MacAddress: epMacAddress,
|
||||
SchemaVersion: hcn.SchemaVersion{
|
||||
Major: 2,
|
||||
Minor: 0,
|
||||
},
|
||||
}
|
||||
Endpoint, err := Network.CreateEndpoint(Endpoint)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
mapEndpointsInfo, err := hns.getAllEndpointsByNetwork(Network.Name)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
endpointIpv4, ipv4EpPresent := mapEndpointsInfo[ipv4Config.IpAddress]
|
||||
assert.True(t, ipv4EpPresent, "IPV4 endpoint is missing in Dualstack mode")
|
||||
assert.Equal(t, endpointIpv4.ip, epIpAddress, "IPV4 IP is missing in Dualstack mode")
|
||||
|
||||
endpointIpv6, ipv6EpPresent := mapEndpointsInfo[ipv6Config.IpAddress]
|
||||
assert.True(t, ipv6EpPresent, "IPV6 endpoint is missing in Dualstack mode")
|
||||
assert.Equal(t, endpointIpv6.ip, epIpv6Address, "IPV6 IP is missing in Dualstack mode")
|
||||
|
||||
err = Endpoint.Delete()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
err = Network.Delete()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetEndpointByID(t *testing.T) {
|
||||
hns := hns{}
|
||||
Network := mustTestNetwork(t)
|
||||
|
Loading…
Reference in New Issue
Block a user