(t *testing.T)
| 85 | } |
| 86 | |
| 87 | func testRunBlocksAfterShutdown(t *testing.T) { |
| 88 | var endOfTest sync.WaitGroup |
| 89 | endOfTest.Add(1) |
| 90 | |
| 91 | // start routine that gets canceled by the shutdown |
| 92 | routineCtx := make(chan context.Context) |
| 93 | routine.Run(context.Background(), func(ctx context.Context) { |
| 94 | routineCtx <- ctx |
| 95 | endOfTest.Wait() |
| 96 | }) |
| 97 | |
| 98 | // kill this process |
| 99 | err := syscall.Kill(syscall.Getpid(), syscall.SIGINT) |
| 100 | require.NoError(t, err) |
| 101 | |
| 102 | // wait until the routine gets canceled because of the shutdown |
| 103 | <-(<-routineCtx).Done() |
| 104 | |
| 105 | // start routine |
| 106 | done := make(chan struct{}) |
| 107 | go func() { |
| 108 | waitForRun(context.Background(), nil) |
| 109 | done <- struct{}{} |
| 110 | }() |
| 111 | select { |
| 112 | case <-done: |
| 113 | t.Fatal("routine started after shutdown") |
| 114 | case <-time.After(10 * time.Millisecond): |
| 115 | // good |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | func TestRun_cancelsContextsOnSIGINT(t *testing.T) { |
| 120 | t.Skip("test not working properly in docker, skipping") |
nothing calls this directly
no test coverage detected
searching dependent graphs…