summaryrefslogtreecommitdiff
path: root/test/e2e/run_dns_test.go
diff options
context:
space:
mode:
authorQi Wang <qiwan@redhat.com>2019-07-15 13:54:12 -0400
committerQi Wang <qiwan@redhat.com>2019-07-18 09:39:31 -0400
commit3f721f8b17780931a75f9e072e4d32bf9a49e976 (patch)
treede237c123cdeb0ceaae1d494443d1dc9b8a6f97f /test/e2e/run_dns_test.go
parentadcde2383f1da517c5788516d639745f5f01d300 (diff)
downloadpodman-3f721f8b17780931a75f9e072e4d32bf9a49e976.tar.gz
podman-3f721f8b17780931a75f9e072e4d32bf9a49e976.tar.bz2
podman-3f721f8b17780931a75f9e072e4d32bf9a49e976.zip
fix --dns* and --network not set to host conflict
Close #3553 This PR makes --dns, --dns-option, --dns-search, and --network not set to host flag mutually exclusive for podman build and create. Returns conflict error if both flags are set. Signed-off-by: Qi Wang <qiwan@redhat.com>
Diffstat (limited to 'test/e2e/run_dns_test.go')
-rw-r--r--test/e2e/run_dns_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/e2e/run_dns_test.go b/test/e2e/run_dns_test.go
index f1196ff38..081fab3fd 100644
--- a/test/e2e/run_dns_test.go
+++ b/test/e2e/run_dns_test.go
@@ -94,4 +94,22 @@ var _ = Describe("Podman run dns", func() {
Expect(session.ExitCode()).To(Equal(0))
Expect(session.LineInOutputContains("foobar")).To(BeTrue())
})
+
+ It("podman run mutually excludes --dns* and --network", func() {
+ session := podmanTest.Podman([]string{"run", "--dns=1.2.3.4", "--network", "container:ALPINE", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Not(Equal(0)))
+
+ session = podmanTest.Podman([]string{"run", "--dns-opt=1.2.3.4", "--network", "container:ALPINE", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Not(Equal(0)))
+
+ session = podmanTest.Podman([]string{"run", "--dns-search=foobar.com", "--network", "none", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Not(Equal(0)))
+
+ session = podmanTest.Podman([]string{"run", "--dns=1.2.3.4", "--network", "host", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To((Equal(0)))
+ })
})