Skip to content

Commit

Permalink
test: Check ignored IPs are filtered correctly (#188)
Browse files Browse the repository at this point in the history
<!--  Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, read our contributor guidelines
https://github.com/nutanix-cloud-native/cloud-provider-nutanix/blob/main/CONTRIBUTING.md
and developer guide
https://git.k8s.io/community/contributors/devel/development.md#development-guide
2. If you want *faster* PR reviews, read how:
https://git.k8s.io/community/contributors/guide/pull-requests.md#best-practices-for-faster-reviews
3. Follow the instructions for writing a release note:
https://git.k8s.io/community/contributors/guide/release-notes.md
4. If the PR is unfinished, see how to mark it:
https://git.k8s.io/community/contributors/guide/pull-requests.md#marking-unfinished-pull-requests
5. If this PR changes image versions, please title this PR "Bump <image
name> from x.x.x to y.y.y."
-->

**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 #<issue number>(,
fixes #<issue_number>, ...)` 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**:
<!--  Write your release note:
1. Enter your extended release note in the below block. If the PR
requires additional action from users switching to the new release,
include the string "action required".
2. If no release note is required, just write "NONE".
-->
```release-note

```
  • Loading branch information
jimmidyson authored Aug 29, 2024
1 parent 5cc04af commit 19db00f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/testing/mock/mock_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion pkg/provider/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}))
})
})

Expand Down

0 comments on commit 19db00f

Please sign in to comment.