Skip to content

Commit

Permalink
Merge pull request containerd#10956 from sondavidb/backport-588b7a1
Browse files Browse the repository at this point in the history
[release/1.7 backport] testutil: avoid conflict with continuity/testutil
  • Loading branch information
dmcgowan authored Nov 12, 2024
2 parents 2bb3c23 + 4bd411f commit 4a8b079
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/testutil/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,17 @@ const umountflags int = 0
var rootEnabled bool

func init() {
flag.BoolVar(&rootEnabled, "test.root", false, "enable tests that require root")
if flag.Lookup("test.root") == nil {
flag.BoolVar(&rootEnabled, "test.root", false, "enable tests that require root")
} else {
// The flag is already registered by continuity/testutil
for _, f := range os.Args {
if f == "-test.root" || f == "-test.root=true" {
rootEnabled = true
break
}
}
}
}

// DumpDir prints the contents of the directory to the testing logger.
Expand Down

0 comments on commit 4a8b079

Please sign in to comment.