(t *testing.T)
| 131 | } |
| 132 | |
| 133 | func TestSimpleTaskExecutor_Shutdown(t *testing.T) { |
| 134 | executor := NewSimpleTaskExecutor(NewDefaultTaskRunner()) |
| 135 | |
| 136 | var counter int32 |
| 137 | |
| 138 | executor.ScheduleAtFixedRate(func(ctx context.Context) { |
| 139 | atomic.AddInt32(&counter, 1) |
| 140 | <-time.After(500 * time.Millisecond) |
| 141 | }, 1*time.Second, 200*time.Millisecond) |
| 142 | |
| 143 | <-time.After(2 * time.Second) |
| 144 | executor.Shutdown() |
| 145 | |
| 146 | expected := counter |
| 147 | <-time.After(3 * time.Second) |
| 148 | |
| 149 | assert.True(t, executor.IsShutdown()) |
| 150 | assert.Equal(t, expected, counter, |
| 151 | "after shutdown, previously scheduled tasks should not be rescheduled", counter) |
| 152 | } |
| 153 | |
| 154 | func TestSimpleTaskExecutor_NoNewTaskShouldBeAccepted_AfterShutdown(t *testing.T) { |
| 155 | executor := NewSimpleTaskExecutor(NewDefaultTaskRunner()) |
nothing calls this directly
no test coverage detected