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
5766776c
Commit
5766776c
authored
Sep 15, 2016
by
Saad Ali
Committed by
GitHub
Sep 15, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #32806 from janetkuo/revert-30701
Revert "Add test for --quiet flag for kubectl run"
parents
0877816e
e39b7777
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
56 deletions
+29
-56
util.go
test/e2e/framework/util.go
+15
-20
kubectl.go
test/e2e/kubectl.go
+14
-36
No files found.
test/e2e/framework/util.go
View file @
5766776c
...
@@ -2169,18 +2169,20 @@ func (b kubectlBuilder) WithStdinReader(reader io.Reader) *kubectlBuilder {
...
@@ -2169,18 +2169,20 @@ func (b kubectlBuilder) WithStdinReader(reader io.Reader) *kubectlBuilder {
return
&
b
return
&
b
}
}
func
(
b
kubectlBuilder
)
ExecOrDie
()
(
string
,
string
)
{
func
(
b
kubectlBuilder
)
ExecOrDie
()
string
{
stdout
,
stderr
,
err
:=
b
.
Exec
()
str
,
err
:=
b
.
Exec
()
Logf
(
"stdout: %q"
,
str
)
// In case of i/o timeout error, try talking to the apiserver again after 2s before dying.
// In case of i/o timeout error, try talking to the apiserver again after 2s before dying.
// Note that we're still dying after retrying so that we can get visibility to triage it further.
// Note that we're still dying after retrying so that we can get visibility to triage it further.
if
isTimeout
(
err
)
{
if
isTimeout
(
err
)
{
Logf
(
"Hit i/o timeout error, talking to the server 2s later to see if it's temporary."
)
Logf
(
"Hit i/o timeout error, talking to the server 2s later to see if it's temporary."
)
time
.
Sleep
(
2
*
time
.
Second
)
time
.
Sleep
(
2
*
time
.
Second
)
_
,
retryErr
:=
RunKubectl
(
"version"
)
retryStr
,
retryErr
:=
RunKubectl
(
"version"
)
Logf
(
"stdout: %q"
,
retryStr
)
Logf
(
"err: %v"
,
retryErr
)
Logf
(
"err: %v"
,
retryErr
)
}
}
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
return
st
dout
,
stder
r
return
str
}
}
func
isTimeout
(
err
error
)
bool
{
func
isTimeout
(
err
error
)
bool
{
...
@@ -2197,14 +2199,14 @@ func isTimeout(err error) bool {
...
@@ -2197,14 +2199,14 @@ func isTimeout(err error) bool {
return
false
return
false
}
}
func
(
b
kubectlBuilder
)
Exec
()
(
string
,
string
,
error
)
{
func
(
b
kubectlBuilder
)
Exec
()
(
string
,
error
)
{
var
stdout
,
stderr
bytes
.
Buffer
var
stdout
,
stderr
bytes
.
Buffer
cmd
:=
b
.
cmd
cmd
:=
b
.
cmd
cmd
.
Stdout
,
cmd
.
Stderr
=
&
stdout
,
&
stderr
cmd
.
Stdout
,
cmd
.
Stderr
=
&
stdout
,
&
stderr
Logf
(
"Running '%s %s'"
,
cmd
.
Path
,
strings
.
Join
(
cmd
.
Args
[
1
:
],
" "
))
// skip arg[0] as it is printed separately
Logf
(
"Running '%s %s'"
,
cmd
.
Path
,
strings
.
Join
(
cmd
.
Args
[
1
:
],
" "
))
// skip arg[0] as it is printed separately
if
err
:=
cmd
.
Start
();
err
!=
nil
{
if
err
:=
cmd
.
Start
();
err
!=
nil
{
return
""
,
""
,
fmt
.
Errorf
(
"error starting %v:
\n
Command stdout:
\n
%v
\n
stderr:
\n
%v
\n
error:
\n
%v
\n
"
,
cmd
,
cmd
.
Stdout
,
cmd
.
Stderr
,
err
)
return
""
,
fmt
.
Errorf
(
"error starting %v:
\n
Command stdout:
\n
%v
\n
stderr:
\n
%v
\n
error:
\n
%v
\n
"
,
cmd
,
cmd
.
Stdout
,
cmd
.
Stderr
,
err
)
}
}
errCh
:=
make
(
chan
error
,
1
)
errCh
:=
make
(
chan
error
,
1
)
go
func
()
{
go
func
()
{
...
@@ -2218,39 +2220,32 @@ func (b kubectlBuilder) Exec() (string, string, error) {
...
@@ -2218,39 +2220,32 @@ func (b kubectlBuilder) Exec() (string, string, error) {
Logf
(
"rc: %d"
,
rc
)
Logf
(
"rc: %d"
,
rc
)
rc
=
int
(
ee
.
Sys
()
.
(
syscall
.
WaitStatus
)
.
ExitStatus
())
rc
=
int
(
ee
.
Sys
()
.
(
syscall
.
WaitStatus
)
.
ExitStatus
())
}
}
return
""
,
""
,
uexec
.
CodeExitError
{
return
""
,
uexec
.
CodeExitError
{
Err
:
fmt
.
Errorf
(
"error running %v:
\n
Command stdout:
\n
%v
\n
stderr:
\n
%v
\n
error:
\n
%v
\n
"
,
cmd
,
cmd
.
Stdout
,
cmd
.
Stderr
,
err
),
Err
:
fmt
.
Errorf
(
"error running %v:
\n
Command stdout:
\n
%v
\n
stderr:
\n
%v
\n
error:
\n
%v
\n
"
,
cmd
,
cmd
.
Stdout
,
cmd
.
Stderr
,
err
),
Code
:
rc
,
Code
:
rc
,
}
}
}
}
case
<-
b
.
timeout
:
case
<-
b
.
timeout
:
b
.
cmd
.
Process
.
Kill
()
b
.
cmd
.
Process
.
Kill
()
return
""
,
""
,
fmt
.
Errorf
(
"timed out waiting for command %v:
\n
Command stdout:
\n
%v
\n
stderr:
\n
%v
\n
"
,
cmd
,
cmd
.
Stdout
,
cmd
.
Stderr
)
return
""
,
fmt
.
Errorf
(
"timed out waiting for command %v:
\n
Command stdout:
\n
%v
\n
stderr:
\n
%v
\n
"
,
cmd
,
cmd
.
Stdout
,
cmd
.
Stderr
)
}
}
Logf
(
"stderr: %q"
,
stderr
.
String
())
stderrString
:=
stderr
.
String
()
return
stdout
.
String
(),
nil
stdoutString
:=
stdout
.
String
()
Logf
(
"stderr: %q"
,
stderrString
)
Logf
(
"stdout: %q"
,
stdoutString
)
return
stdoutString
,
stderrString
,
nil
}
}
// RunKubectlOrDie is a convenience wrapper over kubectlBuilder
// RunKubectlOrDie is a convenience wrapper over kubectlBuilder
func
RunKubectlOrDie
(
args
...
string
)
string
{
func
RunKubectlOrDie
(
args
...
string
)
string
{
stdout
,
_
:=
NewKubectlCommand
(
args
...
)
.
ExecOrDie
()
return
NewKubectlCommand
(
args
...
)
.
ExecOrDie
()
return
stdout
}
}
// RunKubectl is a convenience wrapper over kubectlBuilder
// RunKubectl is a convenience wrapper over kubectlBuilder
func
RunKubectl
(
args
...
string
)
(
string
,
error
)
{
func
RunKubectl
(
args
...
string
)
(
string
,
error
)
{
stdout
,
_
,
err
:=
NewKubectlCommand
(
args
...
)
.
Exec
()
return
NewKubectlCommand
(
args
...
)
.
Exec
()
return
stdout
,
err
}
}
// RunKubectlOrDieInput is a convenience wrapper over kubectlBuilder that takes input to stdin
// RunKubectlOrDieInput is a convenience wrapper over kubectlBuilder that takes input to stdin
func
RunKubectlOrDieInput
(
data
string
,
args
...
string
)
string
{
func
RunKubectlOrDieInput
(
data
string
,
args
...
string
)
string
{
stdout
,
_
:=
NewKubectlCommand
(
args
...
)
.
WithStdinData
(
data
)
.
ExecOrDie
()
return
NewKubectlCommand
(
args
...
)
.
WithStdinData
(
data
)
.
ExecOrDie
()
return
stdout
}
}
func
StartCmdAndStreamOutput
(
cmd
*
exec
.
Cmd
)
(
stdout
,
stderr
io
.
ReadCloser
,
err
error
)
{
func
StartCmdAndStreamOutput
(
cmd
*
exec
.
Cmd
)
(
stdout
,
stderr
io
.
ReadCloser
,
err
error
)
{
...
...
test/e2e/kubectl.go
View file @
5766776c
...
@@ -297,7 +297,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
...
@@ -297,7 +297,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
}
}
By
(
"executing a command in the container with noninteractive stdin"
)
By
(
"executing a command in the container with noninteractive stdin"
)
execOutput
,
_
=
framework
.
NewKubectlCommand
(
"exec"
,
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
),
"-i"
,
simplePodName
,
"cat"
)
.
execOutput
=
framework
.
NewKubectlCommand
(
"exec"
,
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
),
"-i"
,
simplePodName
,
"cat"
)
.
WithStdinData
(
"abcd1234"
)
.
WithStdinData
(
"abcd1234"
)
.
ExecOrDie
()
ExecOrDie
()
if
e
,
a
:=
"abcd1234"
,
execOutput
;
e
!=
a
{
if
e
,
a
:=
"abcd1234"
,
execOutput
;
e
!=
a
{
...
@@ -313,7 +313,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
...
@@ -313,7 +313,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
defer
closer
.
Close
()
defer
closer
.
Close
()
By
(
"executing a command in the container with pseudo-interactive stdin"
)
By
(
"executing a command in the container with pseudo-interactive stdin"
)
execOutput
,
_
=
framework
.
NewKubectlCommand
(
"exec"
,
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
),
"-i"
,
simplePodName
,
"bash"
)
.
execOutput
=
framework
.
NewKubectlCommand
(
"exec"
,
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
),
"-i"
,
simplePodName
,
"bash"
)
.
WithStdinReader
(
r
)
.
WithStdinReader
(
r
)
.
ExecOrDie
()
ExecOrDie
()
if
e
,
a
:=
"hi"
,
strings
.
TrimSpace
(
execOutput
);
e
!=
a
{
if
e
,
a
:=
"hi"
,
strings
.
TrimSpace
(
execOutput
);
e
!=
a
{
...
@@ -338,7 +338,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
...
@@ -338,7 +338,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
for
_
,
proxyVar
:=
range
[]
string
{
"https_proxy"
,
"HTTPS_PROXY"
}
{
for
_
,
proxyVar
:=
range
[]
string
{
"https_proxy"
,
"HTTPS_PROXY"
}
{
proxyLogs
.
Reset
()
proxyLogs
.
Reset
()
By
(
"Running kubectl via an HTTP proxy using "
+
proxyVar
)
By
(
"Running kubectl via an HTTP proxy using "
+
proxyVar
)
output
,
_
:=
framework
.
NewKubectlCommand
(
fmt
.
Sprintf
(
"--namespace=%s"
,
ns
),
"exec"
,
"nginx"
,
"echo"
,
"running"
,
"in"
,
"container"
)
.
output
:=
framework
.
NewKubectlCommand
(
fmt
.
Sprintf
(
"--namespace=%s"
,
ns
),
"exec"
,
"nginx"
,
"echo"
,
"running"
,
"in"
,
"container"
)
.
WithEnv
(
append
(
os
.
Environ
(),
fmt
.
Sprintf
(
"%s=%s"
,
proxyVar
,
proxyAddr
)))
.
WithEnv
(
append
(
os
.
Environ
(),
fmt
.
Sprintf
(
"%s=%s"
,
proxyVar
,
proxyAddr
)))
.
ExecOrDie
()
ExecOrDie
()
...
@@ -363,40 +363,40 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
...
@@ -363,40 +363,40 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
nsFlag
:=
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
)
nsFlag
:=
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
)
By
(
"execing into a container with a successful command"
)
By
(
"execing into a container with a successful command"
)
_
,
_
,
err
:=
framework
.
NewKubectlCommand
(
nsFlag
,
"exec"
,
"nginx"
,
"--"
,
"/bin/sh"
,
"-c"
,
"exit 0"
)
.
Exec
()
_
,
err
:=
framework
.
NewKubectlCommand
(
nsFlag
,
"exec"
,
"nginx"
,
"--"
,
"/bin/sh"
,
"-c"
,
"exit 0"
)
.
Exec
()
ExpectNoError
(
err
)
ExpectNoError
(
err
)
By
(
"execing into a container with a failing command"
)
By
(
"execing into a container with a failing command"
)
_
,
_
,
err
=
framework
.
NewKubectlCommand
(
nsFlag
,
"exec"
,
"nginx"
,
"--"
,
"/bin/sh"
,
"-c"
,
"exit 42"
)
.
Exec
()
_
,
err
=
framework
.
NewKubectlCommand
(
nsFlag
,
"exec"
,
"nginx"
,
"--"
,
"/bin/sh"
,
"-c"
,
"exit 42"
)
.
Exec
()
ee
,
ok
:=
err
.
(
uexec
.
ExitError
)
ee
,
ok
:=
err
.
(
uexec
.
ExitError
)
Expect
(
ok
)
.
To
(
Equal
(
true
))
Expect
(
ok
)
.
To
(
Equal
(
true
))
Expect
(
ee
.
ExitStatus
())
.
To
(
Equal
(
42
))
Expect
(
ee
.
ExitStatus
())
.
To
(
Equal
(
42
))
By
(
"running a successful command"
)
By
(
"running a successful command"
)
_
,
_
,
err
=
framework
.
NewKubectlCommand
(
nsFlag
,
"run"
,
"-i"
,
"--image="
+
busyboxImage
,
"--restart=Never"
,
"success"
,
"--"
,
"/bin/sh"
,
"-c"
,
"exit 0"
)
.
Exec
()
_
,
err
=
framework
.
NewKubectlCommand
(
nsFlag
,
"run"
,
"-i"
,
"--image="
+
busyboxImage
,
"--restart=Never"
,
"success"
,
"--"
,
"/bin/sh"
,
"-c"
,
"exit 0"
)
.
Exec
()
ExpectNoError
(
err
)
ExpectNoError
(
err
)
By
(
"running a failing command"
)
By
(
"running a failing command"
)
_
,
_
,
err
=
framework
.
NewKubectlCommand
(
nsFlag
,
"run"
,
"-i"
,
"--image="
+
busyboxImage
,
"--restart=Never"
,
"failure-1"
,
"--"
,
"/bin/sh"
,
"-c"
,
"exit 42"
)
.
Exec
()
_
,
err
=
framework
.
NewKubectlCommand
(
nsFlag
,
"run"
,
"-i"
,
"--image="
+
busyboxImage
,
"--restart=Never"
,
"failure-1"
,
"--"
,
"/bin/sh"
,
"-c"
,
"exit 42"
)
.
Exec
()
ee
,
ok
=
err
.
(
uexec
.
ExitError
)
ee
,
ok
=
err
.
(
uexec
.
ExitError
)
Expect
(
ok
)
.
To
(
Equal
(
true
))
Expect
(
ok
)
.
To
(
Equal
(
true
))
Expect
(
ee
.
ExitStatus
())
.
To
(
Equal
(
42
))
Expect
(
ee
.
ExitStatus
())
.
To
(
Equal
(
42
))
By
(
"running a failing command without --restart=Never"
)
By
(
"running a failing command without --restart=Never"
)
_
,
_
,
err
=
framework
.
NewKubectlCommand
(
nsFlag
,
"run"
,
"-i"
,
"--image="
+
busyboxImage
,
"--restart=OnFailure"
,
"failure-2"
,
"--"
,
"/bin/sh"
,
"-c"
,
"cat && exit 42"
)
.
_
,
err
=
framework
.
NewKubectlCommand
(
nsFlag
,
"run"
,
"-i"
,
"--image="
+
busyboxImage
,
"--restart=OnFailure"
,
"failure-2"
,
"--"
,
"/bin/sh"
,
"-c"
,
"cat && exit 42"
)
.
WithStdinData
(
"abcd1234"
)
.
WithStdinData
(
"abcd1234"
)
.
Exec
()
Exec
()
ExpectNoError
(
err
)
ExpectNoError
(
err
)
By
(
"running a failing command without --restart=Never, but with --rm"
)
By
(
"running a failing command without --restart=Never, but with --rm"
)
_
,
_
,
err
=
framework
.
NewKubectlCommand
(
nsFlag
,
"run"
,
"-i"
,
"--image="
+
busyboxImage
,
"--restart=OnFailure"
,
"--rm"
,
"failure-3"
,
"--"
,
"/bin/sh"
,
"-c"
,
"cat && exit 42"
)
.
_
,
err
=
framework
.
NewKubectlCommand
(
nsFlag
,
"run"
,
"-i"
,
"--image="
+
busyboxImage
,
"--restart=OnFailure"
,
"--rm"
,
"failure-3"
,
"--"
,
"/bin/sh"
,
"-c"
,
"cat && exit 42"
)
.
WithStdinData
(
"abcd1234"
)
.
WithStdinData
(
"abcd1234"
)
.
Exec
()
Exec
()
ExpectNoError
(
err
)
ExpectNoError
(
err
)
framework
.
WaitForPodToDisappear
(
f
.
Client
,
ns
,
"failure-3"
,
labels
.
Everything
(),
2
*
time
.
Second
,
wait
.
ForeverTestTimeout
)
framework
.
WaitForPodToDisappear
(
f
.
Client
,
ns
,
"failure-3"
,
labels
.
Everything
(),
2
*
time
.
Second
,
wait
.
ForeverTestTimeout
)
By
(
"running a failing command with --leave-stdin-open"
)
By
(
"running a failing command with --leave-stdin-open"
)
_
,
_
,
err
=
framework
.
NewKubectlCommand
(
nsFlag
,
"run"
,
"-i"
,
"--image="
+
busyboxImage
,
"--restart=Never"
,
"failure-4"
,
"--leave-stdin-open"
,
"--"
,
"/bin/sh"
,
"-c"
,
"exit 42"
)
.
_
,
err
=
framework
.
NewKubectlCommand
(
nsFlag
,
"run"
,
"-i"
,
"--image="
+
busyboxImage
,
"--restart=Never"
,
"failure-4"
,
"--leave-stdin-open"
,
"--"
,
"/bin/sh"
,
"-c"
,
"exit 42"
)
.
WithStdinData
(
"abcd1234"
)
.
WithStdinData
(
"abcd1234"
)
.
Exec
()
Exec
()
ExpectNoError
(
err
)
ExpectNoError
(
err
)
...
@@ -409,7 +409,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
...
@@ -409,7 +409,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
nsFlag
:=
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
)
nsFlag
:=
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
)
By
(
"executing a command with run and attach with stdin"
)
By
(
"executing a command with run and attach with stdin"
)
runOutput
,
_
:=
framework
.
NewKubectlCommand
(
nsFlag
,
"run"
,
"run-test"
,
"--image="
+
busyboxImage
,
"--restart=OnFailure"
,
"--attach=true"
,
"--stdin"
,
"--"
,
"sh"
,
"-c"
,
"cat && echo 'stdin closed'"
)
.
runOutput
:=
framework
.
NewKubectlCommand
(
nsFlag
,
"run"
,
"run-test"
,
"--image="
+
busyboxImage
,
"--restart=OnFailure"
,
"--attach=true"
,
"--stdin"
,
"--"
,
"sh"
,
"-c"
,
"cat && echo 'stdin closed'"
)
.
WithStdinData
(
"abcd1234"
)
.
WithStdinData
(
"abcd1234"
)
.
ExecOrDie
()
ExecOrDie
()
Expect
(
runOutput
)
.
To
(
ContainSubstring
(
"abcd1234"
))
Expect
(
runOutput
)
.
To
(
ContainSubstring
(
"abcd1234"
))
...
@@ -417,7 +417,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
...
@@ -417,7 +417,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
Expect
(
c
.
Extensions
()
.
Jobs
(
ns
)
.
Delete
(
"run-test"
,
nil
))
.
To
(
BeNil
())
Expect
(
c
.
Extensions
()
.
Jobs
(
ns
)
.
Delete
(
"run-test"
,
nil
))
.
To
(
BeNil
())
By
(
"executing a command with run and attach without stdin"
)
By
(
"executing a command with run and attach without stdin"
)
runOutput
,
_
=
framework
.
NewKubectlCommand
(
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
),
"run"
,
"run-test-2"
,
"--image="
+
busyboxImage
,
"--restart=OnFailure"
,
"--attach=true"
,
"--leave-stdin-open=true"
,
"--"
,
"sh"
,
"-c"
,
"cat && echo 'stdin closed'"
)
.
runOutput
=
framework
.
NewKubectlCommand
(
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
),
"run"
,
"run-test-2"
,
"--image="
+
busyboxImage
,
"--restart=OnFailure"
,
"--attach=true"
,
"--leave-stdin-open=true"
,
"--"
,
"sh"
,
"-c"
,
"cat && echo 'stdin closed'"
)
.
WithStdinData
(
"abcd1234"
)
.
WithStdinData
(
"abcd1234"
)
.
ExecOrDie
()
ExecOrDie
()
Expect
(
runOutput
)
.
ToNot
(
ContainSubstring
(
"abcd1234"
))
Expect
(
runOutput
)
.
ToNot
(
ContainSubstring
(
"abcd1234"
))
...
@@ -425,7 +425,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
...
@@ -425,7 +425,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
Expect
(
c
.
Extensions
()
.
Jobs
(
ns
)
.
Delete
(
"run-test-2"
,
nil
))
.
To
(
BeNil
())
Expect
(
c
.
Extensions
()
.
Jobs
(
ns
)
.
Delete
(
"run-test-2"
,
nil
))
.
To
(
BeNil
())
By
(
"executing a command with run and attach with stdin with open stdin should remain running"
)
By
(
"executing a command with run and attach with stdin with open stdin should remain running"
)
runOutput
,
_
=
framework
.
NewKubectlCommand
(
nsFlag
,
"run"
,
"run-test-3"
,
"--image="
+
busyboxImage
,
"--restart=OnFailure"
,
"--attach=true"
,
"--leave-stdin-open=true"
,
"--stdin"
,
"--"
,
"sh"
,
"-c"
,
"cat && echo 'stdin closed'"
)
.
runOutput
=
framework
.
NewKubectlCommand
(
nsFlag
,
"run"
,
"run-test-3"
,
"--image="
+
busyboxImage
,
"--restart=OnFailure"
,
"--attach=true"
,
"--leave-stdin-open=true"
,
"--stdin"
,
"--"
,
"sh"
,
"-c"
,
"cat && echo 'stdin closed'"
)
.
WithStdinData
(
"abcd1234
\n
"
)
.
WithStdinData
(
"abcd1234
\n
"
)
.
ExecOrDie
()
ExecOrDie
()
Expect
(
runOutput
)
.
ToNot
(
ContainSubstring
(
"stdin closed"
))
Expect
(
runOutput
)
.
ToNot
(
ContainSubstring
(
"stdin closed"
))
...
@@ -1175,7 +1175,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
...
@@ -1175,7 +1175,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
By
(
"executing a command with run --rm and attach with stdin"
)
By
(
"executing a command with run --rm and attach with stdin"
)
t
:=
time
.
NewTimer
(
runJobTimeout
)
t
:=
time
.
NewTimer
(
runJobTimeout
)
defer
t
.
Stop
()
defer
t
.
Stop
()
runOutput
,
_
:=
framework
.
NewKubectlCommand
(
nsFlag
,
"run"
,
jobName
,
"--image="
+
busyboxImage
,
"--rm=true"
,
"--generator=job/v1"
,
"--restart=OnFailure"
,
"--attach=true"
,
"--stdin"
,
"--"
,
"sh"
,
"-c"
,
"cat && echo 'stdin closed'"
)
.
runOutput
:=
framework
.
NewKubectlCommand
(
nsFlag
,
"run"
,
jobName
,
"--image="
+
busyboxImage
,
"--rm=true"
,
"--generator=job/v1"
,
"--restart=OnFailure"
,
"--attach=true"
,
"--stdin"
,
"--"
,
"sh"
,
"-c"
,
"cat && echo 'stdin closed'"
)
.
WithStdinData
(
"abcd1234"
)
.
WithStdinData
(
"abcd1234"
)
.
WithTimeout
(
t
.
C
)
.
WithTimeout
(
t
.
C
)
.
ExecOrDie
()
ExecOrDie
()
...
@@ -1189,28 +1189,6 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
...
@@ -1189,28 +1189,6 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
})
})
})
})
framework
.
KubeDescribe
(
"Kubectl run --quiet job"
,
func
()
{
jobName
:=
"e2e-test-quiet-busybox-job"
It
(
"should not output anything except the command when --quiet is set"
,
func
()
{
nsFlag
:=
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
)
// The rkt runtime doesn't support attach, see #23335
framework
.
SkipIfContainerRuntimeIs
(
"rkt"
)
framework
.
SkipUnlessServerVersionGTE
(
jobsVersion
,
c
)
By
(
"executing a command with run --rm and attach with stdin"
)
t
:=
time
.
NewTimer
(
runJobTimeout
)
defer
t
.
Stop
()
// TODO: remove sleep when attach works immediately
stdout
,
stderr
:=
framework
.
NewKubectlCommand
(
nsFlag
,
"run"
,
jobName
,
"--image="
+
busyboxImage
,
"--quiet"
,
"--rm"
,
"--restart=Never"
,
"--stdin"
,
"--attach"
,
"--generator=job/v1"
,
"--"
,
"sh"
,
"-c"
,
"sleep 3; echo output; sleep 3"
)
.
WithTimeout
(
t
.
C
)
.
ExecOrDie
()
Expect
(
stdout
)
.
To
(
Equal
(
"output
\n
"
),
"Checking STDOUT contains only our output"
)
Expect
(
stderr
)
.
To
(
Equal
(
""
),
"Checking STDERR is empty"
)
})
})
framework
.
KubeDescribe
(
"Proxy server"
,
func
()
{
framework
.
KubeDescribe
(
"Proxy server"
,
func
()
{
// TODO: test proxy options (static, prefix, etc)
// TODO: test proxy options (static, prefix, etc)
It
(
"should support proxy with --port 0 [Conformance]"
,
func
()
{
It
(
"should support proxy with --port 0 [Conformance]"
,
func
()
{
...
...
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