From 623587ec8b5bf1cf34813bcf8126cfee92f2cb0d Mon Sep 17 00:00:00 2001 From: Francesco Romani Date: Tue, 7 Apr 2020 16:59:07 +0200 Subject: [PATCH] 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 --- .../cm/cpumanager/state/state_checkpoint_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkg/kubelet/cm/cpumanager/state/state_checkpoint_test.go b/pkg/kubelet/cm/cpumanager/state/state_checkpoint_test.go index 789f9674c2b..7fbaace165d 100644 --- a/pkg/kubelet/cm/cpumanager/state/state_checkpoint_test.go +++ b/pkg/kubelet/cm/cpumanager/state/state_checkpoint_test.go @@ -18,6 +18,7 @@ package state import ( "os" + "reflect" "strings" "testing" @@ -397,3 +398,17 @@ func TestCheckpointStateClear(t *testing.T) { }) } } + +func AssertStateEqual(t *testing.T, sf State, sm State) { + cpusetSf := sf.GetDefaultCPUSet() + cpusetSm := sm.GetDefaultCPUSet() + if !cpusetSf.Equals(cpusetSm) { + t.Errorf("State CPUSet mismatch. Have %v, want %v", cpusetSf, cpusetSm) + } + + cpuassignmentSf := sf.GetCPUAssignments() + cpuassignmentSm := sm.GetCPUAssignments() + if !reflect.DeepEqual(cpuassignmentSf, cpuassignmentSm) { + t.Errorf("State CPU assignments mismatch. Have %s, want %s", cpuassignmentSf, cpuassignmentSm) + } +}