mirror of
https://github.com/lukaszraczylo/traefikoidc.git
synced 2026-10-16 04:29:15 +00:00
Weekend fun with further optimisations.
This commit is contained in:
+16
-2
@@ -1,16 +1,30 @@
|
||||
package traefikoidc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
// Run tests
|
||||
code := m.Run()
|
||||
|
||||
// Global cleanup after all tests
|
||||
globalCleanup.CleanupAll()
|
||||
// Global cleanup after all tests with timeout
|
||||
done := make(chan struct{})
|
||||
go func() {
|
||||
globalCleanup.CleanupAll()
|
||||
close(done)
|
||||
}()
|
||||
|
||||
select {
|
||||
case <-done:
|
||||
// Cleanup completed
|
||||
case <-time.After(10 * time.Second):
|
||||
// Cleanup timed out
|
||||
fmt.Fprintf(os.Stderr, "WARNING: Global cleanup timed out after 10 seconds\n")
|
||||
}
|
||||
|
||||
os.Exit(code)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user