Skip to content

Commit 404a4fc

Browse files
committed
Show number ready instead of full instance yaml
1 parent f475f56 commit 404a4fc

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

internal/controller/postgrescluster/delete_test.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ func TestReconcilerHandleDelete(t *testing.T) {
227227

228228
// Continue until instances are healthy.
229229
var instances []appsv1.StatefulSet
230+
var ready int32
230231
assert.NilError(t, wait.Poll(time.Second, Scale(time.Minute), func() (bool, error) {
231232
mustReconcile(t, cluster)
232233

@@ -242,12 +243,12 @@ func TestReconcilerHandleDelete(t *testing.T) {
242243

243244
instances = list.Items
244245

245-
ready := int32(0)
246+
ready = int32(0)
246247
for i := range instances {
247248
ready += instances[i].Status.ReadyReplicas
248249
}
249250
return ready >= test.waitForRunningInstances, nil
250-
}), "expected %v instances to be ready, got:\n%+v", test.waitForRunningInstances, instances)
251+
}), "expected %v instances to be ready, got:\n%v", test.waitForRunningInstances, ready)
251252

252253
if test.beforeDelete != nil {
253254
test.beforeDelete(t, cluster)
@@ -459,6 +460,7 @@ func TestReconcilerHandleDeleteNamespace(t *testing.T) {
459460
})
460461

461462
var instances []appsv1.StatefulSet
463+
var ready int32
462464
assert.NilError(t, wait.Poll(time.Second, Scale(time.Minute), func() (bool, error) {
463465
list := appsv1.StatefulSetList{}
464466
selector, err := labels.Parse(strings.Join([]string{
@@ -472,12 +474,12 @@ func TestReconcilerHandleDeleteNamespace(t *testing.T) {
472474

473475
instances = list.Items
474476

475-
ready := 0
477+
ready = 0
476478
for i := range instances {
477-
ready += int(instances[i].Status.ReadyReplicas)
479+
ready += instances[i].Status.ReadyReplicas
478480
}
479481
return ready >= 2, nil
480-
}), "expected instances to be ready, got:\n%+v", instances)
482+
}), "expected 2 instances to be ready, got:\n%v", ready)
481483

482484
// Delete the namespace.
483485
assert.NilError(t, cc.Delete(ctx, ns))

internal/controller/postgrescluster/scale_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ func TestScaleDown(t *testing.T) {
203203

204204
// Continue until instances are healthy.
205205
var instances []appsv1.StatefulSet
206+
var ready int32
206207
assert.NilError(t, wait.Poll(time.Second, Scale(time.Minute), func() (bool, error) {
207208
mustReconcile(t, cluster)
208209

@@ -218,12 +219,12 @@ func TestScaleDown(t *testing.T) {
218219

219220
instances = list.Items
220221

221-
ready := int32(0)
222+
ready = int32(0)
222223
for i := range instances {
223224
ready += instances[i].Status.ReadyReplicas
224225
}
225226
return ready == test.createRunningInstances, nil
226-
}), "expected %v instances to be ready, got:\n%+v", test.createRunningInstances, instances)
227+
}), "expected %v instances to be ready, got:\n%+v", test.createRunningInstances, ready)
227228

228229
if test.primaryTest != nil {
229230
// Grab the old primary name to use later

0 commit comments

Comments
 (0)