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
97a2b766
Unverified
Commit
97a2b766
authored
Jul 25, 2017
by
Clayton Coleman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add e2e test for kubectl exec via kubectl proxy
parent
0daee3ad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
4 deletions
+27
-4
kubectl.go
test/e2e/kubectl/kubectl.go
+27
-4
No files found.
test/e2e/kubectl/kubectl.go
View file @
97a2b766
...
@@ -437,9 +437,6 @@ var _ = SIGDescribe("Kubectl client", func() {
...
@@ -437,9 +437,6 @@ var _ = SIGDescribe("Kubectl client", func() {
})
})
It
(
"should support exec through an HTTP proxy"
,
func
()
{
It
(
"should support exec through an HTTP proxy"
,
func
()
{
// Note: We are skipping local since we want to verify an apiserver with HTTPS.
// At this time local only supports plain HTTP.
framework
.
SkipIfProviderIs
(
"local"
)
// Fail if the variable isn't set
// Fail if the variable isn't set
if
framework
.
TestContext
.
Host
==
""
{
if
framework
.
TestContext
.
Host
==
""
{
framework
.
Failf
(
"--host variable must be set to the full URI to the api server on e2e run."
)
framework
.
Failf
(
"--host variable must be set to the full URI to the api server on e2e run."
)
...
@@ -473,6 +470,32 @@ var _ = SIGDescribe("Kubectl client", func() {
...
@@ -473,6 +470,32 @@ var _ = SIGDescribe("Kubectl client", func() {
}
}
})
})
It
(
"should support exec through kubectl proxy"
,
func
()
{
// Fail if the variable isn't set
if
framework
.
TestContext
.
Host
==
""
{
framework
.
Failf
(
"--host variable must be set to the full URI to the api server on e2e run."
)
}
By
(
"Starting kubectl proxy"
)
port
,
proxyCmd
,
err
:=
startProxyServer
()
framework
.
ExpectNoError
(
err
)
defer
framework
.
TryKill
(
proxyCmd
)
//proxyLogs.Reset()
host
:=
fmt
.
Sprintf
(
"--server=http://127.0.0.1:%d"
,
port
)
By
(
"Running kubectl via kubectl proxy using "
+
host
)
output
:=
framework
.
NewKubectlCommand
(
host
,
fmt
.
Sprintf
(
"--namespace=%s"
,
ns
),
"exec"
,
"nginx"
,
"echo"
,
"running"
,
"in"
,
"container"
,
)
.
ExecOrDie
()
// Verify we got the normal output captured by the exec server
expectedExecOutput
:=
"running in container
\n
"
if
output
!=
expectedExecOutput
{
framework
.
Failf
(
"Unexpected kubectl exec output. Wanted %q, got %q"
,
expectedExecOutput
,
output
)
}
})
It
(
"should return command exit codes"
,
func
()
{
It
(
"should return command exit codes"
,
func
()
{
framework
.
SkipUnlessKubectlVersionGTE
(
kubectlContainerExitCodeVersion
)
framework
.
SkipUnlessKubectlVersionGTE
(
kubectlContainerExitCodeVersion
)
nsFlag
:=
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
)
nsFlag
:=
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
)
...
@@ -1758,7 +1781,7 @@ func getAPIVersions(apiEndpoint string) (*metav1.APIVersions, error) {
...
@@ -1758,7 +1781,7 @@ func getAPIVersions(apiEndpoint string) (*metav1.APIVersions, error) {
func
startProxyServer
()
(
int
,
*
exec
.
Cmd
,
error
)
{
func
startProxyServer
()
(
int
,
*
exec
.
Cmd
,
error
)
{
// Specifying port 0 indicates we want the os to pick a random port.
// Specifying port 0 indicates we want the os to pick a random port.
cmd
:=
framework
.
KubectlCmd
(
"proxy"
,
"-p"
,
"0"
)
cmd
:=
framework
.
KubectlCmd
(
"proxy"
,
"-p"
,
"0"
,
"--disable-filter"
)
stdout
,
stderr
,
err
:=
framework
.
StartCmdAndStreamOutput
(
cmd
)
stdout
,
stderr
,
err
:=
framework
.
StartCmdAndStreamOutput
(
cmd
)
if
err
!=
nil
{
if
err
!=
nil
{
return
-
1
,
nil
,
err
return
-
1
,
nil
,
err
...
...
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