mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 04:06:03 +00:00
Update unit tests for TopologyHints - Topology Manager Policies
This commit is contained in:
parent
e82fa41fb2
commit
ef9baf313d
@ -23,27 +23,25 @@ import (
|
||||
func TestCanAdmitPodResult1(t *testing.T) {
|
||||
tcases := []struct {
|
||||
name string
|
||||
affinity bool
|
||||
admit bool
|
||||
expected bool
|
||||
}{
|
||||
{
|
||||
name: "Affinity is set to false in topology hints",
|
||||
affinity: false,
|
||||
admit: false,
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: "Affinity is set to true in topology hints",
|
||||
affinity: true,
|
||||
admit: true,
|
||||
expected: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tcases {
|
||||
policy := NewPreferredPolicy()
|
||||
hints := TopologyHints{
|
||||
Affinity: tc.affinity,
|
||||
}
|
||||
result := policy.CanAdmitPodResult(hints)
|
||||
admit := tc.admit
|
||||
result := policy.CanAdmitPodResult(admit)
|
||||
|
||||
if result.Admit != tc.expected {
|
||||
t.Errorf("Expected Admit field in result to be %t, got %t", tc.expected, result.Admit)
|
||||
|
@ -23,27 +23,25 @@ import (
|
||||
func TestCanAdmitPodResult(t *testing.T) {
|
||||
tcases := []struct {
|
||||
name string
|
||||
affinity bool
|
||||
admit bool
|
||||
expected bool
|
||||
}{
|
||||
{
|
||||
name: "Affinity is set to false in topology hints",
|
||||
affinity: false,
|
||||
admit: false,
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
name: "Affinity is set to true in topology hints",
|
||||
affinity: true,
|
||||
admit: true,
|
||||
expected: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tcases {
|
||||
policy := NewStrictPolicy()
|
||||
hints := TopologyHints{
|
||||
Affinity: tc.affinity,
|
||||
}
|
||||
result := policy.CanAdmitPodResult(hints)
|
||||
admit := tc.admit
|
||||
result := policy.CanAdmitPodResult(admit)
|
||||
|
||||
if result.Admit != tc.expected {
|
||||
t.Errorf("Expected Admit field in result to be %t, got %t", tc.expected, result.Admit)
|
||||
|
Loading…
Reference in New Issue
Block a user