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
5ad24837
Commit
5ad24837
authored
Oct 06, 2015
by
Marek Grabowski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15145 from piosz/initial-e2e
Implemented e2e test for Initial Resources
parents
f0fdfd96
8262774a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
2 deletions
+68
-2
autoscaling_utils.go
test/e2e/autoscaling_utils.go
+2
-2
initial_resources.go
test/e2e/initial_resources.go
+66
-0
No files found.
test/e2e/autoscaling_utils.go
View file @
5ad24837
...
@@ -38,7 +38,7 @@ const (
...
@@ -38,7 +38,7 @@ const (
timeoutRC
=
120
*
time
.
Second
timeoutRC
=
120
*
time
.
Second
startServiceTimeout
=
time
.
Minute
startServiceTimeout
=
time
.
Minute
startServiceInterval
=
5
*
time
.
Second
startServiceInterval
=
5
*
time
.
Second
image
=
"gcr.io/google_containers/resource_consumer:beta"
resourceConsumerImage
=
"gcr.io/google_containers/resource_consumer:beta"
rcIsNil
=
"ERROR: replicationController = nil"
rcIsNil
=
"ERROR: replicationController = nil"
)
)
...
@@ -261,7 +261,7 @@ func runServiceAndRCForResourceConsumer(c *client.Client, ns, name string, repli
...
@@ -261,7 +261,7 @@ func runServiceAndRCForResourceConsumer(c *client.Client, ns, name string, repli
expectNoError
(
err
)
expectNoError
(
err
)
config
:=
RCConfig
{
config
:=
RCConfig
{
Client
:
c
,
Client
:
c
,
Image
:
i
mage
,
Image
:
resourceConsumerI
mage
,
Name
:
name
,
Name
:
name
,
Namespace
:
ns
,
Namespace
:
ns
,
Timeout
:
timeoutRC
,
Timeout
:
timeoutRC
,
...
...
test/e2e/initial_resources.go
0 → 100644
View file @
5ad24837
/*
Copyright 2015 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
e2e
import
(
"fmt"
"time"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
"k8s.io/kubernetes/pkg/api"
)
var
_
=
Describe
(
"Initial Resources"
,
func
()
{
f
:=
NewFramework
(
"initial-resources"
)
It
(
"[Skipped] should set initial resources based on historical data"
,
func
()
{
cpu
:=
100
mem
:=
200
for
i
:=
0
;
i
<
10
;
i
++
{
rc
:=
NewStaticResourceConsumer
(
fmt
.
Sprintf
(
"ir-%d"
,
i
),
1
,
cpu
,
mem
,
int64
(
2
*
cpu
),
int64
(
2
*
mem
),
f
)
defer
rc
.
CleanUp
()
}
// Wait some time to make sure usage data is gathered.
time
.
Sleep
(
10
*
time
.
Minute
)
pod
:=
runPod
(
f
,
"ir-test"
,
resourceConsumerImage
)
r
:=
pod
.
Spec
.
Containers
[
0
]
.
Resources
.
Requests
Expect
(
r
.
Cpu
()
.
MilliValue
())
.
Should
(
BeNumerically
(
"~"
,
cpu
,
10
))
Expect
(
r
.
Memory
()
.
Value
())
.
Should
(
BeNumerically
(
"~"
,
mem
*
1024
*
1024
,
20
*
1024
*
1024
))
})
})
func
runPod
(
f
*
Framework
,
name
,
image
string
)
*
api
.
Pod
{
pod
:=
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
name
,
},
Spec
:
api
.
PodSpec
{
Containers
:
[]
api
.
Container
{
{
Name
:
name
,
Image
:
image
,
},
},
},
}
createdPod
,
err
:=
f
.
Client
.
Pods
(
f
.
Namespace
.
Name
)
.
Create
(
pod
)
expectNoError
(
err
)
expectNoError
(
waitForPodRunningInNamespace
(
f
.
Client
,
name
,
f
.
Namespace
.
Name
))
return
createdPod
}
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