Skip to content

Commit

Permalink
controller-runtime currently adds the --kubeconfig flag if
Browse files Browse the repository at this point in the history
pkg/client/config is imported (set up in an init() function).
The SDK's test framework also adds this flag, which will panic
if both are imported and the test framework is initialized.
This commit creates a new flag.FlagSet for the test framework
instead of using the global one.

pkg/test: use local flag.FlagSet instead of flag.CommandLine
  • Loading branch information
estroz committed Mar 27, 2020
1 parent b0b67a4 commit e718209
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/test/main_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ import (

func MainEntry(m *testing.M) {
fopts := &frameworkOpts{}
fopts.addToFlagSet(flag.CommandLine)
flag.Parse()
fs := flag.NewFlagSet(os.Args[0], flag.ExitOnError)
fopts.addToFlagSet(fs)

fs.Parse(os.Args[1:])

f, err := newFramework(fopts)
if err != nil {
Expand Down

0 comments on commit e718209

Please sign in to comment.