mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #60895 from BenTheElder/translate-verbose-kubetest
Automatic merge from submit-queue (batch tested with PRs 60710, 60855, 60873, 60895, 60862). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. translate hack/e2e.go -v to --verbose-commands **What this PR does / why we need it**: translates the old `go run hack/e2e.go` `-v` flag to `--verbose-commands` for kubetest. kubetest now imports client-go, which imports `glog`, which registers an incompatible `-v level` flag so kubetest now uses `--verbose-commands` instead. This should fix existing workflows. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: See also: https://github.com/kubernetes/community/pull/1901 **Release note**: ```release-note NONE ```
This commit is contained in:
commit
17839216d8
@ -46,6 +46,7 @@ func parse(args []string) (flags, error) {
|
||||
fs := flag.NewFlagSet(args[0], flag.ContinueOnError)
|
||||
get := fs.Bool("get", getDefault, "go get -u kubetest if old or not installed")
|
||||
old := fs.Duration("old", oldDefault, "Consider kubetest old if it exceeds this")
|
||||
verbose := fs.Bool("v", true, "this flag is translated to kubetest's --verbose-commands")
|
||||
var a []string
|
||||
if err := fs.Parse(args[1:]); err == flag.ErrHelp {
|
||||
os.Stderr.WriteString(" -- kubetestArgs\n")
|
||||
@ -58,7 +59,8 @@ func parse(args []string) (flags, error) {
|
||||
log.Print(" The -- flag separator also suppresses this message")
|
||||
a = args[len(args)-fs.NArg()-1:]
|
||||
} else {
|
||||
a = fs.Args()
|
||||
a = append(a, fmt.Sprintf("--verbose-commands=%t", *verbose))
|
||||
a = append(a, fs.Args()...)
|
||||
}
|
||||
return flags{*get, *old, a}, nil
|
||||
}
|
||||
|
@ -62,14 +62,24 @@ func TestParse(t *testing.T) {
|
||||
expected flags
|
||||
err error
|
||||
}{
|
||||
{
|
||||
[]string{"foo", "-v=false"},
|
||||
flags{getDefault, oldDefault, []string{"--verbose-commands=false"}},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
[]string{"foo", "-v"},
|
||||
flags{getDefault, oldDefault, []string{"--verbose-commands=true"}},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
[]string{"hello", "world"},
|
||||
flags{getDefault, oldDefault, []string{"world"}},
|
||||
flags{getDefault, oldDefault, []string{"--verbose-commands=true", "world"}},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
[]string{"hello", "--", "--venus", "--karaoke"},
|
||||
flags{getDefault, oldDefault, []string{"--venus", "--karaoke"}},
|
||||
flags{getDefault, oldDefault, []string{"--verbose-commands=true", "--venus", "--karaoke"}},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
@ -84,12 +94,12 @@ func TestParse(t *testing.T) {
|
||||
},
|
||||
{
|
||||
[]string{"omg", "--get=false", "--", "ugh"},
|
||||
flags{false, oldDefault, []string{"ugh"}},
|
||||
flags{false, oldDefault, []string{"--verbose-commands=true", "ugh"}},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
[]string{"wee", "--old=5m", "--get"},
|
||||
flags{true, 5 * time.Minute, []string{}},
|
||||
flags{true, 5 * time.Minute, []string{"--verbose-commands=true"}},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
@ -104,7 +114,7 @@ func TestParse(t *testing.T) {
|
||||
},
|
||||
{
|
||||
[]string{"wut", "--", "-h"},
|
||||
flags{getDefault, oldDefault, []string{"-h"}},
|
||||
flags{getDefault, oldDefault, []string{"--verbose-commands=true", "-h"}},
|
||||
nil,
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user