diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-02-02 10:25:18 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-02 10:25:18 -0500 |
commit | 27cff475d5d99f6d59072c52a0f4e6d617d8d06c (patch) | |
tree | b2d5a4908ca7fbac0a4afb092d755a1d0e8e8d62 /test | |
parent | 67d48c56a61fbdfe18e33a2f765373d581ac5724 (diff) | |
parent | 4b00992ac4ad3314eb100bf7d7a5aaa2c84ae303 (diff) | |
download | podman-27cff475d5d99f6d59072c52a0f4e6d617d8d06c.tar.gz podman-27cff475d5d99f6d59072c52a0f4e6d617d8d06c.tar.bz2 podman-27cff475d5d99f6d59072c52a0f4e6d617d8d06c.zip |
Merge pull request #9198 from baude/v3backportmacvlan
[3.0]add macvlan as a supported network driver
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/common_test.go | 10 | ||||
-rw-r--r-- | test/e2e/network_test.go | 41 |
2 files changed, 51 insertions, 0 deletions
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index 2668b1e7b..59b52bff7 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -1,6 +1,7 @@ package integration import ( + "bytes" "fmt" "io/ioutil" "math/rand" @@ -790,3 +791,12 @@ func (p *PodmanTestIntegration) removeCNINetwork(name string) { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(BeNumerically("<=", 1)) } + +func (p *PodmanSessionIntegration) jq(jqCommand string) (string, error) { + var out bytes.Buffer + cmd := exec.Command("jq", jqCommand) + cmd.Stdin = strings.NewReader(p.OutputToString()) + cmd.Stdout = &out + err := cmd.Run() + return strings.TrimRight(out.String(), "\n"), err +} diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go index a7e83220b..df8ff0684 100644 --- a/test/e2e/network_test.go +++ b/test/e2e/network_test.go @@ -456,4 +456,45 @@ var _ = Describe("Podman network", func() { nc.WaitWithDefaultTimeout() Expect(nc.ExitCode()).To(Equal(0)) }) + + It("podman network create/remove macvlan as driver (-d) no device name", func() { + net := "macvlan" + stringid.GenerateNonCryptoID() + nc := podmanTest.Podman([]string{"network", "create", "-d", "macvlan", net}) + nc.WaitWithDefaultTimeout() + defer podmanTest.removeCNINetwork(net) + Expect(nc.ExitCode()).To(Equal(0)) + + inspect := podmanTest.Podman([]string{"network", "inspect", net}) + inspect.WaitWithDefaultTimeout() + Expect(inspect.ExitCode()).To(BeZero()) + + out, err := inspect.jq(".[0].plugins[0].master") + Expect(err).To(BeNil()) + Expect(out).To(Equal("\"\"")) + + nc = podmanTest.Podman([]string{"network", "rm", net}) + nc.WaitWithDefaultTimeout() + Expect(nc.ExitCode()).To(Equal(0)) + }) + + It("podman network create/remove macvlan as driver (-d) with device name", func() { + net := "macvlan" + stringid.GenerateNonCryptoID() + nc := podmanTest.Podman([]string{"network", "create", "-d", "macvlan", "-o", "parent=lo", net}) + nc.WaitWithDefaultTimeout() + defer podmanTest.removeCNINetwork(net) + Expect(nc.ExitCode()).To(Equal(0)) + + inspect := podmanTest.Podman([]string{"network", "inspect", net}) + inspect.WaitWithDefaultTimeout() + Expect(inspect.ExitCode()).To(BeZero()) + fmt.Println(inspect.OutputToString()) + + out, err := inspect.jq(".[0].plugins[0].master") + Expect(err).To(BeNil()) + Expect(out).To(Equal("\"lo\"")) + + nc = podmanTest.Podman([]string{"network", "rm", net}) + nc.WaitWithDefaultTimeout() + Expect(nc.ExitCode()).To(Equal(0)) + }) }) |