mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-17 23:57:49 +00:00
Merge pull request #82742 from whypro/flagparse
Move flag.Parse() from init() to TestMain()
This commit is contained in:
commit
895642f9c3
@ -69,7 +69,7 @@ func handleFlags() {
|
|||||||
flag.Parse()
|
flag.Parse()
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func TestMain(m *testing.M) {
|
||||||
// Register test flags, then parse flags.
|
// Register test flags, then parse flags.
|
||||||
handleFlags()
|
handleFlags()
|
||||||
|
|
||||||
@ -105,9 +105,6 @@ func init() {
|
|||||||
AssetNames: generated.AssetNames,
|
AssetNames: generated.AssetNames,
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
|
||||||
rand.Seed(time.Now().UnixNano())
|
rand.Seed(time.Now().UnixNano())
|
||||||
os.Exit(m.Run())
|
os.Exit(m.Run())
|
||||||
}
|
}
|
||||||
|
@ -45,11 +45,11 @@ func init() {
|
|||||||
// Set this to false to undo util/logs.go settings it to true. Prevents cadvisor log spam.
|
// Set this to false to undo util/logs.go settings it to true. Prevents cadvisor log spam.
|
||||||
// Remove this once util/logs.go stops setting the flag to true.
|
// Remove this once util/logs.go stops setting the flag to true.
|
||||||
flag.Set("logtostderr", "false")
|
flag.Set("logtostderr", "false")
|
||||||
flag.Parse()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Should we write an e2e test for this?
|
// TODO: Should we write an e2e test for this?
|
||||||
func main() {
|
func main() {
|
||||||
|
flag.Parse()
|
||||||
o := strings.Split(*checkFlag, ",")
|
o := strings.Split(*checkFlag, ",")
|
||||||
errs := check(o...)
|
errs := check(o...)
|
||||||
if len(errs) > 0 {
|
if len(errs) > 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user