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
d6ffcae3
Commit
d6ffcae3
authored
Aug 12, 2018
by
Morten Torkildsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix flakiness in daemonset TestLaunchWithHashCollisiion
parent
a73ef598
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
5 deletions
+22
-5
BUILD
test/integration/daemonset/BUILD
+1
-0
daemonset_test.go
test/integration/daemonset/daemonset_test.go
+21
-5
No files found.
test/integration/daemonset/BUILD
View file @
d6ffcae3
...
@@ -41,6 +41,7 @@ go_test(
...
@@ -41,6 +41,7 @@ go_test(
"//staging/src/k8s.io/client-go/rest:go_default_library",
"//staging/src/k8s.io/client-go/rest:go_default_library",
"//staging/src/k8s.io/client-go/tools/cache:go_default_library",
"//staging/src/k8s.io/client-go/tools/cache:go_default_library",
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
"//staging/src/k8s.io/client-go/util/retry:go_default_library",
"//test/integration/framework:go_default_library",
"//test/integration/framework:go_default_library",
],
],
)
)
...
...
test/integration/daemonset/daemonset_test.go
View file @
d6ffcae3
...
@@ -51,6 +51,7 @@ import (
...
@@ -51,6 +51,7 @@ import (
"k8s.io/kubernetes/pkg/scheduler/factory"
"k8s.io/kubernetes/pkg/scheduler/factory"
labelsutil
"k8s.io/kubernetes/pkg/util/labels"
labelsutil
"k8s.io/kubernetes/pkg/util/labels"
"k8s.io/kubernetes/pkg/util/metrics"
"k8s.io/kubernetes/pkg/util/metrics"
"k8s.io/kubernetes/staging/src/k8s.io/client-go/util/retry"
"k8s.io/kubernetes/test/integration/framework"
"k8s.io/kubernetes/test/integration/framework"
)
)
...
@@ -461,6 +462,22 @@ func validateFailedPlacementEvent(eventClient corev1typed.EventInterface, t *tes
...
@@ -461,6 +462,22 @@ func validateFailedPlacementEvent(eventClient corev1typed.EventInterface, t *tes
}
}
}
}
func
updateDS
(
t
*
testing
.
T
,
dsClient
appstyped
.
DaemonSetInterface
,
dsName
string
,
updateFunc
func
(
*
apps
.
DaemonSet
))
*
apps
.
DaemonSet
{
var
ds
*
apps
.
DaemonSet
if
err
:=
retry
.
RetryOnConflict
(
retry
.
DefaultBackoff
,
func
()
error
{
newDS
,
err
:=
dsClient
.
Get
(
dsName
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
return
err
}
updateFunc
(
newDS
)
ds
,
err
=
dsClient
.
Update
(
newDS
)
return
err
});
err
!=
nil
{
t
.
Fatalf
(
"Failed to update DaemonSet: %v"
,
err
)
}
return
ds
}
func
forEachFeatureGate
(
t
*
testing
.
T
,
tf
func
(
t
*
testing
.
T
))
{
func
forEachFeatureGate
(
t
*
testing
.
T
,
tf
func
(
t
*
testing
.
T
))
{
for
_
,
fg
:=
range
featureGates
()
{
for
_
,
fg
:=
range
featureGates
()
{
func
()
{
func
()
{
...
@@ -832,7 +849,7 @@ func TestLaunchWithHashCollision(t *testing.T) {
...
@@ -832,7 +849,7 @@ func TestLaunchWithHashCollision(t *testing.T) {
// Wait for the DaemonSet to be created before proceeding
// Wait for the DaemonSet to be created before proceeding
err
=
waitForDaemonSetAndControllerRevisionCreated
(
clientset
,
ds
.
Name
,
ds
.
Namespace
)
err
=
waitForDaemonSetAndControllerRevisionCreated
(
clientset
,
ds
.
Name
,
ds
.
Namespace
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"Failed to create D
ea
monSet: %v"
,
err
)
t
.
Fatalf
(
"Failed to create D
ae
monSet: %v"
,
err
)
}
}
ds
,
err
=
dsClient
.
Get
(
ds
.
Name
,
metav1
.
GetOptions
{})
ds
,
err
=
dsClient
.
Get
(
ds
.
Name
,
metav1
.
GetOptions
{})
...
@@ -875,10 +892,9 @@ func TestLaunchWithHashCollision(t *testing.T) {
...
@@ -875,10 +892,9 @@ func TestLaunchWithHashCollision(t *testing.T) {
// Make an update of the DaemonSet which we know will create a hash collision when
// Make an update of the DaemonSet which we know will create a hash collision when
// the next ControllerRevision is created.
// the next ControllerRevision is created.
_
,
err
=
dsClient
.
Update
(
ds
)
ds
=
updateDS
(
t
,
dsClient
,
ds
.
Name
,
func
(
updateDS
*
apps
.
DaemonSet
)
{
if
err
!=
nil
{
updateDS
.
Spec
.
Template
.
Spec
.
TerminationGracePeriodSeconds
=
&
one
t
.
Fatalf
(
"Failed to update DaemonSet: %v"
,
err
)
})
}
// Wait for any pod with the latest Spec to exist
// Wait for any pod with the latest Spec to exist
err
=
wait
.
PollImmediate
(
100
*
time
.
Millisecond
,
10
*
time
.
Second
,
func
()
(
bool
,
error
)
{
err
=
wait
.
PollImmediate
(
100
*
time
.
Millisecond
,
10
*
time
.
Second
,
func
()
(
bool
,
error
)
{
...
...
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