Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curb flakes in integration tests #5330

Merged
merged 1 commit into from
Feb 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion test/e2e/run_staticip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
package integration

import (
"fmt"
"net/http"
"os"
"time"

. "github.com/containers/libpod/test/utils"
. "github.com/onsi/ginkgo"
Expand Down Expand Up @@ -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())
Expand Down
31 changes: 11 additions & 20 deletions test/e2e/search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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() {
Expand Down