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
a84a16c8
Commit
a84a16c8
authored
Oct 31, 2017
by
Janet Kuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DaemonSet e2e should wait for history creation
parent
a80985a2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
daemon_set.go
test/e2e/apps/daemon_set.go
+22
-0
No files found.
test/e2e/apps/daemon_set.go
View file @
a84a16c8
...
...
@@ -269,6 +269,7 @@ var _ = SIGDescribe("Daemon set [Serial]", func() {
// Check history and labels
ds
,
err
=
c
.
Extensions
()
.
DaemonSets
(
ns
)
.
Get
(
ds
.
Name
,
metav1
.
GetOptions
{})
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
waitForHistoryCreated
(
c
,
ns
,
label
,
1
)
first
:=
curHistory
(
listDaemonHistories
(
c
,
ns
,
label
),
ds
)
firstHash
:=
first
.
Labels
[
extensions
.
DefaultDaemonSetUniqueLabelKey
]
Expect
(
first
.
Revision
)
.
To
(
Equal
(
int64
(
1
)))
...
...
@@ -295,6 +296,7 @@ var _ = SIGDescribe("Daemon set [Serial]", func() {
// Check history and labels
ds
,
err
=
c
.
Extensions
()
.
DaemonSets
(
ns
)
.
Get
(
ds
.
Name
,
metav1
.
GetOptions
{})
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
waitForHistoryCreated
(
c
,
ns
,
label
,
2
)
cur
:=
curHistory
(
listDaemonHistories
(
c
,
ns
,
label
),
ds
)
Expect
(
cur
.
Revision
)
.
To
(
Equal
(
int64
(
2
)))
Expect
(
cur
.
Labels
[
extensions
.
DefaultDaemonSetUniqueLabelKey
])
.
NotTo
(
Equal
(
firstHash
))
...
...
@@ -324,6 +326,7 @@ var _ = SIGDescribe("Daemon set [Serial]", func() {
// Check history and labels
ds
,
err
=
c
.
Extensions
()
.
DaemonSets
(
ns
)
.
Get
(
ds
.
Name
,
metav1
.
GetOptions
{})
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
waitForHistoryCreated
(
c
,
ns
,
label
,
1
)
cur
:=
curHistory
(
listDaemonHistories
(
c
,
ns
,
label
),
ds
)
hash
:=
cur
.
Labels
[
extensions
.
DefaultDaemonSetUniqueLabelKey
]
Expect
(
cur
.
Revision
)
.
To
(
Equal
(
int64
(
1
)))
...
...
@@ -351,6 +354,7 @@ var _ = SIGDescribe("Daemon set [Serial]", func() {
// Check history and labels
ds
,
err
=
c
.
Extensions
()
.
DaemonSets
(
ns
)
.
Get
(
ds
.
Name
,
metav1
.
GetOptions
{})
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
waitForHistoryCreated
(
c
,
ns
,
label
,
2
)
cur
=
curHistory
(
listDaemonHistories
(
c
,
ns
,
label
),
ds
)
hash
=
cur
.
Labels
[
extensions
.
DefaultDaemonSetUniqueLabelKey
]
Expect
(
cur
.
Revision
)
.
To
(
Equal
(
int64
(
2
)))
...
...
@@ -867,6 +871,24 @@ func checkDaemonSetPodsLabels(podList *v1.PodList, hash, templateGeneration stri
}
}
func
waitForHistoryCreated
(
c
clientset
.
Interface
,
ns
string
,
label
map
[
string
]
string
,
numHistory
int
)
{
listHistoryFn
:=
func
()
(
bool
,
error
)
{
selector
:=
labels
.
Set
(
label
)
.
AsSelector
()
options
:=
metav1
.
ListOptions
{
LabelSelector
:
selector
.
String
()}
historyList
,
err
:=
c
.
AppsV1beta1
()
.
ControllerRevisions
(
ns
)
.
List
(
options
)
if
err
!=
nil
{
return
false
,
err
}
if
len
(
historyList
.
Items
)
==
numHistory
{
return
true
,
nil
}
framework
.
Logf
(
"%d/%d controllerrevisions created."
,
len
(
historyList
.
Items
),
numHistory
)
return
false
,
nil
}
err
:=
wait
.
PollImmediate
(
dsRetryPeriod
,
dsRetryTimeout
,
listHistoryFn
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"error waiting for controllerrevisions to be created"
)
}
func
listDaemonHistories
(
c
clientset
.
Interface
,
ns
string
,
label
map
[
string
]
string
)
*
apps
.
ControllerRevisionList
{
selector
:=
labels
.
Set
(
label
)
.
AsSelector
()
options
:=
metav1
.
ListOptions
{
LabelSelector
:
selector
.
String
()}
...
...
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