Test executes the passed tests in the given order (array order). The tests are executed in the configured interval until the given context is done.
(ctx context.Context, tests []TestFunc)
| 18 | // The tests are executed in the configured interval until the given |
| 19 | // context is done. |
| 20 | func Test(ctx context.Context, tests []TestFunc) error { |
| 21 | t := time.NewTicker(cfg.Interval) |
| 22 | |
| 23 | // run test at least once |
| 24 | testRun(ctx, tests) |
| 25 | |
| 26 | for { |
| 27 | select { |
| 28 | case <-ctx.Done(): |
| 29 | return ctx.Err() |
| 30 | case <-t.C: |
| 31 | testRun(ctx, tests) |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | func testRun(ctx context.Context, tests []TestFunc) { |
| 37 | var err error |
no test coverage detected
searching dependent graphs…