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
bb744b63
Commit
bb744b63
authored
Oct 27, 2015
by
Jerzy Szczepkowski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16348 from kubernetes/revert-16274-revert-16156-hpa-test
Revert "Revert "Improved HPA e2e to test stability of the scale decis…
parents
cf8c2105
aef00596
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
autoscaling_utils.go
test/e2e/autoscaling_utils.go
+11
-0
horizontal_pod_autoscaling.go
test/e2e/horizontal_pod_autoscaling.go
+5
-0
No files found.
test/e2e/autoscaling_utils.go
View file @
bb744b63
...
@@ -231,6 +231,17 @@ func (rc *ResourceConsumer) WaitForReplicas(desiredReplicas int) {
...
@@ -231,6 +231,17 @@ func (rc *ResourceConsumer) WaitForReplicas(desiredReplicas int) {
Failf
(
"timeout waiting %v for pods size to be %d"
,
timeout
,
desiredReplicas
)
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
()
{
func
(
rc
*
ResourceConsumer
)
CleanUp
()
{
By
(
fmt
.
Sprintf
(
"Removing consuming RC %s"
,
rc
.
name
))
By
(
fmt
.
Sprintf
(
"Removing consuming RC %s"
,
rc
.
name
))
rc
.
stopCPU
<-
0
rc
.
stopCPU
<-
0
...
...
test/e2e/horizontal_pod_autoscaling.go
View file @
bb744b63
...
@@ -17,6 +17,8 @@ limitations under the License.
...
@@ -17,6 +17,8 @@ limitations under the License.
package
e2e
package
e2e
import
(
import
(
"time"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/extensions"
...
@@ -26,6 +28,7 @@ import (
...
@@ -26,6 +28,7 @@ import (
const
(
const
(
kind
=
"replicationController"
kind
=
"replicationController"
subresource
=
"scale"
subresource
=
"scale"
stabilityTimeout
=
10
*
time
.
Minute
)
)
var
_
=
Describe
(
"Horizontal pod autoscaling"
,
func
()
{
var
_
=
Describe
(
"Horizontal pod autoscaling"
,
func
()
{
...
@@ -38,6 +41,7 @@ var _ = Describe("Horizontal pod autoscaling", func() {
...
@@ -38,6 +41,7 @@ var _ = Describe("Horizontal pod autoscaling", func() {
defer
rc
.
CleanUp
()
defer
rc
.
CleanUp
()
createCPUHorizontalPodAutoscaler
(
rc
,
20
)
createCPUHorizontalPodAutoscaler
(
rc
,
20
)
rc
.
WaitForReplicas
(
3
)
rc
.
WaitForReplicas
(
3
)
rc
.
EnsureDesiredReplicas
(
3
,
stabilityTimeout
)
rc
.
ConsumeCPU
(
700
)
rc
.
ConsumeCPU
(
700
)
rc
.
WaitForReplicas
(
5
)
rc
.
WaitForReplicas
(
5
)
})
})
...
@@ -47,6 +51,7 @@ var _ = Describe("Horizontal pod autoscaling", func() {
...
@@ -47,6 +51,7 @@ var _ = Describe("Horizontal pod autoscaling", func() {
defer
rc
.
CleanUp
()
defer
rc
.
CleanUp
()
createCPUHorizontalPodAutoscaler
(
rc
,
30
)
createCPUHorizontalPodAutoscaler
(
rc
,
30
)
rc
.
WaitForReplicas
(
3
)
rc
.
WaitForReplicas
(
3
)
rc
.
EnsureDesiredReplicas
(
3
,
stabilityTimeout
)
rc
.
ConsumeCPU
(
100
)
rc
.
ConsumeCPU
(
100
)
rc
.
WaitForReplicas
(
1
)
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