MCPcopy Index your code
hub / github.com/php/frankenphp / TestScaleARegularThreadUpAndDown

Function TestScaleARegularThreadUpAndDown

scaling_test.go:12–31  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func 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, &regularThread{}, 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
33func TestScaleAWorkerThreadUpAndDown(t *testing.T) {
34 t.Cleanup(Shutdown)

Callers

nothing calls this directly

Calls 7

InitFunction · 0.85
WithNumThreadsFunction · 0.85
WithMaxThreadsFunction · 0.85
scaleRegularThreadFunction · 0.85
setLongWaitTimeFunction · 0.85
deactivateThreadsFunction · 0.85
GetMethod · 0.80

Tested by

no test coverage detected