diff options
Diffstat (limited to 'test/e2e/common_test.go')
-rw-r--r-- | test/e2e/common_test.go | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index b1cd76d27..cb6574f23 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -809,7 +809,8 @@ func (p *PodmanTestIntegration) RestoreArtifactToCache(image string) error { func populateCache(podman *PodmanTestIntegration) { for _, image := range CACHE_IMAGES { - podman.RestoreArtifactToCache(image) + err := podman.RestoreArtifactToCache(image) + Expect(err).To(BeNil()) } // logformatter uses this to recognize the first test fmt.Printf("-----------------------------\n") @@ -896,7 +897,7 @@ func removeConf(confPath string) { } } -// generateNetworkConfig generates a cni config with a random name +// generateNetworkConfig generates a CNI or Netavark config with a random name // it returns the network name and the filepath func generateNetworkConfig(p *PodmanTestIntegration) (string, string) { var ( @@ -1042,3 +1043,27 @@ func ncz(port int) bool { func createNetworkName(name string) string { return name + stringid.GenerateNonCryptoID()[:10] } + +var IPRegex = `(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}` + +// digShort execs into the given container and does a dig lookup with a timeout +// backoff. If it gets a response, it ensures that the output is in the correct +// format and iterates a string array for match +func digShort(container, lookupName string, matchNames []string, p *PodmanTestIntegration) string { + digInterval := time.Millisecond * 250 + for i := 0; i < 6; i++ { + time.Sleep(digInterval * time.Duration(i)) + dig := p.Podman([]string{"exec", container, "dig", "+short", lookupName}) + dig.WaitWithDefaultTimeout() + if dig.ExitCode() == 0 { + output := dig.OutputToString() + Expect(output).To(MatchRegexp(IPRegex)) + for _, name := range matchNames { + Expect(output).To(Equal(name)) + } + return output + } + } + Fail("dns is not responding") + return "" +} |