Skip to content

Commit

Permalink
Ut Ipassigner Linux
Browse files Browse the repository at this point in the history
Signed-off-by: Rajnish Kumar <rajnishk1@vmware.com>
  • Loading branch information
rajnkamr committed Oct 4, 2023
1 parent c730c77 commit 765269f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
11 changes: 7 additions & 4 deletions pkg/agent/ipassigner/ip_assigner_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,13 @@ func TestIPAssigner_UnAssignIP(t *testing.T) {
expectedAssignedIPs: sets.New[string]("2.1.1.1", "2.2.2.1"),
},
{
name: "Unassign IPv4",
name: "Unassign IPv4",
ip: "2.1.1.1",
assignedIPs: sets.New[string]("2.1.1.1", "2.2.2.1"),
expectedAssignedIPs: sets.New[string]("2.2.2.1"),
},
{
name: "Unassign IPv6",
name: "Unassign IPv6",
ip: "2001:db8::1",
assignedIPs: sets.New[string]("2.2.2.1", "2001:db8::1"),
expectedAssignedIPs: sets.New[string]("2.2.2.1"),
Expand Down Expand Up @@ -317,8 +317,11 @@ func TestIPAssigner_InitIPs(t *testing.T) {
ndpResponder: mockResponder,
}

for ipStr := range tt.ips {
mockResponder.EXPECT().AddIP(net.ParseIP(ipStr)).Return(nil)
if (tt.ips).Has("192.168.1.100") {
mockResponder.EXPECT().AddIP(net.ParseIP("192.168.1.100")).Return(nil)
}
if (tt.ips).Has("192.168.1.101") {
mockResponder.EXPECT().AddIP(net.ParseIP("192.168.1.101")).Return(nil)
}

advertiseArpNdp := advertiseResponder
Expand Down
6 changes: 3 additions & 3 deletions pkg/agent/ipassigner/responder/testing/mock_responder.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 765269f

Please sign in to comment.