tGo runs fn in a goroutine and waits until fn has completed before test completion. Done is returned for optionally waiting for fn to exit. NOTE(mafredri): This could be moved to a helper library.
(t *testing.T, fn func())
| 2478 | // |
| 2479 | // NOTE(mafredri): This could be moved to a helper library. |
| 2480 | func tGo(t *testing.T, fn func()) (done <-chan struct{}) { |
| 2481 | t.Helper() |
| 2482 | |
| 2483 | doneC := make(chan struct{}) |
| 2484 | t.Cleanup(func() { |
| 2485 | <-doneC |
| 2486 | }) |
| 2487 | go func() { |
| 2488 | fn() |
| 2489 | close(doneC) |
| 2490 | }() |
| 2491 | |
| 2492 | return doneC |
| 2493 | } |
| 2494 | |
| 2495 | func TestSSH_Completion(t *testing.T) { |
| 2496 | t.Parallel() |
no test coverage detected