From 19db00f68032047d3fb59990fa5b6e8425cccae6 Mon Sep 17 00:00:00 2001 From: Jimmi Dyson Date: Thu, 29 Aug 2024 15:11:32 +0100 Subject: [PATCH] test: Check ignored IPs are filtered correctly (#188) **What this PR does / why we need it**: Adding missing test case in ignore IPs PR. **Which issue(s) this PR fixes** *(optional, in `fixes #(, fixes #, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **How Has This Been Tested?**: _Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration and test output_ **Special notes for your reviewer**: _Please confirm that if this PR changes any image versions, then that's the sole change this PR makes._ **Release note**: ```release-note ``` --- internal/testing/mock/mock_environment.go | 2 +- pkg/provider/manager_test.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/testing/mock/mock_environment.go b/internal/testing/mock/mock_environment.go index f054f5e7e..813e19338 100644 --- a/internal/testing/mock/mock_environment.go +++ b/internal/testing/mock/mock_environment.go @@ -117,7 +117,7 @@ func CreateMockEnvironment(ctx context.Context, kClient *fake.Clientset) (*MockE }, { IP: ptr.To("127.200.200.1"), }, { - IP: ptr.To("127.300.300.1"), + IP: ptr.To(MockIP), }}, }} filteredAddressesNode, err := createNodeForVM(ctx, kClient, filteredAddressesVM) diff --git a/pkg/provider/manager_test.go b/pkg/provider/manager_test.go index 9218a605d..2332c81a9 100644 --- a/pkg/provider/manager_test.go +++ b/pkg/provider/manager_test.go @@ -158,7 +158,9 @@ var _ = Describe("Test Manager", func() { addresses, err := m.getNodeAddresses(ctx, vm) Expect(err).ShouldNot(HaveOccurred()) Expect(len(addresses)).To(Equal(2), "Received addresses: %v", addresses) - Expect(addresses).Should(ContainElement(v1.NodeAddress{Type: v1.NodeInternalIP, Address: "127.300.300.1"})) + Expect(addresses).Should(ContainElement(v1.NodeAddress{Type: v1.NodeInternalIP, Address: mock.MockIP})) + Expect(addresses).ShouldNot(ContainElement(v1.NodeAddress{Type: v1.NodeInternalIP, Address: "127.100.100.1"})) + Expect(addresses).ShouldNot(ContainElement(v1.NodeAddress{Type: v1.NodeInternalIP, Address: "127.200.200.1"})) }) })