mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-12-15 20:37:39 +00:00
kubelet checkpoint: refactor state memory
refactor state mem constructor to accept the state as parameter and SetPodAllocation to update a single pod.
This commit is contained in:
@@ -32,7 +32,7 @@ const testCheckpoint = "pod_status_manager_state"
|
||||
|
||||
func newTestStateCheckpoint(t *testing.T) *stateCheckpoint {
|
||||
testingDir := getTestDir(t)
|
||||
cache := NewStateMemory()
|
||||
cache := NewStateMemory(PodResourceAllocation{}, PodResizeStatus{})
|
||||
checkpointManager, err := checkpointmanager.NewCheckpointManager(testingDir)
|
||||
require.NoError(t, err, "failed to create checkpoint manager")
|
||||
checkpointName := "pod_state_checkpoint"
|
||||
@@ -110,8 +110,10 @@ func Test_stateCheckpoint_storeState(t *testing.T) {
|
||||
originalSC, err := NewStateCheckpoint(testDir, testCheckpoint)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = originalSC.SetPodResourceAllocation(tt.args.podResourceAllocation)
|
||||
require.NoError(t, err)
|
||||
for podUID, alloc := range tt.args.podResourceAllocation {
|
||||
err = originalSC.SetPodResourceAllocation(podUID, alloc)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
actual := originalSC.GetPodResourceAllocation()
|
||||
verifyPodResourceAllocation(t, &tt.args.podResourceAllocation, &actual, "stored pod resource allocation is not equal to original pod resource allocation")
|
||||
|
||||
Reference in New Issue
Block a user