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
a4f614f2
Commit
a4f614f2
authored
Oct 31, 2016
by
shashidharatd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Jobs to k8s upgrade tests
parent
e3840da8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
8 deletions
+69
-8
cluster_upgrade.go
test/e2e/cluster_upgrade.go
+45
-0
job.go
test/e2e/job.go
+24
-8
No files found.
test/e2e/cluster_upgrade.go
View file @
a4f614f2
...
@@ -52,6 +52,7 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
...
@@ -52,6 +52,7 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
testConfigMapsDuringUpgrade
(
f
,
sem
)
testConfigMapsDuringUpgrade
(
f
,
sem
)
testGuestbookApplicationDuringUpgrade
(
f
,
sem
)
testGuestbookApplicationDuringUpgrade
(
f
,
sem
)
testDaemonSetDuringUpgrade
(
f
,
sem
)
testDaemonSetDuringUpgrade
(
f
,
sem
)
testJobsDuringUpgrade
(
f
,
sem
)
})
})
cm
.
Do
()
cm
.
Do
()
})
})
...
@@ -72,6 +73,7 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
...
@@ -72,6 +73,7 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
testConfigMapsBeforeAndAfterUpgrade
(
f
,
sem
)
testConfigMapsBeforeAndAfterUpgrade
(
f
,
sem
)
testGuestbookApplicationBeforeAndAfterUpgrade
(
f
,
sem
)
testGuestbookApplicationBeforeAndAfterUpgrade
(
f
,
sem
)
testDaemonSetBeforeAndAfterUpgrade
(
f
,
sem
)
testDaemonSetBeforeAndAfterUpgrade
(
f
,
sem
)
testJobsBeforeAndAfterUpgrade
(
f
,
sem
)
})
})
cm
.
Do
()
cm
.
Do
()
})
})
...
@@ -90,6 +92,7 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
...
@@ -90,6 +92,7 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
testConfigMapsDuringUpgrade
(
f
,
sem
)
testConfigMapsDuringUpgrade
(
f
,
sem
)
testGuestbookApplicationDuringUpgrade
(
f
,
sem
)
testGuestbookApplicationDuringUpgrade
(
f
,
sem
)
testDaemonSetDuringUpgrade
(
f
,
sem
)
testDaemonSetDuringUpgrade
(
f
,
sem
)
testJobsDuringUpgrade
(
f
,
sem
)
})
})
cm
.
Do
()
cm
.
Do
()
})
})
...
@@ -112,6 +115,7 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
...
@@ -112,6 +115,7 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
testConfigMapsBeforeAndAfterUpgrade
(
f
,
sem
)
testConfigMapsBeforeAndAfterUpgrade
(
f
,
sem
)
testGuestbookApplicationBeforeAndAfterUpgrade
(
f
,
sem
)
testGuestbookApplicationBeforeAndAfterUpgrade
(
f
,
sem
)
testDaemonSetBeforeAndAfterUpgrade
(
f
,
sem
)
testDaemonSetBeforeAndAfterUpgrade
(
f
,
sem
)
testJobsBeforeAndAfterUpgrade
(
f
,
sem
)
})
})
cm
.
Do
()
cm
.
Do
()
})
})
...
@@ -132,6 +136,7 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
...
@@ -132,6 +136,7 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
testConfigMapsDuringUpgrade
(
f
,
sem
)
testConfigMapsDuringUpgrade
(
f
,
sem
)
testGuestbookApplicationDuringUpgrade
(
f
,
sem
)
testGuestbookApplicationDuringUpgrade
(
f
,
sem
)
testDaemonSetDuringUpgrade
(
f
,
sem
)
testDaemonSetDuringUpgrade
(
f
,
sem
)
testJobsDuringUpgrade
(
f
,
sem
)
})
})
cm
.
Do
()
cm
.
Do
()
})
})
...
@@ -404,3 +409,43 @@ func testDaemonSet(f *framework.Framework, sem *chaosmonkey.Semaphore, testDurin
...
@@ -404,3 +409,43 @@ func testDaemonSet(f *framework.Framework, sem *chaosmonkey.Semaphore, testDurin
By
(
"teardown daemonset"
)
By
(
"teardown daemonset"
)
TestDaemonSetWithNodeAffinityTeardown
(
f
,
dsName
)
TestDaemonSetWithNodeAffinityTeardown
(
f
,
dsName
)
}
}
func
testJobsBeforeAndAfterUpgrade
(
f
*
framework
.
Framework
,
sem
*
chaosmonkey
.
Semaphore
)
{
testJobs
(
f
,
sem
,
false
)
}
func
testJobsDuringUpgrade
(
f
*
framework
.
Framework
,
sem
*
chaosmonkey
.
Semaphore
)
{
testJobs
(
f
,
sem
,
true
)
}
func
testJobs
(
f
*
framework
.
Framework
,
sem
*
chaosmonkey
.
Semaphore
,
testDuringDisruption
bool
)
{
parallelism
:=
int32
(
2
)
completions
:=
int32
(
4
)
// Setup
By
(
"setup job"
)
job
:=
TestJobsSetup
(
"randomlySucceedOrFail"
,
"rand-non-local"
,
api
.
RestartPolicyNever
,
parallelism
,
completions
)
// Validate
By
(
"validate job before upgrade"
)
TestJobsValidate
(
f
,
job
,
completions
)
sem
.
Ready
()
if
testDuringDisruption
{
// Continuously validate
wait
.
Until
(
func
()
{
By
(
"validate job during upgrade"
)
TestJobsValidate
(
f
,
job
,
completions
)
},
framework
.
Poll
,
sem
.
StopCh
)
}
else
{
// Block until chaosmonkey is done
By
(
"waiting for upgrade to finish without validating job"
)
<-
sem
.
StopCh
}
// Validate after upgrade
By
(
"validate job after upgrade"
)
TestJobsValidate
(
f
,
job
,
completions
)
// Teardown
}
test/e2e/job.go
View file @
a4f614f2
...
@@ -79,20 +79,13 @@ var _ = framework.KubeDescribe("Job", func() {
...
@@ -79,20 +79,13 @@ var _ = framework.KubeDescribe("Job", func() {
// Pods sometimes fail, but eventually succeed, after pod restarts
// Pods sometimes fail, but eventually succeed, after pod restarts
It
(
"should run a job to completion when tasks sometimes fail and are not locally restarted"
,
func
()
{
It
(
"should run a job to completion when tasks sometimes fail and are not locally restarted"
,
func
()
{
By
(
"Creating a job"
)
// 50% chance of container success, local restarts.
// 50% chance of container success, local restarts.
// Can't use the failOnce approach because that relies
// Can't use the failOnce approach because that relies
// on an emptyDir, which is not preserved across new pods.
// on an emptyDir, which is not preserved across new pods.
// Worst case analysis: 15 failures, each taking 1 minute to
// Worst case analysis: 15 failures, each taking 1 minute to
// run due to some slowness, 1 in 2^15 chance of happening,
// run due to some slowness, 1 in 2^15 chance of happening,
// causing test flake. Should be very rare.
// causing test flake. Should be very rare.
job
:=
newTestJob
(
"randomlySucceedOrFail"
,
"rand-non-local"
,
api
.
RestartPolicyNever
,
parallelism
,
completions
)
TestJobs
(
f
,
"randomlySucceedOrFail"
,
"rand-non-local"
,
api
.
RestartPolicyNever
,
parallelism
,
completions
)
job
,
err
:=
createJob
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
job
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
By
(
"Ensuring job reaches completions"
)
err
=
waitForJobFinish
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
job
.
Name
,
completions
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
})
})
It
(
"should keep restarting failed pods"
,
func
()
{
It
(
"should keep restarting failed pods"
,
func
()
{
...
@@ -339,3 +332,26 @@ func newBool(val bool) *bool {
...
@@ -339,3 +332,26 @@ func newBool(val bool) *bool {
*
p
=
val
*
p
=
val
return
p
return
p
}
}
func
TestJobsSetup
(
behavior
,
name
string
,
rPol
api
.
RestartPolicy
,
parallelism
,
completions
int32
)
*
batch
.
Job
{
return
newTestJob
(
behavior
,
name
,
rPol
,
parallelism
,
completions
)
}
func
TestJobsValidate
(
f
*
framework
.
Framework
,
job
*
batch
.
Job
,
completions
int32
)
{
By
(
"Creating a job"
)
job
,
err
:=
createJob
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
job
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
By
(
"Ensuring job reaches completions"
)
err
=
waitForJobFinish
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
job
.
Name
,
completions
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
By
(
"Delete the job"
)
err
=
deleteJob
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
job
.
ObjectMeta
.
Name
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
}
func
TestJobs
(
f
*
framework
.
Framework
,
behavior
,
name
string
,
rPol
api
.
RestartPolicy
,
parallelism
,
completions
int32
)
{
job
:=
TestJobsSetup
(
behavior
,
name
,
rPol
,
parallelism
,
completions
)
TestJobsValidate
(
f
,
job
,
completions
)
}
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