(t *testing.T)
| 54 | } |
| 55 | |
| 56 | func Test_App_Prefork_Master_Process(t *testing.T) { |
| 57 | enableTestPreforkMaster(t) |
| 58 | |
| 59 | app := New() |
| 60 | |
| 61 | // With dummy commands that exit immediately, fasthttp recovers children |
| 62 | // until RecoverThreshold is exceeded, then returns ErrOverRecovery. |
| 63 | // Use low threshold for fast test execution. |
| 64 | cfg := listenConfigDefault() |
| 65 | cfg.PreforkRecoverThreshold = 1 |
| 66 | cfg.PreforkRecoverInterval = 10 * time.Millisecond |
| 67 | cfg.PreforkShutdownGracePeriod = 100 * time.Millisecond |
| 68 | err := app.prefork(":0", nil, &cfg) |
| 69 | require.ErrorIs(t, err, prefork.ErrOverRecovery) |
| 70 | |
| 71 | // With invalid command, should get a start error immediately |
| 72 | // (error happens during initial spawning, before recovery loop) |
| 73 | dummyChildCmd.Store("invalid") |
| 74 | |
| 75 | cfg = listenConfigDefault() |
| 76 | cfg.PreforkRecoverThreshold = 1 |
| 77 | err = app.prefork("127.0.0.1:", nil, &cfg) |
| 78 | require.Error(t, err) |
| 79 | |
| 80 | dummyChildCmd.Store("go") |
| 81 | } |
| 82 | |
| 83 | func Test_App_Prefork_Child_Process_Never_Show_Startup_Message(t *testing.T) { |
| 84 | setupIsChild(t) |
nothing calls this directly
no test coverage detected