prework: ingress status updater tests: consider dual stack nodes

again, no actual behaviour change here, just augmenting tests to show
current behaviour before i go changing it.

I changed the node IPv4 IP because other bits of the tests used the same
IP for a mock load balancer.
This commit is contained in:
Jarrad Whitaker 2023-12-14 11:21:26 +11:00
parent 6df8b2a828
commit 5f939ee97c
No known key found for this signature in database

View file

@ -143,10 +143,19 @@ func buildSimpleClientSet() *testclient.Clientset {
Addresses: []apiv1.NodeAddress{
{
Type: apiv1.NodeInternalIP,
Address: "10.0.0.1",
}, {
Address: "10.0.1.1",
},
{
Type: apiv1.NodeInternalIP,
Address: "fd80::1:1",
},
{
Type: apiv1.NodeExternalIP,
Address: "10.0.0.2",
Address: "11.0.1.1",
},
{
Type: apiv1.NodeExternalIP,
Address: "2001::1:1",
},
},
},
@ -159,11 +168,19 @@ func buildSimpleClientSet() *testclient.Clientset {
Addresses: []apiv1.NodeAddress{
{
Type: apiv1.NodeInternalIP,
Address: "11.0.0.1",
Address: "10.0.1.2",
},
{
Type: apiv1.NodeInternalIP,
Address: "fd80::1:2",
},
{
Type: apiv1.NodeExternalIP,
Address: "11.0.0.2",
Address: "11.0.1.2",
},
{
Type: apiv1.NodeExternalIP,
Address: "2001::1:2",
},
},
},
@ -325,10 +342,10 @@ func TestStatusActions(t *testing.T) {
if err := fk.sync("just-test"); err != nil {
t.Errorf("unexpected error: %v", err)
}
// PublishService is empty, so the running address is: ["11.0.0.2"]
// after updated, the ingress's ip should only be "11.0.0.2"
// PublishService is empty, so the running address is the node's: ["11.0.1.2"]
// after updated, the ingress's ip should only be "11.0.1.2"
newIPs := []networking.IngressLoadBalancerIngress{{
IP: "11.0.0.2",
IP: "11.0.1.2",
}}
fooIngress1, err1 := fk.Client.NetworkingV1().Ingresses(apiv1.NamespaceDefault).Get(context.TODO(), "foo_ingress_1", metav1.GetOptions{})
if err1 != nil {
@ -602,8 +619,8 @@ func TestRunningAddressesWithPods(t *testing.T) {
t.Fatalf("returned %v but expected %v", rl, 1)
}
rv := r[0]
if rv.IP != "11.0.0.2" {
t.Errorf("returned %v but expected %v", rv, networking.IngressLoadBalancerIngress{IP: "11.0.0.2"})
if rv.IP != "11.0.1.2" {
t.Errorf("returned %v but expected %v", rv, networking.IngressLoadBalancerIngress{IP: "11.0.1.2"})
}
}