Merge pull request #8007 from omerap12/fixed-lint-context

fix lint: update tests with context
This commit is contained in:
Kubernetes Prow Robot 2025-04-03 07:56:47 -07:00 committed by GitHub
commit 3e92831089
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 2 deletions

View File

@ -600,11 +600,12 @@ type fakeMetricsClient struct {
snapshots []*metrics.ContainerMetricsSnapshot
}
func (m fakeMetricsClient) GetContainersMetrics() ([]*metrics.ContainerMetricsSnapshot, error) {
func (m fakeMetricsClient) GetContainersMetrics(_ context.Context) ([]*metrics.ContainerMetricsSnapshot, error) {
return m.snapshots, nil
}
func TestClusterStateFeeder_LoadRealTimeMetrics(t *testing.T) {
_, tctx := ktesting.NewTestContext(t)
namespaceName := "test-namespace"
podID := model.PodID{Namespace: namespaceName, PodName: "Pod"}
regularContainer1 := model.ContainerID{PodID: podID, ContainerName: "Container1"}
@ -639,7 +640,7 @@ func TestClusterStateFeeder_LoadRealTimeMetrics(t *testing.T) {
metricsClient: fakeMetricsClient{snapshots: containerMetricsSnapshots},
}
feeder.LoadRealTimeMetrics()
feeder.LoadRealTimeMetrics(tctx)
assert.Equal(t, 2, len(clusterState.addedSamples))