Skip to content

Commit 5317a31

Browse files
authored
Merge pull request kubernetes#89106 from chendave/refactor
Decouple yaml based integration test from legacy test
2 parents 3842a92 + 4928336 commit 5317a31

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

test/integration/scheduler_perf/BUILD

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ go_library(
1515
importpath = "k8s.io/kubernetes/test/integration/scheduler_perf",
1616
deps = [
1717
"//staging/src/k8s.io/api/core/v1:go_default_library",
18+
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
1819
"//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library",
1920
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
2021
"//staging/src/k8s.io/client-go/informers/core/v1:go_default_library",
@@ -23,6 +24,7 @@ go_library(
2324
"//staging/src/k8s.io/component-base/metrics/legacyregistry:go_default_library",
2425
"//staging/src/k8s.io/component-base/metrics/testutil:go_default_library",
2526
"//test/integration/util:go_default_library",
27+
"//test/utils:go_default_library",
2628
"//vendor/k8s.io/klog:go_default_library",
2729
],
2830
)
@@ -32,7 +34,7 @@ go_test(
3234
size = "large",
3335
srcs = [
3436
"main_test.go",
35-
"scheduler_bench_test.go",
37+
"scheduler_perf_legacy_test.go",
3638
"scheduler_perf_test.go",
3739
"scheduler_test.go",
3840
],

test/integration/scheduler_perf/scheduler_bench_test.go renamed to test/integration/scheduler_perf/scheduler_perf_legacy_test.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ var (
5050
{nodes: 600, existingPods: 10000, minPods: 1000},
5151
{nodes: 5000, existingPods: 5000, minPods: 1000},
5252
}
53-
testNamespace = "sched-test"
54-
setupNamespace = "sched-setup"
5553
)
5654

5755
// BenchmarkScheduling benchmarks the scheduling rate when the cluster has
@@ -524,17 +522,6 @@ func makeBasePodWithSecret() *v1.Pod {
524522
return basePod
525523
}
526524

527-
// makeBasePod creates a Pod object to be used as a template.
528-
func makeBasePod() *v1.Pod {
529-
basePod := &v1.Pod{
530-
ObjectMeta: metav1.ObjectMeta{
531-
GenerateName: "pod-",
532-
},
533-
Spec: testutils.MakePodSpec(),
534-
}
535-
return basePod
536-
}
537-
538525
func makeBasePersistentVolumeClaim() *v1.PersistentVolumeClaim {
539526
return &v1.PersistentVolumeClaim{
540527
ObjectMeta: metav1.ObjectMeta{

test/integration/scheduler_perf/util.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"time"
2828

2929
v1 "k8s.io/api/core/v1"
30+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3031
"k8s.io/apimachinery/pkg/labels"
3132
"k8s.io/apimachinery/pkg/runtime/schema"
3233
coreinformers "k8s.io/client-go/informers/core/v1"
@@ -36,10 +37,13 @@ import (
3637
"k8s.io/component-base/metrics/testutil"
3738
"k8s.io/klog"
3839
"k8s.io/kubernetes/test/integration/util"
40+
testutils "k8s.io/kubernetes/test/utils"
3941
)
4042

4143
const (
4244
dateFormat = "2006-01-02T15:04:05Z"
45+
testNamespace = "sched-test"
46+
setupNamespace = "sched-setup"
4347
throughputSampleFrequency = time.Second
4448
)
4549

@@ -106,6 +110,17 @@ type DataItems struct {
106110
DataItems []DataItem `json:"dataItems"`
107111
}
108112

113+
// makeBasePod creates a Pod object to be used as a template.
114+
func makeBasePod() *v1.Pod {
115+
basePod := &v1.Pod{
116+
ObjectMeta: metav1.ObjectMeta{
117+
GenerateName: "pod-",
118+
},
119+
Spec: testutils.MakePodSpec(),
120+
}
121+
return basePod
122+
}
123+
109124
func dataItems2JSONFile(dataItems DataItems, namePrefix string) error {
110125
b, err := json.Marshal(dataItems)
111126
if err != nil {

0 commit comments

Comments
 (0)