(t *testing.T)
| 10 | ) |
| 11 | |
| 12 | func TestScaleARegularThreadUpAndDown(t *testing.T) { |
| 13 | t.Cleanup(Shutdown) |
| 14 | |
| 15 | assert.NoError(t, Init( |
| 16 | WithNumThreads(1), |
| 17 | WithMaxThreads(2), |
| 18 | )) |
| 19 | |
| 20 | autoScaledThread := phpThreads[1] |
| 21 | |
| 22 | // scale up |
| 23 | scaleRegularThread(mainThread.done, mainThread.state) |
| 24 | assert.Equal(t, state.Ready, autoScaledThread.state.Get()) |
| 25 | assert.IsType(t, ®ularThread{}, autoScaledThread.handler) |
| 26 | |
| 27 | // on down-scale, the thread will be marked as inactive |
| 28 | setLongWaitTime(t, autoScaledThread) |
| 29 | deactivateThreads() |
| 30 | assert.IsType(t, &inactiveThread{}, autoScaledThread.handler) |
| 31 | } |
| 32 | |
| 33 | func TestScaleAWorkerThreadUpAndDown(t *testing.T) { |
| 34 | t.Cleanup(Shutdown) |
nothing calls this directly
no test coverage detected