🩹 Fix prefork test

pull/614/head
Fenny 2020-07-15 15:10:59 +02:00
parent d2fd400781
commit 7fc4b37dfb
3 changed files with 8 additions and 3 deletions

View File

@ -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()

View File

@ -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,8 +89,12 @@ 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
if runtime.GOOS == "windows" {
cmd = exec.Command("cmd", "/C", dummyChildCmd)
} else {
cmd = exec.Command(dummyChildCmd)
}
}
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

View File

@ -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() {