Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
96747928
Commit
96747928
authored
Mar 07, 2018
by
Benjamin Elder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
translate hack/e2e.go -v to --verbose-commands
parent
07c04c2a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
6 deletions
+18
-6
e2e.go
hack/e2e.go
+3
-1
e2e_test.go
hack/e2e_test.go
+15
-5
No files found.
hack/e2e.go
View file @
96747928
...
...
@@ -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
}
...
...
hack/e2e_test.go
View file @
96747928
...
...
@@ -63,13 +63,23 @@ func TestParse(t *testing.T) {
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
{
"--ve
rbose-commands=true"
,
"--ve
nus"
,
"--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
,
},
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment