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
f9f588f0
Unverified
Commit
f9f588f0
authored
Nov 29, 2018
by
Wei Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
address comments
parent
4ce10eda
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
12 deletions
+21
-12
preemption.go
test/e2e/scheduling/preemption.go
+21
-12
No files found.
test/e2e/scheduling/preemption.go
View file @
f9f588f0
...
@@ -436,7 +436,7 @@ var _ = SIGDescribe("PreemptionExecutionPath", func() {
...
@@ -436,7 +436,7 @@ var _ = SIGDescribe("PreemptionExecutionPath", func() {
podNamesSeen
:=
make
(
map
[
string
]
struct
{})
podNamesSeen
:=
make
(
map
[
string
]
struct
{})
stopCh
:=
make
(
chan
struct
{})
stopCh
:=
make
(
chan
struct
{})
// create a
n
pod controller to list/watch pod events from the test framework namespace
// create a pod controller to list/watch pod events from the test framework namespace
_
,
podController
:=
cache
.
NewInformer
(
_
,
podController
:=
cache
.
NewInformer
(
&
cache
.
ListWatch
{
&
cache
.
ListWatch
{
ListFunc
:
func
(
options
metav1
.
ListOptions
)
(
runtime
.
Object
,
error
)
{
ListFunc
:
func
(
options
metav1
.
ListOptions
)
(
runtime
.
Object
,
error
)
{
...
@@ -465,7 +465,7 @@ var _ = SIGDescribe("PreemptionExecutionPath", func() {
...
@@ -465,7 +465,7 @@ var _ = SIGDescribe("PreemptionExecutionPath", func() {
{
{
Replicas
:
int32
(
5
),
Replicas
:
int32
(
5
),
PodConfig
:
pausePodConfig
{
PodConfig
:
pausePodConfig
{
Name
:
fmt
.
Sprintf
(
"pod1"
)
,
Name
:
"pod1"
,
Namespace
:
ns
,
Namespace
:
ns
,
Labels
:
map
[
string
]
string
{
"name"
:
"pod1"
},
Labels
:
map
[
string
]
string
{
"name"
:
"pod1"
},
PriorityClassName
:
"p1"
,
PriorityClassName
:
"p1"
,
...
@@ -479,7 +479,7 @@ var _ = SIGDescribe("PreemptionExecutionPath", func() {
...
@@ -479,7 +479,7 @@ var _ = SIGDescribe("PreemptionExecutionPath", func() {
{
{
Replicas
:
int32
(
4
),
Replicas
:
int32
(
4
),
PodConfig
:
pausePodConfig
{
PodConfig
:
pausePodConfig
{
Name
:
fmt
.
Sprintf
(
"pod2"
)
,
Name
:
"pod2"
,
Namespace
:
ns
,
Namespace
:
ns
,
Labels
:
map
[
string
]
string
{
"name"
:
"pod2"
},
Labels
:
map
[
string
]
string
{
"name"
:
"pod2"
},
PriorityClassName
:
"p2"
,
PriorityClassName
:
"p2"
,
...
@@ -493,7 +493,7 @@ var _ = SIGDescribe("PreemptionExecutionPath", func() {
...
@@ -493,7 +493,7 @@ var _ = SIGDescribe("PreemptionExecutionPath", func() {
{
{
Replicas
:
int32
(
4
),
Replicas
:
int32
(
4
),
PodConfig
:
pausePodConfig
{
PodConfig
:
pausePodConfig
{
Name
:
fmt
.
Sprintf
(
"pod3"
)
,
Name
:
"pod3"
,
Namespace
:
ns
,
Namespace
:
ns
,
Labels
:
map
[
string
]
string
{
"name"
:
"pod3"
},
Labels
:
map
[
string
]
string
{
"name"
:
"pod3"
},
PriorityClassName
:
"p3"
,
PriorityClassName
:
"p3"
,
...
@@ -507,7 +507,7 @@ var _ = SIGDescribe("PreemptionExecutionPath", func() {
...
@@ -507,7 +507,7 @@ var _ = SIGDescribe("PreemptionExecutionPath", func() {
{
{
Replicas
:
int32
(
1
),
Replicas
:
int32
(
1
),
PodConfig
:
pausePodConfig
{
PodConfig
:
pausePodConfig
{
Name
:
fmt
.
Sprintf
(
"pod4"
)
,
Name
:
"pod4"
,
Namespace
:
ns
,
Namespace
:
ns
,
Labels
:
map
[
string
]
string
{
"name"
:
"pod4"
},
Labels
:
map
[
string
]
string
{
"name"
:
"pod4"
},
PriorityClassName
:
"p4"
,
PriorityClassName
:
"p4"
,
...
@@ -536,16 +536,25 @@ var _ = SIGDescribe("PreemptionExecutionPath", func() {
...
@@ -536,16 +536,25 @@ var _ = SIGDescribe("PreemptionExecutionPath", func() {
framework
.
Logf
(
"pods created so far: %v"
,
podNamesSeen
)
framework
.
Logf
(
"pods created so far: %v"
,
podNamesSeen
)
framework
.
Logf
(
"length of pods created so far: %v"
,
len
(
podNamesSeen
))
framework
.
Logf
(
"length of pods created so far: %v"
,
len
(
podNamesSeen
))
// count pods number of RepliaSet3, if it's more than orignal replicas (4)
// count pods number of ReplicaSet{1,2,3}, if it's more than expected replicas
// then means its pods has been preempted once or more
// then it denotes its pods have been over-preempted
rs3PodsSeen
:=
0
// "*2" means pods of ReplicaSet{1,2} are expected to be only preempted once
maxRSPodsSeen
:=
[]
int
{
5
*
2
,
4
*
2
,
4
}
rsPodsSeen
:=
[]
int
{
0
,
0
,
0
}
for
podName
:=
range
podNamesSeen
{
for
podName
:=
range
podNamesSeen
{
if
strings
.
HasPrefix
(
podName
,
"rs-pod3"
)
{
if
strings
.
HasPrefix
(
podName
,
"rs-pod1"
)
{
rs3PodsSeen
++
rsPodsSeen
[
0
]
++
}
else
if
strings
.
HasPrefix
(
podName
,
"rs-pod2"
)
{
rsPodsSeen
[
1
]
++
}
else
if
strings
.
HasPrefix
(
podName
,
"rs-pod3"
)
{
rsPodsSeen
[
2
]
++
}
}
}
}
if
rs3PodsSeen
!=
4
{
for
i
,
got
:=
range
rsPodsSeen
{
framework
.
Failf
(
"some pods of ReplicaSet3 have been preempted: expect 4 pod names, but got %d"
,
rs3PodsSeen
)
expected
:=
maxRSPodsSeen
[
i
]
if
got
>
expected
{
framework
.
Failf
(
"pods of ReplicaSet%d have been over-preempted: expect %v pod names, but got %d"
,
i
+
1
,
expected
,
got
)
}
}
}
})
})
...
...
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