From 04f1306c87a6aad73487dd0da5d65f77fb23f2d2 Mon Sep 17 00:00:00 2001 From: Brent Baude Date: Tue, 25 Feb 2020 15:51:34 -0600 Subject: curb flakes in integration tests instead of searching the fedora registry which is error prone, we instead search a local registry for the empty set search. when running two containers with the same IP, i suspect the first container has not fully gotten its ip information back from cni when the second container fires. rework this test such that we use nginx to make sure the container is up and running before continues which should pace the subsequent test. Signed-off-by: Brent Baude --- test/e2e/run_staticip_test.go | 16 +++++++++++++++- test/e2e/search_test.go | 31 +++++++++++-------------------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/test/e2e/run_staticip_test.go b/test/e2e/run_staticip_test.go index 5b4842fea..5ad8f9fb0 100644 --- a/test/e2e/run_staticip_test.go +++ b/test/e2e/run_staticip_test.go @@ -3,7 +3,10 @@ package integration import ( + "fmt" + "net/http" "os" + "time" . "github.com/containers/libpod/test/utils" . "github.com/onsi/ginkgo" @@ -65,9 +68,20 @@ var _ = Describe("Podman run with --ip flag", func() { It("Podman run two containers with the same IP", func() { ip := GetRandomIPAddress() - result := podmanTest.Podman([]string{"run", "-d", "--ip", ip, ALPINE, "sleep", "999"}) + result := podmanTest.Podman([]string{"run", "-dt", "--ip", ip, nginx}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(0)) + for i := 0; i < 10; i++ { + fmt.Println("Waiting for nginx", err) + time.Sleep(1 * time.Second) + response, err := http.Get(fmt.Sprintf("http://%s", ip)) + if err != nil { + continue + } + if response.StatusCode == http.StatusOK { + break + } + } result = podmanTest.Podman([]string{"run", "-ti", "--ip", ip, ALPINE, "ip", "addr"}) result.WaitWithDefaultTimeout() Expect(result).To(ExitWithError()) diff --git a/test/e2e/search_test.go b/test/e2e/search_test.go index a697831ab..6d762d338 100644 --- a/test/e2e/search_test.go +++ b/test/e2e/search_test.go @@ -5,15 +5,13 @@ package integration import ( "bytes" "fmt" + . "github.com/containers/libpod/test/utils" + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" "io/ioutil" "os" "strconv" "text/template" - "time" - - . "github.com/containers/libpod/test/utils" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" ) type endpoint struct { @@ -165,21 +163,6 @@ registries = ['{{.Host}}:{{.Port}}']` } }) - It("podman search v2 registry with empty query", func() { - var search *PodmanSessionIntegration - for i := 0; i < 5; i++ { - search = podmanTest.Podman([]string{"search", "registry.fedoraproject.org/"}) - search.WaitWithDefaultTimeout() - if search.ExitCode() == 0 { - break - } - fmt.Println("Search failed; sleeping & retrying...") - time.Sleep(2 * time.Second) - } - Expect(search.ExitCode()).To(Equal(0)) - Expect(len(search.OutputToStringArray())).To(BeNumerically(">=", 1)) - }) - It("podman search attempts HTTP if tls-verify flag is set false", func() { if podmanTest.Host.Arch == "ppc64le" { Skip("No registry image for ppc64le") @@ -234,6 +217,14 @@ registries = ['{{.Host}}:{{.Port}}']` Expect(search.ExitCode()).To(Equal(0)) Expect(search.OutputToString()).ShouldNot(BeEmpty()) + + // podman search v2 registry with empty query + searchEmpty := podmanTest.PodmanNoCache([]string{"search", fmt.Sprintf("%s/", registryEndpoints[3].Address()), "--tls-verify=false"}) + searchEmpty.WaitWithDefaultTimeout() + Expect(searchEmpty.ExitCode()).To(BeZero()) + Expect(len(searchEmpty.OutputToStringArray())).To(BeNumerically(">=", 1)) + match, _ := search.GrepString("my-alpine") + Expect(match).Should(BeTrue()) }) It("podman search attempts HTTP if registry is in registries.insecure and force secure is false", func() { -- cgit v1.2.3-54-g00ecf