diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-09-27 15:23:57 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-27 15:23:57 -0400 |
commit | 2fabd44fe5ad39feeb04bd57e7fe6afd354edf20 (patch) | |
tree | 8179ee1d939312d9f02d64242b30c84ce43f52d2 /libpod/network/cni/config_test.go | |
parent | 739359d899d282c9576b45c8ed71937e198f9650 (diff) | |
parent | ca3c08bf9c647f4c8300b34919bf0107c2ef2718 (diff) | |
download | podman-2fabd44fe5ad39feeb04bd57e7fe6afd354edf20.tar.gz podman-2fabd44fe5ad39feeb04bd57e7fe6afd354edf20.tar.bz2 podman-2fabd44fe5ad39feeb04bd57e7fe6afd354edf20.zip |
Merge pull request #11756 from Luap99/network-prune
CNI: network remove do not error for ENOENT
Diffstat (limited to 'libpod/network/cni/config_test.go')
-rw-r--r-- | libpod/network/cni/config_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libpod/network/cni/config_test.go b/libpod/network/cni/config_test.go index a0a0ea1af..288cf4626 100644 --- a/libpod/network/cni/config_test.go +++ b/libpod/network/cni/config_test.go @@ -1021,6 +1021,27 @@ var _ = Describe("Config", func() { Expect(err.Error()).To(ContainSubstring("subnet 10.10.0.0/24 is already used on the host or by another config")) }) + It("remove network should not error when config file does not exists on disk", func() { + name := "mynet" + network := types.Network{Name: name} + _, err := libpodNet.NetworkCreate(network) + Expect(err).To(BeNil()) + + path := filepath.Join(cniConfDir, name+".conflist") + Expect(path).To(BeARegularFile()) + + err = os.Remove(path) + Expect(err).To(BeNil()) + Expect(path).ToNot(BeARegularFile()) + + err = libpodNet.NetworkRemove(name) + Expect(err).To(BeNil()) + + nets, err := libpodNet.NetworkList() + Expect(err).To(BeNil()) + Expect(nets).To(HaveLen(1)) + Expect(nets).ToNot(ContainElement(HaveNetworkName(name))) + }) }) Context("network load valid existing ones", func() { |