mirror of
https://github.com/containers/podman.git
synced 2025-06-23 18:59:30 +08:00
Merge pull request #14822 from Luap99/dns-test
fix flake in aardvark tests
This commit is contained in:
@ -1042,18 +1042,15 @@ var IPRegex = `(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01
|
||||
// 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) {
|
||||
func digShort(container, lookupName, expectedIP string, p *PodmanTestIntegration) {
|
||||
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))
|
||||
}
|
||||
if dig.ExitCode() == 0 && output != "" {
|
||||
Expect(output).To(Equal(expectedIP))
|
||||
// success
|
||||
return
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ var _ = Describe("Podman run networking", func() {
|
||||
cip := ctrIP.OutputToString()
|
||||
Expect(cip).To(MatchRegexp(IPRegex))
|
||||
|
||||
digShort(cid, "aone", []string{cip}, podmanTest)
|
||||
digShort(cid, "aone", cip, podmanTest)
|
||||
|
||||
reverseLookup := podmanTest.Podman([]string{"exec", cid, "dig", "+short", "-x", cip})
|
||||
reverseLookup.WaitWithDefaultTimeout()
|
||||
@ -94,9 +94,9 @@ var _ = Describe("Podman run networking", func() {
|
||||
cip2 := ctrIP2.OutputToString()
|
||||
Expect(cip2).To(MatchRegexp(IPRegex))
|
||||
|
||||
digShort("aone", "atwo", []string{cip2}, podmanTest)
|
||||
digShort("aone", "atwo", cip2, podmanTest)
|
||||
|
||||
digShort("atwo", "aone", []string{cip1}, podmanTest)
|
||||
digShort("atwo", "aone", cip1, podmanTest)
|
||||
|
||||
reverseLookup12 := podmanTest.Podman([]string{"exec", cid1, "dig", "+short", "-x", cip2})
|
||||
reverseLookup12.WaitWithDefaultTimeout()
|
||||
@ -143,17 +143,17 @@ var _ = Describe("Podman run networking", func() {
|
||||
cip2 := ctrIP2.OutputToString()
|
||||
Expect(cip2).To(MatchRegexp(IPRegex))
|
||||
|
||||
digShort("aone", "atwo", []string{cip2}, podmanTest)
|
||||
digShort("aone", "atwo", cip2, podmanTest)
|
||||
|
||||
digShort("aone", "alias_a2", []string{cip2}, podmanTest)
|
||||
digShort("aone", "alias_a2", cip2, podmanTest)
|
||||
|
||||
digShort("aone", "alias_2a", []string{cip2}, podmanTest)
|
||||
digShort("aone", "alias_2a", cip2, podmanTest)
|
||||
|
||||
digShort("atwo", "aone", []string{cip1}, podmanTest)
|
||||
digShort("atwo", "aone", cip1, podmanTest)
|
||||
|
||||
digShort("atwo", "alias_a1", []string{cip1}, podmanTest)
|
||||
digShort("atwo", "alias_a1", cip1, podmanTest)
|
||||
|
||||
digShort("atwo", "alias_1a", []string{cip1}, podmanTest)
|
||||
digShort("atwo", "alias_1a", cip1, podmanTest)
|
||||
|
||||
})
|
||||
|
||||
@ -250,13 +250,13 @@ var _ = Describe("Podman run networking", func() {
|
||||
cipA2B22 := ctrIPA2B22.OutputToString()
|
||||
Expect(cipA2B22).To(MatchRegexp(IPRegex))
|
||||
|
||||
digShort("aone", "atwobtwo", []string{cipA2B21}, podmanTest)
|
||||
digShort("aone", "atwobtwo", cipA2B21, podmanTest)
|
||||
|
||||
digShort("bone", "atwobtwo", []string{cipA2B22}, podmanTest)
|
||||
digShort("bone", "atwobtwo", cipA2B22, podmanTest)
|
||||
|
||||
digShort("atwobtwo", "aone", []string{cipA1}, podmanTest)
|
||||
digShort("atwobtwo", "aone", cipA1, podmanTest)
|
||||
|
||||
digShort("atwobtwo", "bone", []string{cipB1}, podmanTest)
|
||||
digShort("atwobtwo", "bone", cipB1, podmanTest)
|
||||
})
|
||||
|
||||
It("Aardvark Test 6: Three subnets, first container on 1/2 and second on 2/3, w/ network aliases", func() {
|
||||
@ -304,10 +304,9 @@ var _ = Describe("Podman run networking", func() {
|
||||
Expect(ctrIPCB2).Should(Exit(0))
|
||||
cipCB2 := ctrIPCB2.OutputToString()
|
||||
|
||||
digShort("aone", "testB2_nw", []string{cipCB2}, podmanTest)
|
||||
|
||||
digShort("cone", "testB1_nw", []string{cipAB1}, podmanTest)
|
||||
digShort("aone", "testB2_nw", cipCB2, podmanTest)
|
||||
|
||||
digShort("cone", "testB1_nw", cipAB1, podmanTest)
|
||||
})
|
||||
|
||||
})
|
||||
|
Reference in New Issue
Block a user