mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
clientv3: use CheckAfterTest after terminating cluster
AfterTest() has a delay that waits for runtime goroutines to exit; CheckLeakedGoroutine does not. Since the test runner manages the test cluster for examples, there is no delay between terminating the cluster and checking for leaked goroutines. Instead, apply Aftertest checking before running CheckLeakedGoroutine to let runtime http goroutines finish.
This commit is contained in:
parent
eb6a47f87e
commit
593489d454
@ -15,10 +15,12 @@
|
||||
package clientv3_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/coreos/etcd/auth"
|
||||
"github.com/coreos/etcd/integration"
|
||||
@ -50,6 +52,10 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
v = m.Run()
|
||||
clus.Terminate(nil)
|
||||
if err := testutil.CheckAfterTest(time.Second); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
} else {
|
||||
v = m.Run()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user