mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-07 08:07:42 +00:00
tstest/integration/vms: deflake the tailscale_status test (#2427)
This test used to try to run this only once, but this variant of the test attempts to run `tailscale status` up to 6 times in a loop with exponential backoff. This fixes the flakiness found in previous instances of this test. Signed-off-by: Christine Dodrill <xe@tailscale.com>
This commit is contained in:
parent
b67a3007d5
commit
09e81b8ba1
@ -449,11 +449,32 @@ func (h Harness) testDistro(t *testing.T, d Distro, ipm ipMapping) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("tailscale status", func(t *testing.T) {
|
t.Run("tailscale status", func(t *testing.T) {
|
||||||
runTestCommands(t, timeout, cli, []expect.Batcher{
|
dur := 100 * time.Millisecond
|
||||||
&expect.BSnd{S: "sleep 5 && tailscale status\n"},
|
var outp []byte
|
||||||
&expect.BExp{R: `100.64.0.1`},
|
var err error
|
||||||
&expect.BExp{R: `(\#)`},
|
|
||||||
})
|
// NOTE(Xe): retry `tailscale status` a few times until it works. When tailscaled
|
||||||
|
// starts with testcontrol sometimes there can be up to a few seconds where
|
||||||
|
// tailscaled is in an unknown state on these virtual machines. This exponential
|
||||||
|
// delay loop should delay long enough for tailscaled to be ready.
|
||||||
|
for count := 0; count < 10; count++ {
|
||||||
|
sess := getSession(t, cli)
|
||||||
|
|
||||||
|
outp, err = sess.CombinedOutput("tailscale status")
|
||||||
|
if err == nil {
|
||||||
|
if !strings.Contains(string(outp), "100.64.0.1") {
|
||||||
|
t.Log(string(outp))
|
||||||
|
t.Fatal("can't find tester IP")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
time.Sleep(dur)
|
||||||
|
dur = dur * 2
|
||||||
|
}
|
||||||
|
|
||||||
|
t.Log(string(outp))
|
||||||
|
t.Fatalf("error: %v", err)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("dump routes", func(t *testing.T) {
|
t.Run("dump routes", func(t *testing.T) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user