44package network
55
66import (
7- "context"
8- "errors"
97 "net"
108 "testing"
119
@@ -15,18 +13,8 @@ import (
1513 "github.com/Azure/azure-container-networking/network/networkutils"
1614 "github.com/Azure/azure-container-networking/platform"
1715 "github.com/stretchr/testify/require"
18- "k8s.io/kubernetes/pkg/kubelet"
1916)
2017
21- var errMockDHCPFailure = errors .New ("failed to send dhcp discover packet" )
22-
23- // mockDHCPFail is a failing DHCP client mock for testing error scenarios
24- type mockDHCPFail struct {}
25-
26- func (netns * mockDHCPFail ) DiscoverRequest (context.Context , net.HardwareAddr , string ) error {
27- return errMockDHCPFailure
28- }
29-
3018func TestSecondaryAddEndpoints (t * testing.T ) {
3119 nl := netlink .NewMockNetlink (false , "" )
3220 plc := platform .NewMockExecClient (false )
@@ -375,33 +363,6 @@ func TestSecondaryConfigureContainerInterfacesAndRoutes(t *testing.T) {
375363 wantErr : true ,
376364 wantErrMsg : "SecondaryEndpointClient Error: routes expected for eth1" ,
377365 },
378- {
379- name : "Configure Interface and routes fail with network is not ready error" ,
380- client : & SecondaryEndpointClient {
381- netlink : netlink .NewMockNetlink (false , "" ),
382- plClient : platform .NewMockExecClient (false ),
383- netUtilsClient : networkutils .NewNetworkUtils (nl , plc ),
384- netioshim : netio .NewMockNetIO (false , 0 ),
385- dhcpClient : & mockDHCPFail {},
386- ep : & endpoint {SecondaryInterfaces : map [string ]* InterfaceInfo {"eth1" : {Name : "eth1" }}},
387- },
388- epInfo : & EndpointInfo {
389- IfName : "eth1" ,
390- IPAddresses : []net.IPNet {
391- {
392- IP : net .ParseIP ("192.168.0.4" ),
393- Mask : net .CIDRMask (subnetv4Mask , ipv4Bits ),
394- },
395- },
396- Routes : []RouteInfo {
397- {
398- Dst : net.IPNet {IP : net .ParseIP ("192.168.0.4" ), Mask : net .CIDRMask (ipv4FullMask , ipv4Bits )},
399- },
400- },
401- },
402- wantErr : true ,
403- wantErrMsg : kubelet .NetworkNotReadyErrorMsg ,
404- },
405366 }
406367
407368 for _ , tt := range tests {
0 commit comments