Add failing run test for netavark

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger 2021-11-11 17:49:18 +01:00
parent fe90a45e0d
commit 3af19917a1
No known key found for this signature in database
GPG Key ID: EB145DD938A3CAF2
1 changed files with 31 additions and 0 deletions

View File

@ -619,6 +619,37 @@ var _ = Describe("run netavark", func() {
Expect(err).To(HaveOccurred())
})
})
It("test netavark error", func() {
runTest(func() {
intName := "eth0"
err := netNSContainer.Do(func(_ ns.NetNS) error {
defer GinkgoRecover()
attr := netlink.NewLinkAttrs()
attr.Name = "eth0"
err := netlink.LinkAdd(&netlink.Bridge{LinkAttrs: attr})
Expect(err).ToNot(HaveOccurred())
return nil
})
Expect(err).ToNot(HaveOccurred())
defNet := types.DefaultNetworkName
opts := types.SetupOptions{
NetworkOptions: types.NetworkOptions{
ContainerID: "someID",
ContainerName: "someName",
Networks: map[string]types.PerNetworkOptions{
defNet: {
InterfaceName: intName,
},
},
},
}
_, err = libpodNet.Setup(netNSContainer.Path(), opts)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("interface eth0 already exists on container namespace"))
})
})
})
func runNetListener(wg *sync.WaitGroup, protocol, ip string, port int, expectedData string) {