Skip to content

Commit 623587e

Browse files
committed
cpumanager: test: add missing helper
add back the missing AssertStateEqual helper; it is needed by some tests we still want to run. Signed-off-by: Francesco Romani <[email protected]>
1 parent be0fe3d commit 623587e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pkg/kubelet/cm/cpumanager/state/state_checkpoint_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package state
1818

1919
import (
2020
"os"
21+
"reflect"
2122
"strings"
2223
"testing"
2324

@@ -397,3 +398,17 @@ func TestCheckpointStateClear(t *testing.T) {
397398
})
398399
}
399400
}
401+
402+
func AssertStateEqual(t *testing.T, sf State, sm State) {
403+
cpusetSf := sf.GetDefaultCPUSet()
404+
cpusetSm := sm.GetDefaultCPUSet()
405+
if !cpusetSf.Equals(cpusetSm) {
406+
t.Errorf("State CPUSet mismatch. Have %v, want %v", cpusetSf, cpusetSm)
407+
}
408+
409+
cpuassignmentSf := sf.GetCPUAssignments()
410+
cpuassignmentSm := sm.GetCPUAssignments()
411+
if !reflect.DeepEqual(cpuassignmentSf, cpuassignmentSm) {
412+
t.Errorf("State CPU assignments mismatch. Have %s, want %s", cpuassignmentSf, cpuassignmentSm)
413+
}
414+
}

0 commit comments

Comments
 (0)