Skip to content

Commit

Permalink
Fix TestMain cleanup issue scroll-tech#1542
Browse files Browse the repository at this point in the history
  • Loading branch information
Favour Chidera Okoli authored and Favour Chidera Okoli committed Oct 17, 2024
1 parent 41ce22b commit 3d40526
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions rollup/tests/bridge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,16 @@ func setupDB(t *testing.T) *gorm.DB {
}

func TestMain(m *testing.M) {
defer func() {
if testApps != nil {
testApps.Free()
}
if rollupApp != nil {
rollupApp.Free()
}
}()
m.Run()
code := m.Run() // Run tests and capture exit code before defer
defer func() {
if testApps != nil {
testApps.Free()
}
if rollupApp != nil {
rollupApp.Free()
}
}()
os.Exit(code) // Ensure proper exit with the test code
}

func setupEnv(t *testing.T) {
Expand Down

0 comments on commit 3d40526

Please sign in to comment.