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
5f1a0bc8
Commit
5f1a0bc8
authored
Apr 14, 2015
by
Daniel Smith
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6705 from quinton-hoole/2015-04-03-flakey-rc-e2e
Add an e2e test that pods get a host IP
parents
037407f4
4a20101a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
1 deletion
+50
-1
pods.go
test/e2e/pods.go
+50
-0
util.go
test/e2e/util.go
+0
-1
No files found.
test/e2e/pods.go
View file @
5f1a0bc8
...
@@ -80,6 +80,40 @@ func runLivenessTest(c *client.Client, podDescr *api.Pod) {
...
@@ -80,6 +80,40 @@ func runLivenessTest(c *client.Client, podDescr *api.Pod) {
}
}
}
}
// testHostIP tests that a pod gets a host IP
func
testHostIP
(
c
*
client
.
Client
,
pod
*
api
.
Pod
)
{
ns
:=
"e2e-test-"
+
string
(
util
.
NewUUID
())
podClient
:=
c
.
Pods
(
ns
)
By
(
"creating pod"
)
defer
podClient
.
Delete
(
pod
.
Name
)
_
,
err
:=
podClient
.
Create
(
pod
)
if
err
!=
nil
{
Fail
(
fmt
.
Sprintf
(
"Failed to create pod: %v"
,
err
))
}
By
(
"ensuring that pod is running and has a hostIP"
)
// Wait for the pods to enter the running state. Waiting loops until the pods
// are running so non-running pods cause a timeout for this test.
err
=
waitForPodRunningInNamespace
(
c
,
pod
.
Name
,
ns
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
// Try to make sure we get a hostIP for each pod.
hostIPTimeout
:=
2
*
time
.
Minute
t
:=
time
.
Now
()
for
{
p
,
err
:=
podClient
.
Get
(
pod
.
Name
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
if
p
.
Status
.
HostIP
!=
""
{
Logf
(
"Pod %s has hostIP: %s"
,
p
.
Name
,
p
.
Status
.
HostIP
)
break
}
if
time
.
Since
(
t
)
>=
hostIPTimeout
{
Failf
(
"Gave up waiting for hostIP of pod %s after %v seconds"
,
p
.
Name
,
time
.
Since
(
t
)
.
Seconds
())
}
Logf
(
"Retrying to get the hostIP of pod %s"
,
p
.
Name
)
time
.
Sleep
(
5
*
time
.
Second
)
}
}
var
_
=
Describe
(
"Pods"
,
func
()
{
var
_
=
Describe
(
"Pods"
,
func
()
{
var
c
*
client
.
Client
var
c
*
client
.
Client
...
@@ -89,6 +123,22 @@ var _ = Describe("Pods", func() {
...
@@ -89,6 +123,22 @@ var _ = Describe("Pods", func() {
expectNoError
(
err
)
expectNoError
(
err
)
})
})
It
(
"should get a host IP"
,
func
()
{
name
:=
"pod-hostip-"
+
string
(
util
.
NewUUID
())
testHostIP
(
c
,
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
name
,
},
Spec
:
api
.
PodSpec
{
Containers
:
[]
api
.
Container
{
{
Name
:
"test"
,
Image
:
"gcr.io/google_containers/pause"
,
},
},
},
})
})
It
(
"should be submitted and removed"
,
func
()
{
It
(
"should be submitted and removed"
,
func
()
{
podClient
:=
c
.
Pods
(
api
.
NamespaceDefault
)
podClient
:=
c
.
Pods
(
api
.
NamespaceDefault
)
...
...
test/e2e/util.go
View file @
5f1a0bc8
...
@@ -117,7 +117,6 @@ func waitForPodSuccessInNamespace(c *client.Client, podName string, contName str
...
@@ -117,7 +117,6 @@ func waitForPodSuccessInNamespace(c *client.Client, podName string, contName str
}
else
{
}
else
{
return
true
,
fmt
.
Errorf
(
"pod %s terminated with failure: %+v"
,
podName
,
ci
.
State
.
Termination
)
return
true
,
fmt
.
Errorf
(
"pod %s terminated with failure: %+v"
,
podName
,
ci
.
State
.
Termination
)
}
}
Logf
(
"Waiting for pod %q in namespace %s status to be success or failure"
,
podName
,
namespace
)
}
else
{
}
else
{
Logf
(
"Nil State.Termination for container %s in pod %s in namespace %s so far"
,
contName
,
podName
,
namespace
)
Logf
(
"Nil State.Termination for container %s in pod %s in namespace %s so far"
,
contName
,
podName
,
namespace
)
}
}
...
...
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