diff --git a/test/integration/scheduler_perf/scheduler_perf.go b/test/integration/scheduler_perf/scheduler_perf.go index 321acfada02..4eb5bed9e19 100644 --- a/test/integration/scheduler_perf/scheduler_perf.go +++ b/test/integration/scheduler_perf/scheduler_perf.go @@ -29,6 +29,7 @@ import ( "os" "path" "regexp" + "runtime" "slices" "strings" "sync" @@ -42,7 +43,7 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/runtime" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/version" "k8s.io/apimachinery/pkg/util/wait" utilfeature "k8s.io/apiserver/pkg/util/feature" @@ -130,7 +131,7 @@ type FeatureGateFlag interface { func init() { f := featuregate.NewFeatureGate() - runtime.Must(logsapi.AddFeatureGates(f)) + utilruntime.Must(logsapi.AddFeatureGates(f)) LoggingFeatureGate = f LoggingConfig = logsapi.NewLoggingConfiguration() @@ -1457,6 +1458,10 @@ func checkEmptyInFlightEvents() error { func startCollectingMetrics(tCtx ktesting.TContext, collectorWG *sync.WaitGroup, podInformer coreinformers.PodInformer, mcc *metricsCollectorConfig, throughputErrorMargin float64, opIndex int, name string, namespaces []string, labelSelector map[string]string) (ktesting.TContext, []testDataCollector, error) { collectorCtx := ktesting.WithCancel(tCtx) workloadName := tCtx.Name() + + // Clean up memory usage from the initial setup phase. + runtime.GC() + // The first part is the same for each workload, therefore we can strip it. workloadName = workloadName[strings.Index(name, "/")+1:] collectors := getTestDataCollectors(podInformer, fmt.Sprintf("%s/%s", workloadName, name), namespaces, labelSelector, mcc, throughputErrorMargin)