@@ -67,8 +67,9 @@ func AllocateAndReleaseAddressesTest(ipVersion string, ipamConf *whereaboutstype
6767 Netns : nspath ,
6868 IfName : ifname ,
6969 StdinData : cniConf ,
70- Args : cniArgs (podNamespace , podName ),
70+ Args : cniArgs (podNamespace , fmt . Sprintf ( "%v-%d" , podName , i ) ),
7171 }
72+ ipamConf .PodName = fmt .Sprintf ("%v-%d" , podName ,i )
7273 client := mutateK8sIPAM (args .ContainerID , ipamConf , wbClient )
7374
7475 // Allocate the IP
@@ -971,9 +972,9 @@ var _ = Describe("Whereabouts operations", func() {
971972 Netns : nspath ,
972973 IfName : ifname ,
973974 StdinData : []byte (conf ),
974- Args : cniArgs (podNamespace , podName ),
975+ Args : cniArgs (podNamespace , fmt . Sprintf ( "%v-%d" , podName , i ) ),
975976 }
976-
977+ ipamConf . PodName = fmt . Sprintf ( "%v-%d" , podName , i )
977978 k8sClient = mutateK8sIPAM (args .ContainerID , ipamConf , wbClient )
978979 r , raw , err := testutils .CmdAddWithArgs (args , func () error {
979980 return cmdAdd (args , k8sClient , cniVersion )
@@ -1000,8 +1001,9 @@ var _ = Describe("Whereabouts operations", func() {
10001001 Netns : nspath ,
10011002 IfName : ifname ,
10021003 StdinData : []byte (conf ),
1003- Args : cniArgs (podNamespace , podName ),
1004+ Args : cniArgs (podNamespace , fmt . Sprintf ( "%v-%d" , podName , 50 ) ),
10041005 }
1006+ ipamConf .PodName = fmt .Sprintf ("%v-%d" , podName ,50 )
10051007 _ , _ , err = testutils .CmdAddWithArgs (args , func () error {
10061008 return cmdAdd (args , mutateK8sIPAM (args .ContainerID , ipamConf , wbClient ), "0.3.1" )
10071009 })
@@ -1048,12 +1050,12 @@ var _ = Describe("Whereabouts operations", func() {
10481050 Netns : nspath ,
10491051 IfName : ifname ,
10501052 StdinData : []byte (conf ),
1051- Args : cniArgs (podNamespace , podName ),
1053+ Args : cniArgs (podNamespace , fmt . Sprintf ( "%v-%d" , podName , 0 ) ),
10521054 }
10531055
10541056 confPath := filepath .Join (tmpDir , "whereabouts.conf" )
10551057 Expect (os .WriteFile (confPath , []byte (conf ), 0755 )).To (Succeed ())
1056- ipamConf , cniVersion , err := config .LoadIPAMConfig ([]byte (conf ), cniArgs (podNamespace , podName ), confPath )
1058+ ipamConf , cniVersion , err := config .LoadIPAMConfig ([]byte (conf ), cniArgs (podNamespace , fmt . Sprintf ( "%v-%d" , podName , 0 ) ), confPath )
10571059 Expect (err ).NotTo (HaveOccurred ())
10581060 Expect (ipamConf .IPRanges ).NotTo (BeEmpty ())
10591061 wbClient := * kubernetes .NewKubernetesClient (
@@ -1102,12 +1104,12 @@ var _ = Describe("Whereabouts operations", func() {
11021104 Netns : nspath ,
11031105 IfName : ifname ,
11041106 StdinData : []byte (confsecond ),
1105- Args : cniArgs (podNamespace , podName ),
1107+ Args : cniArgs (podNamespace , fmt . Sprintf ( "%v-%d" , podName , 1 ) ),
11061108 }
11071109
11081110 secondConfPath := filepath .Join (tmpDir , "whereabouts.conf" )
11091111 Expect (os .WriteFile (confPath , []byte (confsecond ), 0755 )).To (Succeed ())
1110- secondIPAMConf , secondCNIVersion , err := config .LoadIPAMConfig ([]byte (confsecond ), cniArgs (podNamespace , podName ), secondConfPath )
1112+ secondIPAMConf , secondCNIVersion , err := config .LoadIPAMConfig ([]byte (confsecond ), cniArgs (podNamespace , fmt . Sprintf ( "%v-%d" , podName , 1 ) ), secondConfPath )
11111113 Expect (err ).NotTo (HaveOccurred ())
11121114
11131115 // Allocate the IP
@@ -1170,12 +1172,12 @@ var _ = Describe("Whereabouts operations", func() {
11701172 Netns : nspath ,
11711173 IfName : ifname ,
11721174 StdinData : []byte (conf ),
1173- Args : cniArgs (podNamespace , podName ),
1175+ Args : cniArgs (podNamespace , fmt . Sprintf ( "%v-%d" , podName , 0 ) ),
11741176 }
11751177
11761178 confPath := filepath .Join (tmpDir , "whereabouts.conf" )
11771179 Expect (os .WriteFile (confPath , []byte (conf ), 0755 )).To (Succeed ())
1178- ipamConf , cniVersion , err := config .LoadIPAMConfig ([]byte (conf ), cniArgs (podNamespace , podName ), confPath )
1180+ ipamConf , cniVersion , err := config .LoadIPAMConfig ([]byte (conf ), cniArgs (podNamespace , fmt . Sprintf ( "%v-%d" , podName , 0 ) ), confPath )
11791181 Expect (err ).NotTo (HaveOccurred ())
11801182 Expect (ipamConf .IPRanges ).NotTo (BeEmpty ())
11811183 wbClient := * kubernetes .NewKubernetesClient (
@@ -1224,12 +1226,12 @@ var _ = Describe("Whereabouts operations", func() {
12241226 Netns : nspath ,
12251227 IfName : ifname ,
12261228 StdinData : []byte (confsecond ),
1227- Args : cniArgs (podNamespace , podName ),
1229+ Args : cniArgs (podNamespace , fmt . Sprintf ( "%v-%d" , podName , 1 ) ),
12281230 }
12291231
12301232 secondConfPath := filepath .Join (tmpDir , "whereabouts.conf" )
12311233 Expect (os .WriteFile (confPath , []byte (confsecond ), 0755 )).To (Succeed ())
1232- secondIPAMConf , secondCNIVersion , err := config .LoadIPAMConfig ([]byte (confsecond ), cniArgs (podNamespace , podName ), secondConfPath )
1234+ secondIPAMConf , secondCNIVersion , err := config .LoadIPAMConfig ([]byte (confsecond ), cniArgs (podNamespace , fmt . Sprintf ( "%v-%d" , podName , 1 ) ), secondConfPath )
12331235 Expect (err ).NotTo (HaveOccurred ())
12341236
12351237 // Allocate the IP
0 commit comments