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
a5d86270
Commit
a5d86270
authored
Apr 11, 2017
by
Shayne Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added coverage for scheduler/algorithm/types_test.go
parent
904b0207
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
2 deletions
+74
-2
BUILD
plugin/pkg/scheduler/algorithm/BUILD
+9
-2
types_test.go
plugin/pkg/scheduler/algorithm/types_test.go
+65
-0
No files found.
plugin/pkg/scheduler/algorithm/BUILD
View file @
a5d86270
...
...
@@ -28,10 +28,17 @@ go_library(
go_test(
name = "go_default_test",
srcs = ["scheduler_interface_test.go"],
srcs = [
"scheduler_interface_test.go",
"types_test.go",
],
library = ":go_default_library",
tags = ["automanaged"],
deps = ["//pkg/api/v1:go_default_library"],
deps = [
"//pkg/api/v1:go_default_library",
"//plugin/pkg/scheduler/schedulercache:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
],
)
filegroup(
...
...
plugin/pkg/scheduler/algorithm/types_test.go
0 → 100644
View file @
a5d86270
/*
Copyright 2017 The Kubernetes Authors.
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
algorithm
import
(
"testing"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache"
)
// EmptyMetadataProducer should returns a no-op MetadataProducer type.
func
TestEmptyMetadataProducer
(
t
*
testing
.
T
)
{
fakePod
:=
new
(
v1
.
Pod
)
fakeLabelSelector
:=
labels
.
SelectorFromSet
(
labels
.
Set
{
"foo"
:
"bar"
})
nodeNameToInfo
:=
map
[
string
]
*
schedulercache
.
NodeInfo
{
"2"
:
schedulercache
.
NewNodeInfo
(
fakePod
),
"1"
:
schedulercache
.
NewNodeInfo
(),
}
// Test EmptyMetadataProducer
metadata
:=
EmptyMetadataProducer
(
fakePod
,
nodeNameToInfo
)
if
metadata
!=
nil
{
t
.
Errorf
(
"failed to produce empty metadata: got %v, expected nil"
,
metadata
)
}
// Test EmptyControllerLister should return nill
controllerLister
:=
EmptyControllerLister
{}
nilController
,
nilError
:=
controllerLister
.
List
(
fakeLabelSelector
)
if
nilController
!=
nil
||
nilError
!=
nil
{
t
.
Errorf
(
"failed to produce empty controller lister: got %v, expected nil"
,
nilController
)
}
// Test GetPodControllers on empty controller lister should return nill
nilController
,
nilError
=
controllerLister
.
GetPodControllers
(
fakePod
)
if
nilController
!=
nil
||
nilError
!=
nil
{
t
.
Errorf
(
"failed to produce empty controller lister: got %v, expected nil"
,
nilController
)
}
// Test GetPodReplicaSets on empty replica sets should return nill
replicaSetLister
:=
EmptyReplicaSetLister
{}
nilRss
,
nilErrRss
:=
replicaSetLister
.
GetPodReplicaSets
(
fakePod
)
if
nilRss
!=
nil
||
nilErrRss
!=
nil
{
t
.
Errorf
(
"failed to produce empty replicaSetLister: got %v, expected nil"
,
nilRss
)
}
// Test GetPodStatefulSets on empty replica sets should return nill
statefulSetLister
:=
EmptyStatefulSetLister
{}
nilSSL
,
nilErrSSL
:=
statefulSetLister
.
GetPodStatefulSets
(
fakePod
)
if
nilSSL
!=
nil
||
nilErrSSL
!=
nil
{
t
.
Errorf
(
"failed to produce empty statefulSetLister: got %v, expected nil"
,
nilSSL
)
}
}
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