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
c3898970
Commit
c3898970
authored
Oct 26, 2015
by
Piotr Szczesniak
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16156 from piosz/hpa-test
Improved HPA e2e to test stability of the scale decision
parents
cbf4bc5f
d7a3b064
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
autoscaling_utils.go
test/e2e/autoscaling_utils.go
+11
-0
horizontal_pod_autoscaling.go
test/e2e/horizontal_pod_autoscaling.go
+7
-2
No files found.
test/e2e/autoscaling_utils.go
View file @
c3898970
...
...
@@ -231,6 +231,17 @@ func (rc *ResourceConsumer) WaitForReplicas(desiredReplicas int) {
Failf
(
"timeout waiting %v for pods size to be %d"
,
timeout
,
desiredReplicas
)
}
func
(
rc
*
ResourceConsumer
)
EnsureDesiredReplicas
(
desiredReplicas
int
,
timeout
time
.
Duration
)
{
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
timeout
;
time
.
Sleep
(
10
*
time
.
Second
)
{
actual
:=
rc
.
GetReplicas
()
if
desiredReplicas
!=
actual
{
Failf
(
"Number of replicas has changed: expected %v, got %v"
,
desiredReplicas
,
actual
)
}
Logf
(
"Number of replicas is as expected"
)
}
Logf
(
"Number of replicas was stable over %v"
,
timeout
)
}
func
(
rc
*
ResourceConsumer
)
CleanUp
()
{
By
(
fmt
.
Sprintf
(
"Removing consuming RC %s"
,
rc
.
name
))
rc
.
stopCPU
<-
0
...
...
test/e2e/horizontal_pod_autoscaling.go
View file @
c3898970
...
...
@@ -17,6 +17,8 @@ limitations under the License.
package
e2e
import
(
"time"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
...
...
@@ -24,8 +26,9 @@ import (
)
const
(
kind
=
"replicationController"
subresource
=
"scale"
kind
=
"replicationController"
subresource
=
"scale"
stabilityTimeout
=
10
*
time
.
Minute
)
var
_
=
Describe
(
"Horizontal pod autoscaling"
,
func
()
{
...
...
@@ -38,6 +41,7 @@ var _ = Describe("Horizontal pod autoscaling", func() {
defer
rc
.
CleanUp
()
createCPUHorizontalPodAutoscaler
(
rc
,
20
)
rc
.
WaitForReplicas
(
3
)
rc
.
EnsureDesiredReplicas
(
3
,
stabilityTimeout
)
rc
.
ConsumeCPU
(
700
)
rc
.
WaitForReplicas
(
5
)
})
...
...
@@ -47,6 +51,7 @@ var _ = Describe("Horizontal pod autoscaling", func() {
defer
rc
.
CleanUp
()
createCPUHorizontalPodAutoscaler
(
rc
,
30
)
rc
.
WaitForReplicas
(
3
)
rc
.
EnsureDesiredReplicas
(
3
,
stabilityTimeout
)
rc
.
ConsumeCPU
(
100
)
rc
.
WaitForReplicas
(
1
)
})
...
...
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