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
65fdea80
Unverified
Commit
65fdea80
authored
Dec 31, 2018
by
Kubernetes Prow Robot
Committed by
GitHub
Dec 31, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #71922 from vikramk7/master
Make error messages more helpful in some e2e tests
parents
de02d009
da0896c1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
25 deletions
+25
-25
watch.go
test/e2e/apimachinery/watch.go
+4
-4
cronjob.go
test/e2e/apps/cronjob.go
+21
-21
No files found.
test/e2e/apimachinery/watch.go
View file @
65fdea80
...
...
@@ -345,7 +345,7 @@ var _ = SIGDescribe("Watchers", func() {
resourceVersion
:=
"0"
for
i
:=
0
;
i
<
iterations
;
i
++
{
wc
,
err
:=
c
.
CoreV1
()
.
ConfigMaps
(
ns
)
.
Watch
(
metav1
.
ListOptions
{
ResourceVersion
:
resourceVersion
})
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to watch configmaps in the namespace %s"
,
ns
)
wcs
=
append
(
wcs
,
wc
)
resourceVersion
=
waitForNextConfigMapEvent
(
wcs
[
0
])
.
ResourceVersion
for
_
,
wc
:=
range
wcs
[
1
:
]
{
...
...
@@ -472,18 +472,18 @@ func produceConfigMapEvents(f *framework.Framework, stopc <-chan struct{}, minWa
case
createEvent
:
cm
.
Name
=
name
(
i
)
_
,
err
:=
c
.
CoreV1
()
.
ConfigMaps
(
ns
)
.
Create
(
cm
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to create configmap %s in namespace %s"
,
cm
.
Name
,
ns
)
existing
=
append
(
existing
,
i
)
i
+=
1
case
updateEvent
:
idx
:=
rand
.
Intn
(
len
(
existing
))
cm
.
Name
=
name
(
existing
[
idx
])
_
,
err
:=
c
.
CoreV1
()
.
ConfigMaps
(
ns
)
.
Update
(
cm
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to update configmap %s in namespace %s"
,
cm
.
Name
,
ns
)
case
deleteEvent
:
idx
:=
rand
.
Intn
(
len
(
existing
))
err
:=
c
.
CoreV1
()
.
ConfigMaps
(
ns
)
.
Delete
(
name
(
existing
[
idx
]),
&
metav1
.
DeleteOptions
{})
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to delete configmap %s in namespace %s"
,
name
(
existing
[
idx
]),
ns
)
existing
=
append
(
existing
[
:
idx
],
existing
[
idx
+
1
:
]
...
)
default
:
framework
.
Failf
(
"Unsupported event operation: %d"
,
op
)
...
...
test/e2e/apps/cronjob.go
View file @
65fdea80
...
...
@@ -60,21 +60,21 @@ var _ = SIGDescribe("CronJob", func() {
cronJob
:=
newTestCronJob
(
"concurrent"
,
"*/1 * * * ?"
,
batchv1beta1
.
AllowConcurrent
,
sleepCommand
,
nil
)
cronJob
,
err
:=
createCronJob
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
cronJob
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to create CronJob in namespace %s"
,
f
.
Namespace
.
Name
)
By
(
"Ensuring more than one job is running at a time"
)
err
=
waitForActiveJobs
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
cronJob
.
Name
,
2
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to wait for active jobs in CronJob %s in namespace %s"
,
cronJob
.
Name
,
f
.
Namespace
.
Name
)
By
(
"Ensuring at least two running jobs exists by listing jobs explicitly"
)
jobs
,
err
:=
f
.
ClientSet
.
BatchV1
()
.
Jobs
(
f
.
Namespace
.
Name
)
.
List
(
metav1
.
ListOptions
{})
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to list the CronJobs in namespace %s"
,
f
.
Namespace
.
Name
)
activeJobs
,
_
:=
filterActiveJobs
(
jobs
)
Expect
(
len
(
activeJobs
)
>=
2
)
.
To
(
BeTrue
())
By
(
"Removing cronjob"
)
err
=
deleteCronJob
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
cronJob
.
Name
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to delete CronJob %s in namespace %s"
,
cronJob
.
Name
,
f
.
Namespace
.
Name
)
})
// suspended should not schedule jobs
...
...
@@ -85,7 +85,7 @@ var _ = SIGDescribe("CronJob", func() {
t
:=
true
cronJob
.
Spec
.
Suspend
=
&
t
cronJob
,
err
:=
createCronJob
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
cronJob
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to create CronJob in namespace %s"
,
f
.
Namespace
.
Name
)
By
(
"Ensuring no jobs are scheduled"
)
err
=
waitForNoJobs
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
cronJob
.
Name
,
false
)
...
...
@@ -93,12 +93,12 @@ var _ = SIGDescribe("CronJob", func() {
By
(
"Ensuring no job exists by listing jobs explicitly"
)
jobs
,
err
:=
f
.
ClientSet
.
BatchV1
()
.
Jobs
(
f
.
Namespace
.
Name
)
.
List
(
metav1
.
ListOptions
{})
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to list the CronJobs in namespace %s"
,
f
.
Namespace
.
Name
)
Expect
(
jobs
.
Items
)
.
To
(
HaveLen
(
0
))
By
(
"Removing cronjob"
)
err
=
deleteCronJob
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
cronJob
.
Name
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to delete CronJob %s in namespace %s"
,
cronJob
.
Name
,
f
.
Namespace
.
Name
)
})
// only single active job is allowed for ForbidConcurrent
...
...
@@ -107,20 +107,20 @@ var _ = SIGDescribe("CronJob", func() {
cronJob
:=
newTestCronJob
(
"forbid"
,
"*/1 * * * ?"
,
batchv1beta1
.
ForbidConcurrent
,
sleepCommand
,
nil
)
cronJob
,
err
:=
createCronJob
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
cronJob
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to create CronJob in namespace %s"
,
f
.
Namespace
.
Name
)
By
(
"Ensuring a job is scheduled"
)
err
=
waitForActiveJobs
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
cronJob
.
Name
,
1
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to schedule CronJob %s"
,
cronJob
.
Name
)
By
(
"Ensuring exactly one is scheduled"
)
cronJob
,
err
=
getCronJob
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
cronJob
.
Name
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to get CronJob %s"
,
cronJob
.
Name
)
Expect
(
cronJob
.
Status
.
Active
)
.
Should
(
HaveLen
(
1
))
By
(
"Ensuring exactly one running job exists by listing jobs explicitly"
)
jobs
,
err
:=
f
.
ClientSet
.
BatchV1
()
.
Jobs
(
f
.
Namespace
.
Name
)
.
List
(
metav1
.
ListOptions
{})
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to list the CronJobs in namespace %s"
,
f
.
Namespace
.
Name
)
activeJobs
,
_
:=
filterActiveJobs
(
jobs
)
Expect
(
activeJobs
)
.
To
(
HaveLen
(
1
))
...
...
@@ -130,7 +130,7 @@ var _ = SIGDescribe("CronJob", func() {
By
(
"Removing cronjob"
)
err
=
deleteCronJob
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
cronJob
.
Name
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to delete CronJob %s in namespace %s"
,
cronJob
.
Name
,
f
.
Namespace
.
Name
)
})
// only single active job is allowed for ReplaceConcurrent
...
...
@@ -139,30 +139,30 @@ var _ = SIGDescribe("CronJob", func() {
cronJob
:=
newTestCronJob
(
"replace"
,
"*/1 * * * ?"
,
batchv1beta1
.
ReplaceConcurrent
,
sleepCommand
,
nil
)
cronJob
,
err
:=
createCronJob
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
cronJob
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to create CronJob in namespace %s"
,
f
.
Namespace
.
Name
)
By
(
"Ensuring a job is scheduled"
)
err
=
waitForActiveJobs
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
cronJob
.
Name
,
1
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to schedule CronJob %s in namespace %s"
,
cronJob
.
Name
,
f
.
Namespace
.
Name
)
By
(
"Ensuring exactly one is scheduled"
)
cronJob
,
err
=
getCronJob
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
cronJob
.
Name
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to get CronJob %s"
,
cronJob
.
Name
)
Expect
(
cronJob
.
Status
.
Active
)
.
Should
(
HaveLen
(
1
))
By
(
"Ensuring exactly one running job exists by listing jobs explicitly"
)
jobs
,
err
:=
f
.
ClientSet
.
BatchV1
()
.
Jobs
(
f
.
Namespace
.
Name
)
.
List
(
metav1
.
ListOptions
{})
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to list the jobs in namespace %s"
,
f
.
Namespace
.
Name
)
activeJobs
,
_
:=
filterActiveJobs
(
jobs
)
Expect
(
activeJobs
)
.
To
(
HaveLen
(
1
))
By
(
"Ensuring the job is replaced with a new one"
)
err
=
waitForJobReplaced
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
jobs
.
Items
[
0
]
.
Name
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to replace CronJob %s in namespace %s"
,
jobs
.
Items
[
0
]
.
Name
,
f
.
Namespace
.
Name
)
By
(
"Removing cronjob"
)
err
=
deleteCronJob
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
cronJob
.
Name
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to delete CronJob %s in namespace %s"
,
cronJob
.
Name
,
f
.
Namespace
.
Name
)
})
// shouldn't give us unexpected warnings
...
...
@@ -171,7 +171,7 @@ var _ = SIGDescribe("CronJob", func() {
cronJob
:=
newTestCronJob
(
"concurrent"
,
"*/1 * * * ?"
,
batchv1beta1
.
AllowConcurrent
,
nil
,
nil
)
cronJob
,
err
:=
createCronJob
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
cronJob
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to create CronJob in namespace %s"
,
f
.
Namespace
.
Name
)
By
(
"Ensuring at least two jobs and at least one finished job exists by listing jobs explicitly"
)
err
=
waitForJobsAtLeast
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
2
)
...
...
@@ -185,7 +185,7 @@ var _ = SIGDescribe("CronJob", func() {
By
(
"Removing cronjob"
)
err
=
deleteCronJob
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
cronJob
.
Name
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to delete CronJob %s in namespace %s"
,
cronJob
.
Name
,
f
.
Namespace
.
Name
)
})
// deleted jobs should be removed from the active list
...
...
@@ -194,7 +194,7 @@ var _ = SIGDescribe("CronJob", func() {
cronJob
:=
newTestCronJob
(
"forbid"
,
"*/1 * * * ?"
,
batchv1beta1
.
ForbidConcurrent
,
sleepCommand
,
nil
)
cronJob
,
err
:=
createCronJob
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
cronJob
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
,
"Failed to create CronJob in namespace %s"
,
f
.
Namespace
.
Name
)
By
(
"Ensuring a job is scheduled"
)
err
=
waitForActiveJobs
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
cronJob
.
Name
,
1
)
...
...
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