Merge pull request #3744 from crosbymichael/test-flags

Move flag.Parse in tests to TestMain
This commit is contained in:
Phil Estes 2019-10-11 14:13:10 -04:00 committed by GitHub
commit 6af355f3c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,7 +54,6 @@ func init() {
flag.StringVar(&address, "address", defaultAddress, "The address to the containerd socket for use in the tests")
flag.BoolVar(&noDaemon, "no-daemon", false, "Do not start a dedicated daemon for the tests")
flag.BoolVar(&noCriu, "no-criu", false, "Do not run the checkpoint tests")
flag.Parse()
}
func testContext(t testing.TB) (context.Context, context.CancelFunc) {
@ -67,6 +66,7 @@ func testContext(t testing.TB) (context.Context, context.CancelFunc) {
}
func TestMain(m *testing.M) {
flag.Parse()
if testing.Short() {
os.Exit(m.Run())
}