Unverified Commit 17839216 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

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 ```
parents 95d1fb7c 96747928
...@@ -46,6 +46,7 @@ func parse(args []string) (flags, error) { ...@@ -46,6 +46,7 @@ func parse(args []string) (flags, error) {
fs := flag.NewFlagSet(args[0], flag.ContinueOnError) fs := flag.NewFlagSet(args[0], flag.ContinueOnError)
get := fs.Bool("get", getDefault, "go get -u kubetest if old or not installed") 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") 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 var a []string
if err := fs.Parse(args[1:]); err == flag.ErrHelp { if err := fs.Parse(args[1:]); err == flag.ErrHelp {
os.Stderr.WriteString(" -- kubetestArgs\n") os.Stderr.WriteString(" -- kubetestArgs\n")
...@@ -58,7 +59,8 @@ func parse(args []string) (flags, error) { ...@@ -58,7 +59,8 @@ func parse(args []string) (flags, error) {
log.Print(" The -- flag separator also suppresses this message") log.Print(" The -- flag separator also suppresses this message")
a = args[len(args)-fs.NArg()-1:] a = args[len(args)-fs.NArg()-1:]
} else { } else {
a = fs.Args() a = append(a, fmt.Sprintf("--verbose-commands=%t", *verbose))
a = append(a, fs.Args()...)
} }
return flags{*get, *old, a}, nil return flags{*get, *old, a}, nil
} }
......
...@@ -63,13 +63,23 @@ func TestParse(t *testing.T) { ...@@ -63,13 +63,23 @@ func TestParse(t *testing.T) {
err error 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"}, []string{"hello", "world"},
flags{getDefault, oldDefault, []string{"world"}}, flags{getDefault, oldDefault, []string{"--verbose-commands=true", "world"}},
nil, nil,
}, },
{ {
[]string{"hello", "--", "--venus", "--karaoke"}, []string{"hello", "--", "--venus", "--karaoke"},
flags{getDefault, oldDefault, []string{"--venus", "--karaoke"}}, flags{getDefault, oldDefault, []string{"--verbose-commands=true", "--venus", "--karaoke"}},
nil, nil,
}, },
{ {
...@@ -84,12 +94,12 @@ func TestParse(t *testing.T) { ...@@ -84,12 +94,12 @@ func TestParse(t *testing.T) {
}, },
{ {
[]string{"omg", "--get=false", "--", "ugh"}, []string{"omg", "--get=false", "--", "ugh"},
flags{false, oldDefault, []string{"ugh"}}, flags{false, oldDefault, []string{"--verbose-commands=true", "ugh"}},
nil, nil,
}, },
{ {
[]string{"wee", "--old=5m", "--get"}, []string{"wee", "--old=5m", "--get"},
flags{true, 5 * time.Minute, []string{}}, flags{true, 5 * time.Minute, []string{"--verbose-commands=true"}},
nil, nil,
}, },
{ {
...@@ -104,7 +114,7 @@ func TestParse(t *testing.T) { ...@@ -104,7 +114,7 @@ func TestParse(t *testing.T) {
}, },
{ {
[]string{"wut", "--", "-h"}, []string{"wut", "--", "-h"},
flags{getDefault, oldDefault, []string{"-h"}}, flags{getDefault, oldDefault, []string{"--verbose-commands=true", "-h"}},
nil, nil,
}, },
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment