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
4b3078fe
Commit
4b3078fe
authored
Jan 03, 2019
by
Morten Torkildsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix flaking evictions test
parent
8252610f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
evictions_test.go
test/integration/evictions/evictions_test.go
+15
-6
No files found.
test/integration/evictions/evictions_test.go
View file @
4b3078fe
...
...
@@ -86,7 +86,7 @@ func TestConcurrentEvictionRequests(t *testing.T) {
}
}
waitToObservePods
(
t
,
informers
.
Core
()
.
V1
()
.
Pods
()
.
Informer
(),
numOfEvictions
)
waitToObservePods
(
t
,
informers
.
Core
()
.
V1
()
.
Pods
()
.
Informer
(),
numOfEvictions
,
v1
.
PodRunning
)
pdb
:=
newPDB
()
if
_
,
err
:=
clientSet
.
Policy
()
.
PodDisruptionBudgets
(
ns
.
Name
)
.
Create
(
pdb
);
err
!=
nil
{
...
...
@@ -193,18 +193,21 @@ func TestTerminalPodEviction(t *testing.T) {
if
_
,
err
:=
clientSet
.
CoreV1
()
.
Pods
(
ns
.
Name
)
.
Create
(
pod
);
err
!=
nil
{
t
.
Errorf
(
"Failed to create pod: %v"
,
err
)
}
addPodConditionSucceeded
(
pod
)
if
_
,
err
:=
clientSet
.
CoreV1
()
.
Pods
(
ns
.
Name
)
.
UpdateStatus
(
pod
);
err
!=
nil
{
t
.
Fatal
(
err
)
}
waitToObservePods
(
t
,
informers
.
Core
()
.
V1
()
.
Pods
()
.
Informer
(),
1
)
waitToObservePods
(
t
,
informers
.
Core
()
.
V1
()
.
Pods
()
.
Informer
(),
1
,
v1
.
PodSucceeded
)
pdb
:=
newPDB
()
if
_
,
err
:=
clientSet
.
Policy
()
.
PodDisruptionBudgets
(
ns
.
Name
)
.
Create
(
pdb
);
err
!=
nil
{
t
.
Errorf
(
"Failed to create PodDisruptionBudget: %v"
,
err
)
}
waitPDBStable
(
t
,
clientSet
,
1
,
ns
.
Name
,
pdb
.
Name
)
pdbList
,
err
:=
clientSet
.
Policy
()
.
PodDisruptionBudgets
(
ns
.
Name
)
.
List
(
metav1
.
ListOptions
{})
if
err
!=
nil
{
t
.
Fatalf
(
"Error while listing pod disruption budget"
)
...
...
@@ -341,13 +344,19 @@ func rmSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, *disruption.D
// wait for the podInformer to observe the pods. Call this function before
// running the RS controller to prevent the rc manager from creating new pods
// rather than adopting the existing ones.
func
waitToObservePods
(
t
*
testing
.
T
,
podInformer
cache
.
SharedIndexInformer
,
podNum
int
)
{
func
waitToObservePods
(
t
*
testing
.
T
,
podInformer
cache
.
SharedIndexInformer
,
podNum
int
,
phase
v1
.
PodPhase
)
{
if
err
:=
wait
.
PollImmediate
(
2
*
time
.
Second
,
60
*
time
.
Second
,
func
()
(
bool
,
error
)
{
objects
:=
podInformer
.
GetIndexer
()
.
List
()
if
len
(
objects
)
=
=
podNum
{
return
tru
e
,
nil
if
len
(
objects
)
!
=
podNum
{
return
fals
e
,
nil
}
return
false
,
nil
for
_
,
obj
:=
range
objects
{
pod
:=
obj
.
(
*
v1
.
Pod
)
if
pod
.
Status
.
Phase
!=
phase
{
return
false
,
nil
}
}
return
true
,
nil
});
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
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