func consumeScratchNetConf(containerID, dataDir string) ([]byte, error) {
path := filepath.Join(dataDir, containerID)
+ // Ignore errors when removing - Per spec safe to continue during DEL
defer os.Remove(path)
return ioutil.ReadFile(path)
netconfBytes, err := consumeScratchNetConf(args.ContainerID, nc.DataDir)
if err != nil {
+ if os.IsNotExist(err) {
+ // Per spec should ignore error if resources are missing / already removed
+ return nil
+ }
return err
}
By("check that plugin removes net config from state dir")
Expect(path).ShouldNot(BeAnExistingFile())
+
+ By("calling DEL again")
+ err = testutils.CmdDelWithResult(targetNs.Path(), IFNAME, func() error {
+ return cmdDel(args)
+ })
+ By("check that plugin does not fail due to missing net config")
+ Expect(err).NotTo(HaveOccurred())
+
return nil
})
Expect(err).NotTo(HaveOccurred())