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
a19a18ae
Commit
a19a18ae
authored
Feb 23, 2017
by
Kubernetes Submit Queue
Committed by
GitHub
Feb 23, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #41808 from gmarek/random-tests
Automatic merge from submit-queue (batch tested with PRs 41540, 41808, 41710, 41838, 41840) Add randomized load test
parents
07cb35d4
8c67f92b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
3 deletions
+28
-3
load.go
test/e2e/load.go
+18
-0
runners.go
test/utils/runners.go
+10
-3
No files found.
test/e2e/load.go
View file @
a19a18ae
...
@@ -63,6 +63,16 @@ const (
...
@@ -63,6 +63,16 @@ const (
nodeCountPerNamespace
=
100
nodeCountPerNamespace
=
100
)
)
var
randomKind
=
schema
.
GroupKind
{
Kind
:
"Random"
}
var
knownKinds
=
[]
schema
.
GroupKind
{
api
.
Kind
(
"ReplicationController"
),
extensions
.
Kind
(
"Deployment"
),
// TODO: uncomment when Jobs are fixed: #38497
//batch.Kind("Job"),
extensions
.
Kind
(
"ReplicaSet"
),
}
// This test suite can take a long time to run, so by default it is added to
// This test suite can take a long time to run, so by default it is added to
// the ginkgo.skip list (see driver.go).
// the ginkgo.skip list (see driver.go).
// To run this suite you must explicitly ask for it by setting the
// To run this suite you must explicitly ask for it by setting the
...
@@ -141,6 +151,8 @@ var _ = framework.KubeDescribe("Load capacity", func() {
...
@@ -141,6 +151,8 @@ var _ = framework.KubeDescribe("Load capacity", func() {
{
podsPerNode
:
30
,
image
:
"gcr.io/google_containers/serve_hostname:v1.4"
,
kind
:
api
.
Kind
(
"ReplicationController"
),
daemonsPerNode
:
2
},
{
podsPerNode
:
30
,
image
:
"gcr.io/google_containers/serve_hostname:v1.4"
,
kind
:
api
.
Kind
(
"ReplicationController"
),
daemonsPerNode
:
2
},
// Test with secrets
// Test with secrets
{
podsPerNode
:
30
,
image
:
"gcr.io/google_containers/serve_hostname:v1.4"
,
kind
:
extensions
.
Kind
(
"Deployment"
),
secretsPerPod
:
2
},
{
podsPerNode
:
30
,
image
:
"gcr.io/google_containers/serve_hostname:v1.4"
,
kind
:
extensions
.
Kind
(
"Deployment"
),
secretsPerPod
:
2
},
// Special test case which randomizes created resources
{
podsPerNode
:
30
,
image
:
"gcr.io/google_containers/serve_hostname:v1.4"
,
kind
:
randomKind
},
}
}
for
_
,
testArg
:=
range
loadTests
{
for
_
,
testArg
:=
range
loadTests
{
...
@@ -370,7 +382,9 @@ func generateConfigsForGroup(
...
@@ -370,7 +382,9 @@ func generateConfigsForGroup(
)
([]
testutils
.
RunObjectConfig
,
[]
*
testutils
.
SecretConfig
)
{
)
([]
testutils
.
RunObjectConfig
,
[]
*
testutils
.
SecretConfig
)
{
configs
:=
make
([]
testutils
.
RunObjectConfig
,
0
,
count
)
configs
:=
make
([]
testutils
.
RunObjectConfig
,
0
,
count
)
secretConfigs
:=
make
([]
*
testutils
.
SecretConfig
,
0
,
count
*
secretsPerPod
)
secretConfigs
:=
make
([]
*
testutils
.
SecretConfig
,
0
,
count
*
secretsPerPod
)
savedKind
:=
kind
for
i
:=
1
;
i
<=
count
;
i
++
{
for
i
:=
1
;
i
<=
count
;
i
++
{
kind
=
savedKind
namespace
:=
nss
[
i
%
len
(
nss
)]
.
Name
namespace
:=
nss
[
i
%
len
(
nss
)]
.
Name
secretNames
:=
make
([]
string
,
0
,
secretsPerPod
)
secretNames
:=
make
([]
string
,
0
,
secretsPerPod
)
...
@@ -400,6 +414,10 @@ func generateConfigsForGroup(
...
@@ -400,6 +414,10 @@ func generateConfigsForGroup(
SecretNames
:
secretNames
,
SecretNames
:
secretNames
,
}
}
if
kind
==
randomKind
{
kind
=
knownKinds
[
rand
.
Int
()
%
len
(
knownKinds
)]
}
var
config
testutils
.
RunObjectConfig
var
config
testutils
.
RunObjectConfig
switch
kind
{
switch
kind
{
case
api
.
Kind
(
"ReplicationController"
)
:
case
api
.
Kind
(
"ReplicationController"
)
:
...
...
test/utils/runners.go
View file @
a19a18ae
...
@@ -52,6 +52,13 @@ const (
...
@@ -52,6 +52,13 @@ const (
nonExist
=
"NonExist"
nonExist
=
"NonExist"
)
)
func
removePtr
(
replicas
*
int32
)
int32
{
if
replicas
==
nil
{
return
0
}
return
*
replicas
}
func
WaitUntilPodIsScheduled
(
c
clientset
.
Interface
,
name
,
namespace
string
,
timeout
time
.
Duration
)
(
*
v1
.
Pod
,
error
)
{
func
WaitUntilPodIsScheduled
(
c
clientset
.
Interface
,
name
,
namespace
string
,
timeout
time
.
Duration
)
(
*
v1
.
Pod
,
error
)
{
// Wait until it's scheduled
// Wait until it's scheduled
p
,
err
:=
c
.
Core
()
.
Pods
(
namespace
)
.
Get
(
name
,
metav1
.
GetOptions
{
ResourceVersion
:
"0"
})
p
,
err
:=
c
.
Core
()
.
Pods
(
namespace
)
.
Get
(
name
,
metav1
.
GetOptions
{
ResourceVersion
:
"0"
})
...
@@ -306,7 +313,7 @@ func (config *DeploymentConfig) create() error {
...
@@ -306,7 +313,7 @@ func (config *DeploymentConfig) create() error {
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"Error creating deployment: %v"
,
err
)
return
fmt
.
Errorf
(
"Error creating deployment: %v"
,
err
)
}
}
config
.
RCConfigLog
(
"Created deployment with name: %v, namespace: %v, replica count: %v"
,
deployment
.
Name
,
config
.
Namespace
,
deployment
.
Spec
.
Replicas
)
config
.
RCConfigLog
(
"Created deployment with name: %v, namespace: %v, replica count: %v"
,
deployment
.
Name
,
config
.
Namespace
,
removePtr
(
deployment
.
Spec
.
Replicas
)
)
return
nil
return
nil
}
}
...
@@ -370,7 +377,7 @@ func (config *ReplicaSetConfig) create() error {
...
@@ -370,7 +377,7 @@ func (config *ReplicaSetConfig) create() error {
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"Error creating replica set: %v"
,
err
)
return
fmt
.
Errorf
(
"Error creating replica set: %v"
,
err
)
}
}
config
.
RCConfigLog
(
"Created replica set with name: %v, namespace: %v, replica count: %v"
,
rs
.
Name
,
config
.
Namespace
,
r
s
.
Spec
.
Replicas
)
config
.
RCConfigLog
(
"Created replica set with name: %v, namespace: %v, replica count: %v"
,
rs
.
Name
,
config
.
Namespace
,
r
emovePtr
(
rs
.
Spec
.
Replicas
)
)
return
nil
return
nil
}
}
...
@@ -527,7 +534,7 @@ func (config *RCConfig) create() error {
...
@@ -527,7 +534,7 @@ func (config *RCConfig) create() error {
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"Error creating replication controller: %v"
,
err
)
return
fmt
.
Errorf
(
"Error creating replication controller: %v"
,
err
)
}
}
config
.
RCConfigLog
(
"Created replication controller with name: %v, namespace: %v, replica count: %v"
,
rc
.
Name
,
config
.
Namespace
,
r
c
.
Spec
.
Replicas
)
config
.
RCConfigLog
(
"Created replication controller with name: %v, namespace: %v, replica count: %v"
,
rc
.
Name
,
config
.
Namespace
,
r
emovePtr
(
rc
.
Spec
.
Replicas
)
)
return
nil
return
nil
}
}
...
...
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