Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decouple yaml based integration test from legacy test #89106

Merged
merged 1 commit into from
Mar 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion test/integration/scheduler_perf/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ go_library(
importpath = "k8s.io/kubernetes/test/integration/scheduler_perf",
deps = [
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//staging/src/k8s.io/client-go/informers/core/v1:go_default_library",
Expand All @@ -23,6 +24,7 @@ go_library(
"//staging/src/k8s.io/component-base/metrics/legacyregistry:go_default_library",
"//staging/src/k8s.io/component-base/metrics/testutil:go_default_library",
"//test/integration/util:go_default_library",
"//test/utils:go_default_library",
"//vendor/k8s.io/klog:go_default_library",
],
)
Expand All @@ -32,7 +34,7 @@ go_test(
size = "large",
srcs = [
"main_test.go",
"scheduler_bench_test.go",
"scheduler_perf_legacy_test.go",
"scheduler_perf_test.go",
"scheduler_test.go",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ var (
{nodes: 600, existingPods: 10000, minPods: 1000},
{nodes: 5000, existingPods: 5000, minPods: 1000},
}
testNamespace = "sched-test"
setupNamespace = "sched-setup"
)

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

// makeBasePod creates a Pod object to be used as a template.
func makeBasePod() *v1.Pod {
basePod := &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "pod-",
},
Spec: testutils.MakePodSpec(),
}
return basePod
}

func makeBasePersistentVolumeClaim() *v1.PersistentVolumeClaim {
return &v1.PersistentVolumeClaim{
ObjectMeta: metav1.ObjectMeta{
Expand Down
15 changes: 15 additions & 0 deletions test/integration/scheduler_perf/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"time"

v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime/schema"
coreinformers "k8s.io/client-go/informers/core/v1"
Expand All @@ -36,10 +37,13 @@ import (
"k8s.io/component-base/metrics/testutil"
"k8s.io/klog"
"k8s.io/kubernetes/test/integration/util"
testutils "k8s.io/kubernetes/test/utils"
)

const (
dateFormat = "2006-01-02T15:04:05Z"
testNamespace = "sched-test"
setupNamespace = "sched-setup"
throughputSampleFrequency = time.Second
)

Expand Down Expand Up @@ -106,6 +110,17 @@ type DataItems struct {
DataItems []DataItem `json:"dataItems"`
}

// makeBasePod creates a Pod object to be used as a template.
func makeBasePod() *v1.Pod {
basePod := &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "pod-",
},
Spec: testutils.MakePodSpec(),
}
return basePod
}

func dataItems2JSONFile(dataItems DataItems, namePrefix string) error {
b, err := json.Marshal(dataItems)
if err != nil {
Expand Down