Correct the assert with the list of constraints.

This commit is contained in:
Trung Minh Lai 2024-11-18 14:23:36 +07:00 committed by laiminhtrung1997
parent 63f865776e
commit 89e2405b8f
1 changed files with 8 additions and 6 deletions

View File

@ -4028,12 +4028,14 @@ func TestTopologySpreadConstraints(t *testing.T) {
s, err := cluster.generateStatefulSet(&pg.Spec)
assert.NoError(t, err)
assert.Contains(t, s.Spec.Template.Spec.TopologySpreadConstraints, v1.TopologySpreadConstraint{
assert.Contains(t, s.Spec.Template.Spec.TopologySpreadConstraints, []v1.TopologySpreadConstraint{
{
MaxSkew: int32(1),
TopologyKey: "topology.kubernetes.io/zone",
WhenUnsatisfiable: v1.DoNotSchedule,
LabelSelector: &metav1.LabelSelector{
MatchLabels: cluster.labelsSet(true),
},
},
})
}