Skip to content

Commit d5b7bf5

Browse files
committed
Move flag.Parse in tests to TestMain
This this fixes issues with custom and testing flags in Go 1.3 and should work in previous go versions. Signed-off-by: Michael Crosby <[email protected]>
1 parent 38937f0 commit d5b7bf5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ func init() {
5454
flag.StringVar(&address, "address", defaultAddress, "The address to the containerd socket for use in the tests")
5555
flag.BoolVar(&noDaemon, "no-daemon", false, "Do not start a dedicated daemon for the tests")
5656
flag.BoolVar(&noCriu, "no-criu", false, "Do not run the checkpoint tests")
57-
flag.Parse()
5857
}
5958

6059
func testContext(t testing.TB) (context.Context, context.CancelFunc) {
@@ -67,6 +66,7 @@ func testContext(t testing.TB) (context.Context, context.CancelFunc) {
6766
}
6867

6968
func TestMain(m *testing.M) {
69+
flag.Parse()
7070
if testing.Short() {
7171
os.Exit(m.Run())
7272
}

0 commit comments

Comments
 (0)