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
89cd3f9b
Commit
89cd3f9b
authored
Sep 30, 2016
by
ymqytw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a gke-only e2e test for kubectl in a Pod
parent
e6b2517f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
3 deletions
+52
-3
kubectl.go
test/e2e/kubectl.go
+25
-3
kubectl-in-pod.json
test/e2e/testing-manifests/kubectl/kubectl-in-pod.json
+26
-0
test_owners.csv
test/test_owners.csv
+1
-0
No files found.
test/e2e/kubectl.go
View file @
89cd3f9b
...
@@ -90,6 +90,7 @@ const (
...
@@ -90,6 +90,7 @@ const (
kubeCtlManifestPath
=
"test/e2e/testing-manifests/kubectl"
kubeCtlManifestPath
=
"test/e2e/testing-manifests/kubectl"
redisControllerFilename
=
"redis-master-controller.json"
redisControllerFilename
=
"redis-master-controller.json"
redisServiceFilename
=
"redis-master-service.json"
redisServiceFilename
=
"redis-master-service.json"
kubectlInPodFilename
=
"kubectl-in-pod.json"
)
)
var
(
var
(
...
@@ -500,9 +501,6 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
...
@@ -500,9 +501,6 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
Expect
(
logOutput
)
.
ToNot
(
ContainSubstring
(
"stdin closed"
))
Expect
(
logOutput
)
.
ToNot
(
ContainSubstring
(
"stdin closed"
))
return
strings
.
Contains
(
logOutput
,
"abcd1234"
),
nil
return
strings
.
Contains
(
logOutput
,
"abcd1234"
),
nil
})
})
if
err
!=
nil
{
os
.
Exit
(
1
)
}
Expect
(
err
)
.
To
(
BeNil
())
Expect
(
err
)
.
To
(
BeNil
())
Expect
(
c
.
Batch
()
.
Jobs
(
ns
)
.
Delete
(
"run-test-3"
,
nil
))
.
To
(
BeNil
())
Expect
(
c
.
Batch
()
.
Jobs
(
ns
)
.
Delete
(
"run-test-3"
,
nil
))
.
To
(
BeNil
())
...
@@ -526,6 +524,30 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
...
@@ -526,6 +524,30 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
})
})
})
})
framework
.
KubeDescribe
(
"Kubectl should be able to talk to api server"
,
func
()
{
It
(
"kubectl running in a pod could talk to api server [Conformance]"
,
func
()
{
framework
.
SkipUnlessProviderIs
(
"gke"
)
nsFlag
:=
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
)
podJson
:=
readTestFileOrDie
(
kubectlInPodFilename
)
By
(
"validating api verions"
)
framework
.
RunKubectlOrDieInput
(
string
(
podJson
),
"create"
,
"-f"
,
"-"
,
nsFlag
)
err
:=
wait
.
PollImmediate
(
time
.
Second
,
time
.
Minute
,
func
()
(
bool
,
error
)
{
output
:=
framework
.
RunKubectlOrDie
(
"get"
,
"pods/kubectl-in-pod"
,
nsFlag
)
if
strings
.
Contains
(
output
,
"Running"
)
{
return
true
,
nil
}
else
{
return
false
,
nil
}
})
Expect
(
err
)
.
To
(
BeNil
())
output
:=
framework
.
RunKubectlOrDie
(
"exec"
,
"kubectl-in-pod"
,
nsFlag
,
"--"
,
"kubectl"
,
"version"
)
if
!
strings
.
Contains
(
output
,
"Server Version"
)
{
framework
.
Failf
(
"kubectl in the pod fails to talk to api server"
)
}
framework
.
RunKubectlOrDie
(
"delete"
,
"pods"
,
"kubectl-in-pod"
,
nsFlag
)
})
})
framework
.
KubeDescribe
(
"Kubectl api-versions"
,
func
()
{
framework
.
KubeDescribe
(
"Kubectl api-versions"
,
func
()
{
It
(
"should check if v1 is in available api versions [Conformance]"
,
func
()
{
It
(
"should check if v1 is in available api versions [Conformance]"
,
func
()
{
By
(
"validating api verions"
)
By
(
"validating api verions"
)
...
...
test/e2e/testing-manifests/kubectl/kubectl-in-pod.json
0 → 100644
View file @
89cd3f9b
{
"apiVersion"
:
"v1"
,
"kind"
:
"Pod"
,
"metadata"
:
{
"name"
:
"kubectl-in-pod"
},
"spec"
:
{
"containers"
:
[
{
"name"
:
"busybox"
,
"image"
:
"busybox"
,
"stdin"
:
true
,
"stdinOnce"
:
true
,
"tty"
:
true
,
"volumeMounts"
:
[{
"mountPath"
:
"/usr/bin/kubectl"
,
"name"
:
"kubectl"
}]
}
],
"volumes"
:
[{
"name"
:
"kubectl"
,
"hostPath"
:{
"path"
:
"/usr/bin/kubectl"
}
}]
}
}
test/test_owners.csv
View file @
89cd3f9b
...
@@ -202,6 +202,7 @@ Kubectl client Kubectl run deployment should create a deployment from an image,j
...
@@ -202,6 +202,7 @@ Kubectl client Kubectl run deployment should create a deployment from an image,j
Kubectl client Kubectl run job should create a job from an image when restart is OnFailure,soltysh,0
Kubectl client Kubectl run job should create a job from an image when restart is OnFailure,soltysh,0
Kubectl client Kubectl run pod should create a pod from an image when restart is Never,janetkuo,0
Kubectl client Kubectl run pod should create a pod from an image when restart is Never,janetkuo,0
Kubectl client Kubectl run rc should create an rc from an image,janetkuo,0
Kubectl client Kubectl run rc should create an rc from an image,janetkuo,0
Kubectl client Kubectl should be able to talk to api server kubectl running in a pod could talk to api server,ymqytw,0
Kubectl client Kubectl taint should remove all the taints with the same key off a node,erictune,1
Kubectl client Kubectl taint should remove all the taints with the same key off a node,erictune,1
Kubectl client Kubectl taint should update the taint on a node,pwittrock,0
Kubectl client Kubectl taint should update the taint on a node,pwittrock,0
Kubectl client Kubectl version should check is all data is printed,janetkuo,0
Kubectl client Kubectl version should check is all data is printed,janetkuo,0
...
...
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