@@ -16,6 +16,7 @@ import (
1616 "github.com/Azure/azure-container-networking/platform"
1717 "github.com/Azure/azure-container-networking/telemetry"
1818 cniSkel "github.com/containernetworking/cni/pkg/skel"
19+ "github.com/containernetworking/cni/pkg/types"
1920 "github.com/stretchr/testify/assert"
2021 "github.com/stretchr/testify/require"
2122)
@@ -333,11 +334,19 @@ func TestPluginLinuxAdd(t *testing.T) {
333334 // Based on a live swiftv2 linux cluster's cns invoker response
334335 name : "Add Happy Path Swiftv2" ,
335336 plugin : & NetPlugin {
336- Plugin : resources .Plugin ,
337- nm : network .NewMockNetworkmanager (network .NewMockEndpointClient (nil )),
338- tb : & telemetry.TelemetryBuffer {},
339- report : & telemetry.CNIReport {},
340- ipamInvoker : NewCustomMockIpamInvoker (GetTestCNSResponseSecondaryLinux (macAddress )),
337+ Plugin : resources .Plugin ,
338+ nm : network .NewMockNetworkmanager (network .NewMockEndpointClient (nil )),
339+ tb : & telemetry.TelemetryBuffer {},
340+ report : & telemetry.CNIReport {},
341+ ipamInvoker : & MockIpamInvoker {
342+ add : func (opt IPAMAddConfig ) (ipamAddResult IPAMAddResult , err error ) {
343+ ipamAddResult = IPAMAddResult {interfaceInfo : make (map [string ]network.InterfaceInfo )}
344+ ipamAddResult .interfaceInfo = GetTestCNSResponseSecondaryLinux (macAddress )
345+ opt .options ["testflag" ] = "copy"
346+ return ipamAddResult , nil
347+ },
348+ ipMap : make (map [string ]bool ),
349+ },
341350 netClient : & InterfaceGetterMock {
342351 // used in secondary find master interface
343352 interfaces : []net.Interface {
@@ -396,7 +405,9 @@ func TestPluginLinuxAdd(t *testing.T) {
396405 NetNsPath : "bc526fae-4ba0-4e80-bc90-ad721e5850bf" ,
397406 NetNs : "bc526fae-4ba0-4e80-bc90-ad721e5850bf" ,
398407 HostSubnetPrefix : "10.224.0.0/16" ,
399- Options : map [string ]interface {}{},
408+ Options : map [string ]interface {}{
409+ "testflag" : "copy" ,
410+ },
400411 // matches with cns ip configuration
401412 IPAddresses : []net.IPNet {
402413 {
@@ -445,7 +456,9 @@ func TestPluginLinuxAdd(t *testing.T) {
445456 NetNsPath : "bc526fae-4ba0-4e80-bc90-ad721e5850bf" ,
446457 NetNs : "bc526fae-4ba0-4e80-bc90-ad721e5850bf" ,
447458 HostSubnetPrefix : "<nil>" ,
448- Options : map [string ]interface {}{},
459+ Options : map [string ]interface {}{
460+ "testflag" : "copy" ,
461+ },
449462 // matches with cns ip configuration
450463 IPAddresses : []net.IPNet {
451464 {
0 commit comments