@@ -125,9 +125,8 @@ func buildOneConfig(cniVersion string, orig *NetConf, prevResult types.Result) (
125
125
126
126
}
127
127
128
- func multinicAddCheckDelTest (conf , masterName string , originalNS , targetNS ns.NetNS ) {
129
- log .Printf ("multinicAddCheckDelTest" )
130
- log .Printf ("%s" , conf )
128
+ func multinicAddTest (conf , masterName string , originalNS , targetNS ns.NetNS ) types.Result {
129
+ log .Printf ("Add %s" , conf )
131
130
// Unmarshal to pull out CNI spec version
132
131
rawConfig := make (map [string ]interface {})
133
132
err := json .Unmarshal ([]byte (conf ), & rawConfig )
@@ -176,6 +175,23 @@ func multinicAddCheckDelTest(conf, masterName string, originalNS, targetNS ns.Ne
176
175
return nil
177
176
})
178
177
Expect (err ).NotTo (HaveOccurred ())
178
+ return result
179
+ }
180
+
181
+ func multinicCheckDelTest (conf , masterName string , originalNS , targetNS ns.NetNS , result types.Result ) {
182
+ log .Printf ("CheckDel %s" , conf )
183
+ // Unmarshal to pull out CNI spec version
184
+ rawConfig := make (map [string ]interface {})
185
+ err := json .Unmarshal ([]byte (conf ), & rawConfig )
186
+ Expect (err ).NotTo (HaveOccurred ())
187
+ cniVersion := rawConfig ["cniVersion" ].(string )
188
+
189
+ args := & skel.CmdArgs {
190
+ ContainerID : "dummy" ,
191
+ Netns : targetNS .Path (),
192
+ IfName : "net1" ,
193
+ StdinData : []byte (conf ),
194
+ }
179
195
180
196
n := & NetConf {}
181
197
err = json .Unmarshal ([]byte (conf ), & n )
@@ -228,6 +244,19 @@ func multinicAddCheckDelTest(conf, masterName string, originalNS, targetNS ns.Ne
228
244
Expect (err ).NotTo (HaveOccurred ())
229
245
}
230
246
247
+ func multinicAddCheckDelTest (conf , masterName string , originalNS , targetNS ns.NetNS ) {
248
+ log .Printf ("multinicAddCheckDelTest" )
249
+ result := multinicAddTest (conf , masterName , originalNS , targetNS )
250
+ multinicCheckDelTest (conf , masterName , originalNS , targetNS , result )
251
+ }
252
+
253
+ func multinicDelWithoutDaemonTest (conf , masterName string , originalNS , targetNS ns.NetNS ) {
254
+ log .Printf ("multinicDelWithoutDaemonTest" )
255
+ result := multinicAddTest (conf , masterName , originalNS , targetNS )
256
+ confWithoutDaemon := strings .ReplaceAll (conf , BRIDGE_HOST_IP , "" )
257
+ multinicCheckDelTest (confWithoutDaemon , masterName , originalNS , targetNS , result )
258
+ }
259
+
231
260
type tester interface {
232
261
// verifyResult minimally verifies the Result and returns the interface's MAC address
233
262
verifyResult (result types.Result , name string ) string
@@ -405,6 +434,7 @@ var _ = Describe("Operations", func() {
405
434
` , BRIDGE_HOST_IP , daemonPort )
406
435
conf := getConfig (ver , multiNICIPAM , masterNets )
407
436
multinicAddCheckDelTest (conf , "" , originalNS , targetNS )
437
+ multinicDelWithoutDaemonTest (conf , "" , originalNS , targetNS )
408
438
})
409
439
It (fmt .Sprintf ("[%s] configures and deconfigures link with ADD/DEL (single-nic IPAM)" , ver ), func () {
410
440
conf := getConfig (ver , singleNICIPAM , masterNets )
0 commit comments