Skip to content

Commit 479b300

Browse files
committed
Fix unit tests
1 parent 7378b5e commit 479b300

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

pkg/kubelet/kuberuntime/kuberuntime_manager_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,11 @@ func verifyActions(t *testing.T, expected, actual *podActions, desc string) {
12601260
actual.ContainersToKill[k] = info
12611261
}
12621262
}
1263+
1264+
if expected.ContainersToUpdate == nil && actual.ContainersToUpdate != nil {
1265+
// No need to distinguish empty and nil maps for the test.
1266+
expected.ContainersToUpdate = map[v1.ResourceName][]containerToUpdateInfo{}
1267+
}
12631268
assert.Equal(t, expected, actual, desc)
12641269
}
12651270

pkg/kubelet/status/status_manager.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ func NewManager(kubeClient clientset.Interface, podManager PodManager, podDeleti
179179
podDeletionSafety: podDeletionSafety,
180180
podStartupLatencyHelper: podStartupLatencyHelper,
181181
stateFileDirectory: stateFileDirectory,
182+
state: state.NewNoopStateCheckpoint(),
182183
}
183184
}
184185

@@ -202,9 +203,6 @@ func isPodStatusByKubeletEqual(oldStatus, status *v1.PodStatus) bool {
202203
}
203204

204205
func (m *manager) Start() {
205-
// Initialize m.state to no-op state checkpoint manager
206-
m.state = state.NewNoopStateCheckpoint()
207-
208206
// Create pod allocation checkpoint manager even if client is nil so as to allow local get/set of AllocatedResources & Resize
209207
if utilfeature.DefaultFeatureGate.Enabled(features.InPlacePodVerticalScaling) {
210208
stateImpl, err := state.NewStateCheckpoint(m.stateFileDirectory, podStatusManagerStateFile)

0 commit comments

Comments
 (0)