Decouple yaml based integration test from legacy test

- Move utilities or constants out so that both of them should be able
to run independently.
- Rename the legacy test so that it can eventually be deleted when the
perf dash changes is done
This commit is contained in:
Dave Chen
2020-03-13 18:00:34 +08:00
parent 2f85ff5067
commit 49283364bf
3 changed files with 18 additions and 14 deletions

View File

@@ -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"
@@ -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
)
@@ -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 {