waitLogLine looks for want in the contents of b. Only lines starting with 'boot: ' (the output of containerboot itself) are considered, and the logged timestamp is ignored. waitLogLine fails the entire test if path doesn't contain want before the timeout.
(t *testing.T, timeout time.Duration, b *lockingBuffer, want string)
| 1413 | // waitLogLine fails the entire test if path doesn't contain want |
| 1414 | // before the timeout. |
| 1415 | func waitLogLine(t *testing.T, timeout time.Duration, b *lockingBuffer, want string) { |
| 1416 | deadline := time.Now().Add(timeout) |
| 1417 | for time.Now().Before(deadline) { |
| 1418 | for line := range strings.SplitSeq(b.String(), "\n") { |
| 1419 | if !strings.HasPrefix(line, "boot: ") { |
| 1420 | continue |
| 1421 | } |
| 1422 | if strings.HasSuffix(line, " "+want) { |
| 1423 | return |
| 1424 | } |
| 1425 | } |
| 1426 | time.Sleep(100 * time.Millisecond) |
| 1427 | } |
| 1428 | t.Fatalf("timed out waiting for wanted output line %q. Output:\n%s", want, b.String()) |
| 1429 | } |
| 1430 | |
| 1431 | // waitArgs waits until the contents of path matches wantArgs, a set |
| 1432 | // of command lines recorded by test_tailscale.sh and |