mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-05 14:57:49 +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) {
|
||||
runTestCommands(t, timeout, cli, []expect.Batcher{
|
||||
&expect.BSnd{S: "sleep 5 && tailscale status\n"},
|
||||
&expect.BExp{R: `100.64.0.1`},
|
||||
&expect.BExp{R: `(\#)`},
|
||||
})
|
||||
dur := 100 * time.Millisecond
|
||||
var outp []byte
|
||||
var err error
|
||||
|
||||
// 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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user