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
15ae6ec1
Unverified
Commit
15ae6ec1
authored
Feb 02, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Feb 02, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #68114 from houjun41544/20180831-disruption
Add unit test case for controller/disruption
parents
30566b99
0ed234db
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
disruption_test.go
pkg/controller/disruption/disruption_test.go
+25
-0
No files found.
pkg/controller/disruption/disruption_test.go
View file @
15ae6ec1
...
...
@@ -430,6 +430,31 @@ func TestIntegerMaxUnavailableWithScaling(t *testing.T) {
ps
.
VerifyPdbStatus
(
t
,
pdbName
,
0
,
1
,
3
,
5
,
map
[
string
]
metav1
.
Time
{})
}
// Verify that an percentage MaxUnavailable will recompute allowed disruptions when the scale of
// the selected pod's controller is modified.
func
TestPercentageMaxUnavailableWithScaling
(
t
*
testing
.
T
)
{
dc
,
ps
:=
newFakeDisruptionController
()
pdb
,
pdbName
:=
newMaxUnavailablePodDisruptionBudget
(
t
,
intstr
.
FromString
(
"30%"
))
add
(
t
,
dc
.
pdbStore
,
pdb
)
rs
,
_
:=
newReplicaSet
(
t
,
7
)
add
(
t
,
dc
.
rsStore
,
rs
)
pod
,
_
:=
newPod
(
t
,
"pod"
)
updatePodOwnerToRs
(
t
,
pod
,
rs
)
add
(
t
,
dc
.
podStore
,
pod
)
dc
.
sync
(
pdbName
)
ps
.
VerifyPdbStatus
(
t
,
pdbName
,
0
,
1
,
4
,
7
,
map
[
string
]
metav1
.
Time
{})
// Update scale of ReplicaSet and check PDB
rs
.
Spec
.
Replicas
=
to
.
Int32Ptr
(
3
)
update
(
t
,
dc
.
rsStore
,
rs
)
dc
.
sync
(
pdbName
)
ps
.
VerifyPdbStatus
(
t
,
pdbName
,
0
,
1
,
2
,
3
,
map
[
string
]
metav1
.
Time
{})
}
// Create a pod with no controller, and verify that a PDB with a percentage
// specified won't allow a disruption.
func
TestNakedPod
(
t
*
testing
.
T
)
{
...
...
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