Skip to content

Commit 112ceae

Browse files
committed
fix test for pdb changes
1 parent 64544e5 commit 112ceae

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pkg/cluster/k8sres_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2238,7 +2238,7 @@ func TestGeneratePodDisruptionBudget(t *testing.T) {
22382238
// With multiple instances.
22392239
{
22402240
New(
2241-
Config{OpConfig: config.Config{Resources: config.Resources{ClusterNameLabel: "cluster.cpo.opensource.cybertec.at/name", PodRoleLabel: "member.cpo.opensource.cybertec.at/role"}, PDBNameFormat: "postgres-{cluster}-pdb"}},
2241+
Config{OpConfig: config.Config{Resources: config.Resources{ClusterNameLabel: "cluster.cpo.opensource.cybertec.at/name", PodRoleLabel: "member.cpo.opensource.cybertec.at/type"}, PDBNameFormat: "postgres-{cluster}-pdb"}},
22422242
k8sutil.KubernetesClient{},
22432243
cpov1.Postgresql{
22442244
ObjectMeta: metav1.ObjectMeta{Name: "myapp-database", Namespace: "myapp"},
@@ -2254,15 +2254,15 @@ func TestGeneratePodDisruptionBudget(t *testing.T) {
22542254
Spec: policyv1.PodDisruptionBudgetSpec{
22552255
MinAvailable: util.ToIntStr(1),
22562256
Selector: &metav1.LabelSelector{
2257-
MatchLabels: map[string]string{"member.cpo.opensource.cybertec.at/role": "master", "cluster.cpo.opensource.cybertec.at/name": "myapp-database"},
2257+
MatchLabels: map[string]string{"member.cpo.opensource.cybertec.at/type": "postgresql", "cluster.cpo.opensource.cybertec.at/name": "myapp-database"},
22582258
},
22592259
},
22602260
},
22612261
},
22622262
// With zero instances.
22632263
{
22642264
New(
2265-
Config{OpConfig: config.Config{Resources: config.Resources{ClusterNameLabel: "cluster.cpo.opensource.cybertec.at/name", PodRoleLabel: "member.cpo.opensource.cybertec.at/role"}, PDBNameFormat: "postgres-{cluster}-pdb"}},
2265+
Config{OpConfig: config.Config{Resources: config.Resources{ClusterNameLabel: "cluster.cpo.opensource.cybertec.at/name", PodRoleLabel: "member.cpo.opensource.cybertec.at/type"}, PDBNameFormat: "postgres-{cluster}-pdb"}},
22662266
k8sutil.KubernetesClient{},
22672267
cpov1.Postgresql{
22682268
ObjectMeta: metav1.ObjectMeta{Name: "myapp-database", Namespace: "myapp"},
@@ -2278,15 +2278,15 @@ func TestGeneratePodDisruptionBudget(t *testing.T) {
22782278
Spec: policyv1.PodDisruptionBudgetSpec{
22792279
MinAvailable: util.ToIntStr(0),
22802280
Selector: &metav1.LabelSelector{
2281-
MatchLabels: map[string]string{"member.cpo.opensource.cybertec.at/role": "master", "cluster.cpo.opensource.cybertec.at/name": "myapp-database"},
2281+
MatchLabels: map[string]string{"member.cpo.opensource.cybertec.at/type": "postgresql", "cluster.cpo.opensource.cybertec.at/name": "myapp-database"},
22822282
},
22832283
},
22842284
},
22852285
},
22862286
// With PodDisruptionBudget disabled.
22872287
{
22882288
New(
2289-
Config{OpConfig: config.Config{Resources: config.Resources{ClusterNameLabel: "cluster.cpo.opensource.cybertec.at/name", PodRoleLabel: "member.cpo.opensource.cybertec.at/role"}, PDBNameFormat: "postgres-{cluster}-pdb", EnablePodDisruptionBudget: util.False()}},
2289+
Config{OpConfig: config.Config{Resources: config.Resources{ClusterNameLabel: "cluster.cpo.opensource.cybertec.at/name", PodRoleLabel: "member.cpo.opensource.cybertec.at/type"}, PDBNameFormat: "postgres-{cluster}-pdb", EnablePodDisruptionBudget: util.False()}},
22902290
k8sutil.KubernetesClient{},
22912291
cpov1.Postgresql{
22922292
ObjectMeta: metav1.ObjectMeta{Name: "myapp-database", Namespace: "myapp"},
@@ -2302,15 +2302,15 @@ func TestGeneratePodDisruptionBudget(t *testing.T) {
23022302
Spec: policyv1.PodDisruptionBudgetSpec{
23032303
MinAvailable: util.ToIntStr(0),
23042304
Selector: &metav1.LabelSelector{
2305-
MatchLabels: map[string]string{"member.cpo.opensource.cybertec.at/role": "master", "cluster.cpo.opensource.cybertec.at/name": "myapp-database"},
2305+
MatchLabels: map[string]string{"member.cpo.opensource.cybertec.at/type": "postgresql", "cluster.cpo.opensource.cybertec.at/name": "myapp-database"},
23062306
},
23072307
},
23082308
},
23092309
},
23102310
// With non-default PDBNameFormat and PodDisruptionBudget explicitly enabled.
23112311
{
23122312
New(
2313-
Config{OpConfig: config.Config{Resources: config.Resources{ClusterNameLabel: "cluster.cpo.opensource.cybertec.at/name", PodRoleLabel: "member.cpo.opensource.cybertec.at/role"}, PDBNameFormat: "postgres-{cluster}-databass-budget", EnablePodDisruptionBudget: util.True()}},
2313+
Config{OpConfig: config.Config{Resources: config.Resources{ClusterNameLabel: "cluster.cpo.opensource.cybertec.at/name", PodRoleLabel: "member.cpo.opensource.cybertec.at/type"}, PDBNameFormat: "postgres-{cluster}-databass-budget", EnablePodDisruptionBudget: util.True()}},
23142314
k8sutil.KubernetesClient{},
23152315
cpov1.Postgresql{
23162316
ObjectMeta: metav1.ObjectMeta{Name: "myapp-database", Namespace: "myapp"},
@@ -2326,7 +2326,7 @@ func TestGeneratePodDisruptionBudget(t *testing.T) {
23262326
Spec: policyv1.PodDisruptionBudgetSpec{
23272327
MinAvailable: util.ToIntStr(1),
23282328
Selector: &metav1.LabelSelector{
2329-
MatchLabels: map[string]string{"member.cpo.opensource.cybertec.at/role": "master", "cluster.cpo.opensource.cybertec.at/name": "myapp-database"},
2329+
MatchLabels: map[string]string{"member.cpo.opensource.cybertec.at/type": "postgresql", "cluster.cpo.opensource.cybertec.at/name": "myapp-database"},
23302330
},
23312331
},
23322332
},

0 commit comments

Comments
 (0)