Fix UT
This commit is contained in:
parent
ecc16d676f
commit
6f2689c026
|
|
@ -4275,6 +4275,9 @@ func TestGenerateCapabilities(t *testing.T) {
|
|||
func TestTopologySpreadConstraints(t *testing.T) {
|
||||
clusterName := "acid-test-cluster"
|
||||
namespace := "default"
|
||||
labelSelector := &metav1.LabelSelector{
|
||||
MatchLabels: cluster.labelsSet(true),
|
||||
}
|
||||
|
||||
pg := acidv1.Postgresql{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
|
|
@ -4295,9 +4298,7 @@ func TestTopologySpreadConstraints(t *testing.T) {
|
|||
MaxSkew: 1,
|
||||
TopologyKey: "topology.kubernetes.io/zone",
|
||||
WhenUnsatisfiable: v1.DoNotSchedule,
|
||||
LabelSelector: &metav1.LabelSelector{
|
||||
MatchLabels: cluster.labelsSet(true),
|
||||
},
|
||||
LabelSelector: labelSelector,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -4315,14 +4316,11 @@ 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{
|
||||
{
|
||||
MaxSkew: int32(1),
|
||||
TopologyKey: "topology.kubernetes.io/zone",
|
||||
WhenUnsatisfiable: v1.DoNotSchedule,
|
||||
LabelSelector: &metav1.LabelSelector{
|
||||
MatchLabels: cluster.labelsSet(true),
|
||||
},
|
||||
},
|
||||
})
|
||||
assert.Contains(t, s.Spec.Template.Spec.TopologySpreadConstraints, v1.TopologySpreadConstraint{
|
||||
MaxSkew: int32(1),
|
||||
TopologyKey: "topology.kubernetes.io/zone",
|
||||
WhenUnsatisfiable: v1.DoNotSchedule,
|
||||
LabelSelector: labelSelector,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue