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
1d04c53f
Commit
1d04c53f
authored
Nov 04, 2015
by
Phillip Wittrock
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16766 from saad-ali/fixPDTestLongTimeout
Increase pod timeout for PD tests
parents
78995530
45ba3ed4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
8 deletions
+29
-8
framework.go
test/e2e/framework.go
+6
-0
pd.go
test/e2e/pd.go
+7
-7
util.go
test/e2e/util.go
+16
-1
No files found.
test/e2e/framework.go
View file @
1d04c53f
...
@@ -136,6 +136,12 @@ func (f *Framework) WaitForPodRunning(podName string) error {
...
@@ -136,6 +136,12 @@ func (f *Framework) WaitForPodRunning(podName string) error {
return
waitForPodRunningInNamespace
(
f
.
Client
,
podName
,
f
.
Namespace
.
Name
)
return
waitForPodRunningInNamespace
(
f
.
Client
,
podName
,
f
.
Namespace
.
Name
)
}
}
// WaitForPodRunningSlow waits for the pod to run in the namespace.
// It has a longer timeout then WaitForPodRunning (util.slowPodStartTimeout).
func
(
f
*
Framework
)
WaitForPodRunningSlow
(
podName
string
)
error
{
return
waitForPodRunningInNamespaceSlow
(
f
.
Client
,
podName
,
f
.
Namespace
.
Name
)
}
// Runs the given pod and verifies that the output of exact container matches the desired output.
// Runs the given pod and verifies that the output of exact container matches the desired output.
func
(
f
*
Framework
)
TestContainerOutput
(
scenarioName
string
,
pod
*
api
.
Pod
,
containerIndex
int
,
expectedOutput
[]
string
)
{
func
(
f
*
Framework
)
TestContainerOutput
(
scenarioName
string
,
pod
*
api
.
Pod
,
containerIndex
int
,
expectedOutput
[]
string
)
{
testContainerOutput
(
scenarioName
,
f
.
Client
,
pod
,
containerIndex
,
expectedOutput
,
f
.
Namespace
.
Name
)
testContainerOutput
(
scenarioName
,
f
.
Client
,
pod
,
containerIndex
,
expectedOutput
,
f
.
Namespace
.
Name
)
...
...
test/e2e/pd.go
View file @
1d04c53f
...
@@ -91,7 +91,7 @@ var _ = Describe("Pod Disks", func() {
...
@@ -91,7 +91,7 @@ var _ = Describe("Pod Disks", func() {
_
,
err
=
podClient
.
Create
(
host0Pod
)
_
,
err
=
podClient
.
Create
(
host0Pod
)
expectNoError
(
err
,
fmt
.
Sprintf
(
"Failed to create host0Pod: %v"
,
err
))
expectNoError
(
err
,
fmt
.
Sprintf
(
"Failed to create host0Pod: %v"
,
err
))
expectNoError
(
framework
.
WaitForPodRunning
(
host0Pod
.
Name
))
expectNoError
(
framework
.
WaitForPodRunning
Slow
(
host0Pod
.
Name
))
testFile
:=
"/testpd1/tracker"
testFile
:=
"/testpd1/tracker"
testFileContents
:=
fmt
.
Sprintf
(
"%v"
,
mathrand
.
Int
())
testFileContents
:=
fmt
.
Sprintf
(
"%v"
,
mathrand
.
Int
())
...
@@ -106,7 +106,7 @@ var _ = Describe("Pod Disks", func() {
...
@@ -106,7 +106,7 @@ var _ = Describe("Pod Disks", func() {
_
,
err
=
podClient
.
Create
(
host1Pod
)
_
,
err
=
podClient
.
Create
(
host1Pod
)
expectNoError
(
err
,
"Failed to create host1Pod"
)
expectNoError
(
err
,
"Failed to create host1Pod"
)
expectNoError
(
framework
.
WaitForPodRunning
(
host1Pod
.
Name
))
expectNoError
(
framework
.
WaitForPodRunning
Slow
(
host1Pod
.
Name
))
v
,
err
:=
framework
.
ReadFileViaContainer
(
host1Pod
.
Name
,
containerName
,
testFile
)
v
,
err
:=
framework
.
ReadFileViaContainer
(
host1Pod
.
Name
,
containerName
,
testFile
)
expectNoError
(
err
)
expectNoError
(
err
)
...
@@ -150,7 +150,7 @@ var _ = Describe("Pod Disks", func() {
...
@@ -150,7 +150,7 @@ var _ = Describe("Pod Disks", func() {
By
(
"submitting rwPod to ensure PD is formatted"
)
By
(
"submitting rwPod to ensure PD is formatted"
)
_
,
err
=
podClient
.
Create
(
rwPod
)
_
,
err
=
podClient
.
Create
(
rwPod
)
expectNoError
(
err
,
"Failed to create rwPod"
)
expectNoError
(
err
,
"Failed to create rwPod"
)
expectNoError
(
framework
.
WaitForPodRunning
(
rwPod
.
Name
))
expectNoError
(
framework
.
WaitForPodRunning
Slow
(
rwPod
.
Name
))
expectNoError
(
podClient
.
Delete
(
rwPod
.
Name
,
api
.
NewDeleteOptions
(
0
)),
"Failed to delete host0Pod"
)
expectNoError
(
podClient
.
Delete
(
rwPod
.
Name
,
api
.
NewDeleteOptions
(
0
)),
"Failed to delete host0Pod"
)
expectNoError
(
waitForPDDetach
(
diskName
,
host0Name
))
expectNoError
(
waitForPDDetach
(
diskName
,
host0Name
))
...
@@ -162,9 +162,9 @@ var _ = Describe("Pod Disks", func() {
...
@@ -162,9 +162,9 @@ var _ = Describe("Pod Disks", func() {
_
,
err
=
podClient
.
Create
(
host1ROPod
)
_
,
err
=
podClient
.
Create
(
host1ROPod
)
expectNoError
(
err
,
"Failed to create host1ROPod"
)
expectNoError
(
err
,
"Failed to create host1ROPod"
)
expectNoError
(
framework
.
WaitForPodRunning
(
host0ROPod
.
Name
))
expectNoError
(
framework
.
WaitForPodRunning
Slow
(
host0ROPod
.
Name
))
expectNoError
(
framework
.
WaitForPodRunning
(
host1ROPod
.
Name
))
expectNoError
(
framework
.
WaitForPodRunning
Slow
(
host1ROPod
.
Name
))
By
(
"deleting host0ROPod"
)
By
(
"deleting host0ROPod"
)
expectNoError
(
podClient
.
Delete
(
host0ROPod
.
Name
,
api
.
NewDeleteOptions
(
0
)),
"Failed to delete host0ROPod"
)
expectNoError
(
podClient
.
Delete
(
host0ROPod
.
Name
,
api
.
NewDeleteOptions
(
0
)),
"Failed to delete host0ROPod"
)
...
@@ -204,7 +204,7 @@ var _ = Describe("Pod Disks", func() {
...
@@ -204,7 +204,7 @@ var _ = Describe("Pod Disks", func() {
_
,
err
=
podClient
.
Create
(
host0Pod
)
_
,
err
=
podClient
.
Create
(
host0Pod
)
expectNoError
(
err
,
fmt
.
Sprintf
(
"Failed to create host0Pod: %v"
,
err
))
expectNoError
(
err
,
fmt
.
Sprintf
(
"Failed to create host0Pod: %v"
,
err
))
expectNoError
(
framework
.
WaitForPodRunning
(
host0Pod
.
Name
))
expectNoError
(
framework
.
WaitForPodRunning
Slow
(
host0Pod
.
Name
))
// randomly select a container and read/verify pd contents from it
// randomly select a container and read/verify pd contents from it
containerName
:=
fmt
.
Sprintf
(
"mycontainer%v"
,
mathrand
.
Intn
(
numContainers
)
+
1
)
containerName
:=
fmt
.
Sprintf
(
"mycontainer%v"
,
mathrand
.
Intn
(
numContainers
)
+
1
)
...
@@ -263,7 +263,7 @@ var _ = Describe("Pod Disks", func() {
...
@@ -263,7 +263,7 @@ var _ = Describe("Pod Disks", func() {
_
,
err
=
podClient
.
Create
(
host0Pod
)
_
,
err
=
podClient
.
Create
(
host0Pod
)
expectNoError
(
err
,
fmt
.
Sprintf
(
"Failed to create host0Pod: %v"
,
err
))
expectNoError
(
err
,
fmt
.
Sprintf
(
"Failed to create host0Pod: %v"
,
err
))
expectNoError
(
framework
.
WaitForPodRunning
(
host0Pod
.
Name
))
expectNoError
(
framework
.
WaitForPodRunning
Slow
(
host0Pod
.
Name
))
// Read/verify pd contents for both disks from container
// Read/verify pd contents for both disks from container
verifyPDContentsViaContainer
(
framework
,
host0Pod
.
Name
,
containerName
,
fileAndContentToVerify
)
verifyPDContentsViaContainer
(
framework
,
host0Pod
.
Name
,
containerName
,
fileAndContentToVerify
)
...
...
test/e2e/util.go
View file @
1d04c53f
...
@@ -64,6 +64,9 @@ const (
...
@@ -64,6 +64,9 @@ const (
// TODO: Make this 30 seconds once #4566 is resolved.
// TODO: Make this 30 seconds once #4566 is resolved.
podStartTimeout
=
5
*
time
.
Minute
podStartTimeout
=
5
*
time
.
Minute
// Some pods can take much longer to get ready due to volume attach/detach latency.
slowPodStartTimeout
=
15
*
time
.
Minute
// How long to wait for a service endpoint to be resolvable.
// How long to wait for a service endpoint to be resolvable.
serviceStartTimeout
=
1
*
time
.
Minute
serviceStartTimeout
=
1
*
time
.
Minute
...
@@ -575,8 +578,20 @@ func deleteNS(c *client.Client, namespace string, timeout time.Duration) error {
...
@@ -575,8 +578,20 @@ func deleteNS(c *client.Client, namespace string, timeout time.Duration) error {
return
nil
return
nil
}
}
// Waits default ammount of time (podStartTimeout) for the specified pod to become running.
// Returns an error if timeout occurs first, or pod goes in to failed state.
func
waitForPodRunningInNamespace
(
c
*
client
.
Client
,
podName
string
,
namespace
string
)
error
{
func
waitForPodRunningInNamespace
(
c
*
client
.
Client
,
podName
string
,
namespace
string
)
error
{
return
waitForPodCondition
(
c
,
namespace
,
podName
,
"running"
,
podStartTimeout
,
func
(
pod
*
api
.
Pod
)
(
bool
,
error
)
{
return
waitTimeoutForPodRunningInNamespace
(
c
,
podName
,
namespace
,
podStartTimeout
)
}
// Waits an extended ammount of time (slowPodStartTimeout) for the specified pod to become running.
// Returns an error if timeout occurs first, or pod goes in to failed state.
func
waitForPodRunningInNamespaceSlow
(
c
*
client
.
Client
,
podName
string
,
namespace
string
)
error
{
return
waitTimeoutForPodRunningInNamespace
(
c
,
podName
,
namespace
,
slowPodStartTimeout
)
}
func
waitTimeoutForPodRunningInNamespace
(
c
*
client
.
Client
,
podName
string
,
namespace
string
,
timeout
time
.
Duration
)
error
{
return
waitForPodCondition
(
c
,
namespace
,
podName
,
"running"
,
timeout
,
func
(
pod
*
api
.
Pod
)
(
bool
,
error
)
{
if
pod
.
Status
.
Phase
==
api
.
PodRunning
{
if
pod
.
Status
.
Phase
==
api
.
PodRunning
{
Logf
(
"Found pod '%s' on node '%s'"
,
podName
,
pod
.
Spec
.
NodeName
)
Logf
(
"Found pod '%s' on node '%s'"
,
podName
,
pod
.
Spec
.
NodeName
)
return
true
,
nil
return
true
,
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