summaryrefslogtreecommitdiff
path: root/test/e2e/create_staticip_test.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-02-21 07:58:46 -0500
committerGitHub <noreply@github.com>2020-02-21 07:58:46 -0500
commit1c476d769610774864275711f49e429e27d84a73 (patch)
tree25f074111815329baec91da094f68476ce89c3ee /test/e2e/create_staticip_test.go
parentaae8874204ace4b15cd2bc84cfd05d3e1a70da52 (diff)
parenta1dcfd47a1a35d47c51c10cc644d70f177bfdc0f (diff)
downloadpodman-1c476d769610774864275711f49e429e27d84a73.tar.gz
podman-1c476d769610774864275711f49e429e27d84a73.tar.bz2
podman-1c476d769610774864275711f49e429e27d84a73.zip
Merge pull request #5286 from edsantiago/flake_fix_same_ip
Flake fix: race condition in same-IP test
Diffstat (limited to 'test/e2e/create_staticip_test.go')
-rw-r--r--test/e2e/create_staticip_test.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/e2e/create_staticip_test.go b/test/e2e/create_staticip_test.go
index 72a0638f9..693795637 100644
--- a/test/e2e/create_staticip_test.go
+++ b/test/e2e/create_staticip_test.go
@@ -4,6 +4,7 @@ package integration
import (
"os"
+ "time"
. "github.com/containers/libpod/test/utils"
. "github.com/onsi/ginkgo"
@@ -86,8 +87,23 @@ var _ = Describe("Podman create with --ip flag", func() {
result = podmanTest.Podman([]string{"start", "test1"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
+
+ // race prevention: wait until IP address is assigned
+ for i := 0; i < 5; i++ {
+ result = podmanTest.Podman([]string{"inspect", "--format", "{{.NetworkSettings.IPAddress}}", "test1"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ if result.OutputToString() != "" {
+ break
+ }
+ time.Sleep(1 * time.Second)
+ }
+ Expect(result.OutputToString()).To(Equal(ip))
+
+ // test1 container is running with the given IP.
result = podmanTest.Podman([]string{"start", "test2"})
result.WaitWithDefaultTimeout()
Expect(result).To(ExitWithError())
+ Expect(result.ErrorToString()).To(ContainSubstring("requested IP address " + ip + " is not available"))
})
})