mirror of
https://github.com/containers/podman.git
synced 2025-06-23 10:38:20 +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
|
// 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
|
// backoff. If it gets a response, it ensures that the output is in the correct
|
||||||
// format and iterates a string array for match
|
// 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
|
digInterval := time.Millisecond * 250
|
||||||
for i := 0; i < 6; i++ {
|
for i := 0; i < 6; i++ {
|
||||||
time.Sleep(digInterval * time.Duration(i))
|
time.Sleep(digInterval * time.Duration(i))
|
||||||
dig := p.Podman([]string{"exec", container, "dig", "+short", lookupName})
|
dig := p.Podman([]string{"exec", container, "dig", "+short", lookupName})
|
||||||
dig.WaitWithDefaultTimeout()
|
dig.WaitWithDefaultTimeout()
|
||||||
if dig.ExitCode() == 0 {
|
output := dig.OutputToString()
|
||||||
output := dig.OutputToString()
|
if dig.ExitCode() == 0 && output != "" {
|
||||||
Expect(output).To(MatchRegexp(IPRegex))
|
Expect(output).To(Equal(expectedIP))
|
||||||
for _, name := range matchNames {
|
|
||||||
Expect(output).To(Equal(name))
|
|
||||||
}
|
|
||||||
// success
|
// success
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ var _ = Describe("Podman run networking", func() {
|
|||||||
cip := ctrIP.OutputToString()
|
cip := ctrIP.OutputToString()
|
||||||
Expect(cip).To(MatchRegexp(IPRegex))
|
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 := podmanTest.Podman([]string{"exec", cid, "dig", "+short", "-x", cip})
|
||||||
reverseLookup.WaitWithDefaultTimeout()
|
reverseLookup.WaitWithDefaultTimeout()
|
||||||
@ -94,9 +94,9 @@ var _ = Describe("Podman run networking", func() {
|
|||||||
cip2 := ctrIP2.OutputToString()
|
cip2 := ctrIP2.OutputToString()
|
||||||
Expect(cip2).To(MatchRegexp(IPRegex))
|
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 := podmanTest.Podman([]string{"exec", cid1, "dig", "+short", "-x", cip2})
|
||||||
reverseLookup12.WaitWithDefaultTimeout()
|
reverseLookup12.WaitWithDefaultTimeout()
|
||||||
@ -143,17 +143,17 @@ var _ = Describe("Podman run networking", func() {
|
|||||||
cip2 := ctrIP2.OutputToString()
|
cip2 := ctrIP2.OutputToString()
|
||||||
Expect(cip2).To(MatchRegexp(IPRegex))
|
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()
|
cipA2B22 := ctrIPA2B22.OutputToString()
|
||||||
Expect(cipA2B22).To(MatchRegexp(IPRegex))
|
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() {
|
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))
|
Expect(ctrIPCB2).Should(Exit(0))
|
||||||
cipCB2 := ctrIPCB2.OutputToString()
|
cipCB2 := ctrIPCB2.OutputToString()
|
||||||
|
|
||||||
digShort("aone", "testB2_nw", []string{cipCB2}, podmanTest)
|
digShort("aone", "testB2_nw", cipCB2, podmanTest)
|
||||||
|
|
||||||
digShort("cone", "testB1_nw", []string{cipAB1}, podmanTest)
|
|
||||||
|
|
||||||
|
digShort("cone", "testB1_nw", cipAB1, podmanTest)
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user