Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
paulyufan2 committed Aug 21, 2024
1 parent becb43f commit 27b09bd
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions cni/network/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1174,8 +1174,7 @@ func (n *InterfaceGetterMock) GetNetworkInterfaceAddrs(iface *net.Interface) ([]
if n.err != nil {
return nil, n.err
}
addrs, _ := iface.Addrs()
return addrs, nil
return n.addrs, nil
}

func TestPluginSwiftV2Add(t *testing.T) {
Expand Down Expand Up @@ -1692,6 +1691,37 @@ func TestFindMasterInterface(t *testing.T) {
want string // expected master interface name
wantErr bool
}{
{
name: "Find master interface by one infraNIC",
plugin: &NetPlugin{
Plugin: plugin,
report: &telemetry.CNIReport{},
tb: &telemetry.TelemetryBuffer{},
netClient: &InterfaceGetterMock{
interfaces: []net.Interface{
{
Name: "eth0",
},
},
},
},
endpointOpt: createEpInfoOpt{
ipamAddConfig: &IPAMAddConfig{
nwCfg: &cni.NetworkConfig{
Master: "eth0",
},
},
ifInfo: &acnnetwork.InterfaceInfo{
NICType: cns.InfraNIC,
HostSubnetPrefix: net.IPNet{
IP: net.ParseIP("10.0.0.0"),
Mask: net.CIDRMask(16, 32),
},
},
},
want: "eth0",
wantErr: false,
},
{
name: "Find master interface by infraNIC with a master interfaceName",
plugin: &NetPlugin{
Expand Down

0 comments on commit 27b09bd

Please sign in to comment.