(t *testing.T)
| 10 | ) |
| 11 | |
| 12 | func TestExecQueue(t *testing.T) { |
| 13 | ctx := context.Background() |
| 14 | var n atomic.Int32 |
| 15 | q := &ExecQueue{} |
| 16 | defer q.Shutdown() |
| 17 | q.Add(func() { n.Add(1) }) |
| 18 | q.Wait(ctx) |
| 19 | if got := n.Load(); got != 1 { |
| 20 | t.Errorf("n=%d; want 1", got) |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | // Test that RunSync doesn't hold q.mu and block Shutdown |
| 25 | // as we saw in tailscale/tailscale#18502 |