mirror of https://github.com/gofiber/fiber.git
🩹 Fix prefork test
parent
d2fd400781
commit
7fc4b37dfb
|
@ -1423,7 +1423,6 @@ func (t *testTemplateEngine) Load() error {
|
|||
|
||||
// go test -run Test_Ctx_Render_Engine
|
||||
func Test_Ctx_Render_Engine(t *testing.T) {
|
||||
t.Parallel()
|
||||
engine := &testTemplateEngine{}
|
||||
engine.Load()
|
||||
app := New()
|
||||
|
|
|
@ -21,7 +21,7 @@ const (
|
|||
|
||||
var (
|
||||
testPreforkMaster = false
|
||||
dummyChildCmd = "date"
|
||||
dummyChildCmd = "go version"
|
||||
)
|
||||
|
||||
// IsChild determines if the current process is a result of Prefork
|
||||
|
@ -89,7 +89,11 @@ func (app *App) prefork(addr string, tlsconfig ...*tls.Config) (err error) {
|
|||
// When test prefork master,
|
||||
// just start the child process
|
||||
// a cmd on all os is best
|
||||
cmd = exec.Command(dummyChildCmd)
|
||||
if runtime.GOOS == "windows" {
|
||||
cmd = exec.Command("cmd", "/C", dummyChildCmd)
|
||||
} else {
|
||||
cmd = exec.Command(dummyChildCmd)
|
||||
}
|
||||
}
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
|
|
|
@ -13,6 +13,7 @@ func Test_App_Prefork_Child_Process(t *testing.T) {
|
|||
defer os.Setenv(envPreforkChildKey, "")
|
||||
|
||||
app := New()
|
||||
app.Settings.DisableStartupMessage = true
|
||||
app.init()
|
||||
|
||||
err := app.prefork("invalid")
|
||||
|
@ -30,6 +31,7 @@ func Test_App_Prefork_Main_Process(t *testing.T) {
|
|||
testPreforkMaster = true
|
||||
|
||||
app := New()
|
||||
app.Settings.DisableStartupMessage = true
|
||||
app.init()
|
||||
|
||||
go func() {
|
||||
|
|
Loading…
Reference in New Issue