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
aeba0f1d
Commit
aeba0f1d
authored
Oct 24, 2016
by
gmarek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change a type of collection of strategies for NodePreparer
parent
40b66e17
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
16 deletions
+21
-16
density.go
test/e2e/density.go
+1
-1
util.go
test/e2e/framework/util.go
+6
-6
perf_utils.go
test/integration/framework/perf_utils.go
+7
-7
scheduler_bench_test.go
test/integration/scheduler_perf/scheduler_bench_test.go
+1
-1
scheduler_test.go
test/integration/scheduler_perf/scheduler_test.go
+1
-1
runners.go
test/utils/runners.go
+5
-0
No files found.
test/e2e/density.go
View file @
aeba0f1d
...
@@ -463,7 +463,7 @@ var _ = framework.KubeDescribe("Density", func() {
...
@@ -463,7 +463,7 @@ var _ = framework.KubeDescribe("Density", func() {
It
(
name
,
func
()
{
It
(
name
,
func
()
{
nodePreparer
:=
framework
.
NewE2ETestNodePreparer
(
nodePreparer
:=
framework
.
NewE2ETestNodePreparer
(
f
.
ClientSet
,
f
.
ClientSet
,
map
[
int
]
testutils
.
PrepareNodeStrategy
{
nodeCount
:
&
testutils
.
TrivialNodePrepareStrategy
{
}},
[]
testutils
.
CountToStrategy
{{
Count
:
nodeCount
,
Strategy
:
&
testutils
.
TrivialNodePrepareStrategy
{}
}},
)
)
framework
.
ExpectNoError
(
nodePreparer
.
PrepareNodes
())
framework
.
ExpectNoError
(
nodePreparer
.
PrepareNodes
())
defer
nodePreparer
.
CleanupNodes
()
defer
nodePreparer
.
CleanupNodes
()
...
...
test/e2e/framework/util.go
View file @
aeba0f1d
...
@@ -4522,11 +4522,11 @@ type E2ETestNodePreparer struct {
...
@@ -4522,11 +4522,11 @@ type E2ETestNodePreparer struct {
// Specifies how many nodes should be modified using the given strategy.
// Specifies how many nodes should be modified using the given strategy.
// Only one strategy can be applied to a single Node, so there needs to
// Only one strategy can be applied to a single Node, so there needs to
// be at least <sum_of_keys> Nodes in the cluster.
// be at least <sum_of_keys> Nodes in the cluster.
countToStrategy
map
[
int
]
testutils
.
PrepareNode
Strategy
countToStrategy
[]
testutils
.
CountTo
Strategy
nodeToAppliedStrategy
map
[
string
]
testutils
.
PrepareNodeStrategy
nodeToAppliedStrategy
map
[
string
]
testutils
.
PrepareNodeStrategy
}
}
func
NewE2ETestNodePreparer
(
client
clientset
.
Interface
,
countToStrategy
map
[
int
]
testutils
.
PrepareNode
Strategy
)
testutils
.
TestNodePreparer
{
func
NewE2ETestNodePreparer
(
client
clientset
.
Interface
,
countToStrategy
[]
testutils
.
CountTo
Strategy
)
testutils
.
TestNodePreparer
{
return
&
E2ETestNodePreparer
{
return
&
E2ETestNodePreparer
{
client
:
client
,
client
:
client
,
countToStrategy
:
countToStrategy
,
countToStrategy
:
countToStrategy
,
...
@@ -4545,14 +4545,14 @@ func (p *E2ETestNodePreparer) PrepareNodes() error {
...
@@ -4545,14 +4545,14 @@ func (p *E2ETestNodePreparer) PrepareNodes() error {
}
}
index
:=
0
index
:=
0
sum
:=
0
sum
:=
0
for
k
,
strategy
:=
range
p
.
countToStrategy
{
for
_
,
v
:=
range
p
.
countToStrategy
{
sum
+=
k
sum
+=
v
.
Count
for
;
index
<
sum
;
index
++
{
for
;
index
<
sum
;
index
++
{
if
err
:=
testutils
.
DoPrepareNode
(
p
.
client
,
&
nodes
.
Items
[
index
],
s
trategy
);
err
!=
nil
{
if
err
:=
testutils
.
DoPrepareNode
(
p
.
client
,
&
nodes
.
Items
[
index
],
v
.
S
trategy
);
err
!=
nil
{
glog
.
Errorf
(
"Aborting node preparation: %v"
,
err
)
glog
.
Errorf
(
"Aborting node preparation: %v"
,
err
)
return
err
return
err
}
}
p
.
nodeToAppliedStrategy
[
nodes
.
Items
[
index
]
.
Name
]
=
s
trategy
p
.
nodeToAppliedStrategy
[
nodes
.
Items
[
index
]
.
Name
]
=
v
.
S
trategy
}
}
}
}
return
nil
return
nil
...
...
test/integration/framework/perf_utils.go
View file @
aeba0f1d
...
@@ -32,11 +32,11 @@ const (
...
@@ -32,11 +32,11 @@ const (
type
IntegrationTestNodePreparer
struct
{
type
IntegrationTestNodePreparer
struct
{
client
clientset
.
Interface
client
clientset
.
Interface
countToStrategy
map
[
int
]
testutils
.
PrepareNode
Strategy
countToStrategy
[]
testutils
.
CountTo
Strategy
nodeNamePrefix
string
nodeNamePrefix
string
}
}
func
NewIntegrationTestNodePreparer
(
client
clientset
.
Interface
,
countToStrategy
map
[
int
]
testutils
.
PrepareNode
Strategy
,
nodeNamePrefix
string
)
testutils
.
TestNodePreparer
{
func
NewIntegrationTestNodePreparer
(
client
clientset
.
Interface
,
countToStrategy
[]
testutils
.
CountTo
Strategy
,
nodeNamePrefix
string
)
testutils
.
TestNodePreparer
{
return
&
IntegrationTestNodePreparer
{
return
&
IntegrationTestNodePreparer
{
client
:
client
,
client
:
client
,
countToStrategy
:
countToStrategy
,
countToStrategy
:
countToStrategy
,
...
@@ -46,8 +46,8 @@ func NewIntegrationTestNodePreparer(client clientset.Interface, countToStrategy
...
@@ -46,8 +46,8 @@ func NewIntegrationTestNodePreparer(client clientset.Interface, countToStrategy
func
(
p
*
IntegrationTestNodePreparer
)
PrepareNodes
()
error
{
func
(
p
*
IntegrationTestNodePreparer
)
PrepareNodes
()
error
{
numNodes
:=
0
numNodes
:=
0
for
k
:=
range
p
.
countToStrategy
{
for
_
,
v
:=
range
p
.
countToStrategy
{
numNodes
+=
k
numNodes
+=
v
.
Count
}
}
glog
.
Infof
(
"Making %d nodes"
,
numNodes
)
glog
.
Infof
(
"Making %d nodes"
,
numNodes
)
...
@@ -80,10 +80,10 @@ func (p *IntegrationTestNodePreparer) PrepareNodes() error {
...
@@ -80,10 +80,10 @@ func (p *IntegrationTestNodePreparer) PrepareNodes() error {
nodes
:=
e2eframework
.
GetReadySchedulableNodesOrDie
(
p
.
client
)
nodes
:=
e2eframework
.
GetReadySchedulableNodesOrDie
(
p
.
client
)
index
:=
0
index
:=
0
sum
:=
0
sum
:=
0
for
k
,
strategy
:=
range
p
.
countToStrategy
{
for
_
,
v
:=
range
p
.
countToStrategy
{
sum
+=
k
sum
+=
v
.
Count
for
;
index
<
sum
;
index
++
{
for
;
index
<
sum
;
index
++
{
if
err
:=
testutils
.
DoPrepareNode
(
p
.
client
,
&
nodes
.
Items
[
index
],
s
trategy
);
err
!=
nil
{
if
err
:=
testutils
.
DoPrepareNode
(
p
.
client
,
&
nodes
.
Items
[
index
],
v
.
S
trategy
);
err
!=
nil
{
glog
.
Errorf
(
"Aborting node preparation: %v"
,
err
)
glog
.
Errorf
(
"Aborting node preparation: %v"
,
err
)
return
err
return
err
}
}
...
...
test/integration/scheduler_perf/scheduler_bench_test.go
View file @
aeba0f1d
...
@@ -60,7 +60,7 @@ func benchmarkScheduling(numNodes, numScheduledPods int, b *testing.B) {
...
@@ -60,7 +60,7 @@ func benchmarkScheduling(numNodes, numScheduledPods int, b *testing.B) {
nodePreparer
:=
framework
.
NewIntegrationTestNodePreparer
(
nodePreparer
:=
framework
.
NewIntegrationTestNodePreparer
(
c
,
c
,
map
[
int
]
testutils
.
PrepareNodeStrategy
{
numNodes
:
&
testutils
.
TrivialNodePrepareStrategy
{
}},
[]
testutils
.
CountToStrategy
{{
Count
:
numNodes
,
Strategy
:
&
testutils
.
TrivialNodePrepareStrategy
{}
}},
"scheduler-perf-"
,
"scheduler-perf-"
,
)
)
if
err
:=
nodePreparer
.
PrepareNodes
();
err
!=
nil
{
if
err
:=
nodePreparer
.
PrepareNodes
();
err
!=
nil
{
...
...
test/integration/scheduler_perf/scheduler_test.go
View file @
aeba0f1d
...
@@ -83,7 +83,7 @@ func schedulePods(numNodes, numPods int) int32 {
...
@@ -83,7 +83,7 @@ func schedulePods(numNodes, numPods int) int32 {
nodePreparer
:=
framework
.
NewIntegrationTestNodePreparer
(
nodePreparer
:=
framework
.
NewIntegrationTestNodePreparer
(
c
,
c
,
map
[
int
]
testutils
.
PrepareNodeStrategy
{
numNodes
:
&
testutils
.
TrivialNodePrepareStrategy
{
}},
[]
testutils
.
CountToStrategy
{{
Count
:
numNodes
,
Strategy
:
&
testutils
.
TrivialNodePrepareStrategy
{}
}},
"scheduler-perf-"
,
"scheduler-perf-"
,
)
)
if
err
:=
nodePreparer
.
PrepareNodes
();
err
!=
nil
{
if
err
:=
nodePreparer
.
PrepareNodes
();
err
!=
nil
{
...
...
test/utils/runners.go
View file @
aeba0f1d
...
@@ -608,6 +608,11 @@ waitLoop:
...
@@ -608,6 +608,11 @@ waitLoop:
return
nil
return
nil
}
}
type
CountToStrategy
struct
{
Count
int
Strategy
PrepareNodeStrategy
}
type
TestNodePreparer
interface
{
type
TestNodePreparer
interface
{
PrepareNodes
()
error
PrepareNodes
()
error
CleanupNodes
()
error
CleanupNodes
()
error
...
...
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