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
e1901bf8
Commit
e1901bf8
authored
Oct 27, 2015
by
Daniel Smith
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16196 from erictune/job-e2e-fix
Fix e2e test flakes.
parents
7fade8e2
c2f6768c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
3 deletions
+34
-3
e2e.sh
hack/jenkins/e2e.sh
+0
-1
job.go
test/e2e/job.go
+34
-2
No files found.
hack/jenkins/e2e.sh
View file @
e1901bf8
...
@@ -140,7 +140,6 @@ DISRUPTIVE_TESTS=(
...
@@ -140,7 +140,6 @@ DISRUPTIVE_TESTS=(
GCE_FLAKY_TESTS
=(
GCE_FLAKY_TESTS
=(
"DaemonRestart
\s
Controller
\s
Manager"
"DaemonRestart
\s
Controller
\s
Manager"
"Daemon
\s
set
\s
should
\s
run
\s
and
\s
stop
\s
complex
\s
daemon"
"Daemon
\s
set
\s
should
\s
run
\s
and
\s
stop
\s
complex
\s
daemon"
"Jobs
\s
are
\s
locally
\s
restarted"
"Resource
\s
usage
\s
of
\s
system
\s
containers"
"Resource
\s
usage
\s
of
\s
system
\s
containers"
"allows
\s
scheduling
\s
of
\s
pods
\s
on
\s
a
\s
minion
\s
after
\s
it
\s
rejoins
\s
the
\s
cluster"
# file: resize_nodes.go, issue: #13258
"allows
\s
scheduling
\s
of
\s
pods
\s
on
\s
a
\s
minion
\s
after
\s
it
\s
rejoins
\s
the
\s
cluster"
# file: resize_nodes.go, issue: #13258
"deployment.*
\s
in
\s
the
\s
right
\s
order"
# issue: #15369
"deployment.*
\s
in
\s
the
\s
right
\s
order"
# issue: #15369
...
...
test/e2e/job.go
View file @
e1901bf8
...
@@ -64,8 +64,14 @@ var _ = Describe("Job", func() {
...
@@ -64,8 +64,14 @@ var _ = Describe("Job", func() {
It
(
"should run a job to completion when tasks sometimes fail and are locally restarted"
,
func
()
{
It
(
"should run a job to completion when tasks sometimes fail and are locally restarted"
,
func
()
{
SkipIfProviderIs
(
"gke"
)
SkipIfProviderIs
(
"gke"
)
By
(
"Creating a job"
)
By
(
"Creating a job"
)
// 50% chance of container success, local restarts.
// One failure, then a success, local restarts.
job
:=
newTestJob
(
"randomlySucceedOrFail"
,
"rand-local"
,
api
.
RestartPolicyOnFailure
,
parallelism
,
completions
)
// We can't use the random failure approach used by the
// non-local test below, because kubelet will throttle
// frequently failing containers in a given pod, ramping
// up to 5 minutes between restarts, making test timeouts
// due to successive failures too likely with a reasonable
// test timeout.
job
:=
newTestJob
(
"failOnce"
,
"fail-once-local"
,
api
.
RestartPolicyOnFailure
,
parallelism
,
completions
)
job
,
err
:=
createJob
(
f
.
Client
,
f
.
Namespace
.
Name
,
job
)
job
,
err
:=
createJob
(
f
.
Client
,
f
.
Namespace
.
Name
,
job
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
...
@@ -79,6 +85,11 @@ var _ = Describe("Job", func() {
...
@@ -79,6 +85,11 @@ var _ = Describe("Job", func() {
SkipIfProviderIs
(
"gke"
)
SkipIfProviderIs
(
"gke"
)
By
(
"Creating a job"
)
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
// on an emptyDir, which is not preserved across new pods.
// Worst case analysis: 15 failures, each taking 1 minute to
// run due to some slowness, 1 in 2^15 chance of happening,
// causing test flake. Should be very rare.
job
:=
newTestJob
(
"randomlySucceedOrFail"
,
"rand-non-local"
,
api
.
RestartPolicyNever
,
parallelism
,
completions
)
job
:=
newTestJob
(
"randomlySucceedOrFail"
,
"rand-non-local"
,
api
.
RestartPolicyNever
,
parallelism
,
completions
)
job
,
err
:=
createJob
(
f
.
Client
,
f
.
Namespace
.
Name
,
job
)
job
,
err
:=
createJob
(
f
.
Client
,
f
.
Namespace
.
Name
,
job
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
...
@@ -197,11 +208,25 @@ func newTestJob(behavior, name string, rPol api.RestartPolicy, parallelism, comp
...
@@ -197,11 +208,25 @@ func newTestJob(behavior, name string, rPol api.RestartPolicy, parallelism, comp
},
},
Spec
:
api
.
PodSpec
{
Spec
:
api
.
PodSpec
{
RestartPolicy
:
rPol
,
RestartPolicy
:
rPol
,
Volumes
:
[]
api
.
Volume
{
{
Name
:
"data"
,
VolumeSource
:
api
.
VolumeSource
{
EmptyDir
:
&
api
.
EmptyDirVolumeSource
{},
},
},
},
Containers
:
[]
api
.
Container
{
Containers
:
[]
api
.
Container
{
{
{
Name
:
"c"
,
Name
:
"c"
,
Image
:
"gcr.io/google_containers/busybox"
,
Image
:
"gcr.io/google_containers/busybox"
,
Command
:
[]
string
{},
Command
:
[]
string
{},
VolumeMounts
:
[]
api
.
VolumeMount
{
{
MountPath
:
"/data"
,
Name
:
"data"
,
},
},
},
},
},
},
},
},
...
@@ -219,6 +244,13 @@ func newTestJob(behavior, name string, rPol api.RestartPolicy, parallelism, comp
...
@@ -219,6 +244,13 @@ func newTestJob(behavior, name string, rPol api.RestartPolicy, parallelism, comp
// Bash's $RANDOM generates pseudorandom int in range 0 - 32767.
// Bash's $RANDOM generates pseudorandom int in range 0 - 32767.
// Dividing by 16384 gives roughly 50/50 chance of success.
// Dividing by 16384 gives roughly 50/50 chance of success.
job
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Command
=
[]
string
{
"/bin/sh"
,
"-c"
,
"exit $(( $RANDOM / 16384 ))"
}
job
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Command
=
[]
string
{
"/bin/sh"
,
"-c"
,
"exit $(( $RANDOM / 16384 ))"
}
case
"failOnce"
:
// Fail the first the container of the pod is run, and
// succeed the second time. Checks for file on emptydir.
// If present, succeed. If not, create but fail.
// Note that this cannot be used with RestartNever because
// it always fails the first time for a pod.
job
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Command
=
[]
string
{
"/bin/sh"
,
"-c"
,
"if [[ -r /data/foo ]] ; then exit 0 ; else touch /data/foo ; exit 1 ; fi"
}
}
}
return
job
return
job
}
}
...
...
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