From c2d5fb308ca99cd55e07cd2dd11644a1f1298e81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammed=20Efe=20=C3=87etin?= Date: Wed, 29 Jun 2022 22:48:16 +0300 Subject: [PATCH] fix tests --- prefork.go | 1 + prefork_test.go | 2 ++ start.go | 8 ++++---- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/prefork.go b/prefork.go index 965dd37642..f21c178d7a 100644 --- a/prefork.go +++ b/prefork.go @@ -97,6 +97,7 @@ func (app *App) prefork(addr string, tlsConfig *tls.Config, cfg StartConfig) (er cmd.Env = append(os.Environ(), fmt.Sprintf("%s=%s", envPreforkChildKey, envPreforkChildVal), ) + if err = cmd.Start(); err != nil { return fmt.Errorf("failed to start a child prefork process, error: %v", err) } diff --git a/prefork_test.go b/prefork_test.go index 29d6f3f495..c1e44a1519 100644 --- a/prefork_test.go +++ b/prefork_test.go @@ -65,6 +65,8 @@ func Test_App_Prefork_Master_Process(t *testing.T) { err := app.prefork("127.0.0.1:", nil, startConfigDefault()) utils.AssertEqual(t, false, err == nil) + + dummyChildCmd = "go" } func Test_App_Prefork_Child_Process_Never_Show_Startup_Message(t *testing.T) { diff --git a/start.go b/start.go index 7e652bc82e..fce7a34652 100644 --- a/start.go +++ b/start.go @@ -108,12 +108,12 @@ func startConfigDefault(config ...StartConfig) StartConfig { return cfg } -// Listen serves HTTP requests from the given addr. +// Start serves HTTP requests from the given addr. // You should enter custom StartConfig to customize startup. (TLS, mTLS, prefork...) // -// app.Listen(":8080") -// app.Listen("127.0.0.1:8080") -// app.Listen(":8080", StartConfig{EnablePrefork: true}) +// app.Start(":8080") +// app.Start("127.0.0.1:8080") +// app.Start(":8080", StartConfig{EnablePrefork: true}) func (app *App) Start(addr any, config ...StartConfig) error { cfg := startConfigDefault(config...)