Allow defers to run in `TestMain` in federation API tests
@@ -55,6 +55,7 @@ var servers = map[string]*server{
func TestMain(m *testing.M) {
// Set up the server key API for each "server" that we
// will use in our tests.
+ os.Exit(func() int {
for _, s := range servers {
// Generate a new key.
_, testPriv, err := ed25519.GenerateKey(nil)
@@ -108,7 +109,8 @@ func TestMain(m *testing.M) {
// Now that we have built our server key APIs, start the
// rest of the tests.
- os.Exit(m.Run())
+ return m.Run()
+ }())
}
type MockRoundTripper struct{}
