Skip to content

Commit b0f4047

Browse files
authored
Merge pull request #502 from mrkisaolamb/set-correct-replicas
In SimulateReady methods we should set correct replica number
2 parents d6e0308 + 79f6ee3 commit b0f4047

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

modules/common/test/helpers/deployment.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ func (tc *TestHelper) SimulateDeploymentReadyWithPods(name types.NamespacedName,
139139

140140
gomega.Eventually(func(g gomega.Gomega) {
141141
depl := tc.GetDeployment(name)
142-
depl.Status.Replicas = 1
143-
depl.Status.ReadyReplicas = 1
142+
depl.Status.Replicas = *depl.Spec.Replicas
143+
depl.Status.ReadyReplicas = *depl.Spec.Replicas
144144
depl.Status.ObservedGeneration = depl.Generation
145145
g.Expect(tc.K8sClient.Status().Update(tc.Ctx, depl)).To(gomega.Succeed())
146146

modules/common/test/helpers/statefulset.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ func (tc *TestHelper) GetStatefulSet(name types.NamespacedName) *appsv1.Stateful
4747
func (tc *TestHelper) SimulateStatefulSetReplicaReady(name types.NamespacedName) {
4848
gomega.Eventually(func(g gomega.Gomega) {
4949
ss := tc.GetStatefulSet(name)
50-
ss.Status.Replicas = 1
51-
ss.Status.ReadyReplicas = 1
50+
ss.Status.Replicas = *ss.Spec.Replicas
51+
ss.Status.ReadyReplicas = *ss.Spec.Replicas
5252
ss.Status.ObservedGeneration = ss.Generation
5353
g.Expect(tc.K8sClient.Status().Update(tc.Ctx, ss)).To(gomega.Succeed())
5454

@@ -108,8 +108,8 @@ func (tc *TestHelper) SimulateStatefulSetReplicaReadyWithPods(name types.Namespa
108108

109109
gomega.Eventually(func(g gomega.Gomega) {
110110
ss := tc.GetStatefulSet(name)
111-
ss.Status.Replicas = 1
112-
ss.Status.ReadyReplicas = 1
111+
ss.Status.Replicas = *ss.Spec.Replicas
112+
ss.Status.ReadyReplicas = *ss.Spec.Replicas
113113
ss.Status.ObservedGeneration = ss.Generation
114114
g.Expect(tc.K8sClient.Status().Update(tc.Ctx, ss)).To(gomega.Succeed())
115115

0 commit comments

Comments
 (0)