Fix UT
This commit is contained in:
parent
89e2405b8f
commit
8c9840c5da
|
|
@ -3988,6 +3988,9 @@ func TestGenerateCapabilities(t *testing.T) {
|
||||||
func TestTopologySpreadConstraints(t *testing.T) {
|
func TestTopologySpreadConstraints(t *testing.T) {
|
||||||
clusterName := "acid-test-cluster"
|
clusterName := "acid-test-cluster"
|
||||||
namespace := "default"
|
namespace := "default"
|
||||||
|
labelSelector := &metav1.LabelSelector{
|
||||||
|
MatchLabels: cluster.labelsSet(true),
|
||||||
|
}
|
||||||
|
|
||||||
pg := acidv1.Postgresql{
|
pg := acidv1.Postgresql{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
|
@ -4008,9 +4011,7 @@ func TestTopologySpreadConstraints(t *testing.T) {
|
||||||
MaxSkew: 1,
|
MaxSkew: 1,
|
||||||
TopologyKey: "topology.kubernetes.io/zone",
|
TopologyKey: "topology.kubernetes.io/zone",
|
||||||
WhenUnsatisfiable: v1.DoNotSchedule,
|
WhenUnsatisfiable: v1.DoNotSchedule,
|
||||||
LabelSelector: &metav1.LabelSelector{
|
LabelSelector: labelSelector,
|
||||||
MatchLabels: cluster.labelsSet(true),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -4028,14 +4029,11 @@ func TestTopologySpreadConstraints(t *testing.T) {
|
||||||
|
|
||||||
s, err := cluster.generateStatefulSet(&pg.Spec)
|
s, err := cluster.generateStatefulSet(&pg.Spec)
|
||||||
assert.NoError(t, err)
|
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),
|
||||||
MaxSkew: int32(1),
|
TopologyKey: "topology.kubernetes.io/zone",
|
||||||
TopologyKey: "topology.kubernetes.io/zone",
|
WhenUnsatisfiable: v1.DoNotSchedule,
|
||||||
WhenUnsatisfiable: v1.DoNotSchedule,
|
LabelSelector: labelSelector,
|
||||||
LabelSelector: &metav1.LabelSelector{
|
},
|
||||||
MatchLabels: cluster.labelsSet(true),
|
)
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue