mirror of
https://github.com/CPunch/gopenfusion.git
synced 2025-11-25 00:10:22 +00:00
fix: os.Exit() kills any deferred cleanup functions
os.Exit() itself is now also a deferred function, which will be the last to run.
This commit is contained in:
@@ -18,6 +18,11 @@ var (
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
ret := 1
|
||||
defer func() {
|
||||
os.Exit(ret)
|
||||
}()
|
||||
|
||||
ctx := context.Background()
|
||||
psql, err := sqltestutil.StartPostgresContainer(ctx, "15")
|
||||
if err != nil {
|
||||
@@ -35,7 +40,7 @@ func TestMain(m *testing.M) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
os.Exit(m.Run())
|
||||
ret = m.Run()
|
||||
}
|
||||
|
||||
func TestDBAccount(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user