Skip to content

Commit b732a79

Browse files
committed
testing: make it so caddytest launches an instance of caddy per server
1 parent c2ccf86 commit b732a79

24 files changed

+1068
-878
lines changed

caddy.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"encoding/hex"
2121
"encoding/json"
2222
"errors"
23+
"flag"
2324
"fmt"
2425
"io"
2526
"io/fs"
@@ -778,7 +779,10 @@ func exitProcess(ctx context.Context, logger *zap.Logger) {
778779
} else {
779780
logger.Error("unclean shutdown")
780781
}
781-
os.Exit(exitCode)
782+
// check if we are in test environment, and dont call exit if we are
783+
if flag.Lookup("test.v") == nil && !strings.Contains(os.Args[0], ".test") {
784+
os.Exit(exitCode)
785+
}
782786
}()
783787

784788
if remoteAdminServer != nil {

0 commit comments

Comments
 (0)