Skip to content

Commit 1994190

Browse files
committed
fix unit-tests
1 parent aa368fa commit 1994190

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

percona/controller/pgbackup/testutils_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313

1414
"github.com/percona/percona-postgresql-operator/internal/naming"
1515
pNaming "github.com/percona/percona-postgresql-operator/percona/naming"
16+
pgv2 "github.com/percona/percona-postgresql-operator/pkg/apis/pgv2.percona.com/v2"
1617
v2 "github.com/percona/percona-postgresql-operator/pkg/apis/pgv2.percona.com/v2"
1718
"github.com/percona/percona-postgresql-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
1819
)
@@ -48,7 +49,9 @@ func buildFakeClient(ctx context.Context, cr *v2.PerconaPGCluster, objs ...clien
4849
objs = append(objs, dcs)
4950

5051
cl := new(fakeClient)
51-
cl.Client = fake.NewClientBuilder().WithScheme(s).WithObjects(objs...).WithStatusSubresource(objs...).Build()
52+
cl.Client = fake.NewClientBuilder().WithScheme(s).WithObjects(objs...).WithStatusSubresource(objs...).
53+
WithIndex(new(pgv2.PerconaPGBackup), pgv2.IndexFieldPGCluster, pgv2.PGClusterIndexerFunc).
54+
Build()
5255

5356
return cl, nil
5457
}

percona/controller/pgcluster/controller_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ var _ = Describe("Watching secrets", Ordered, func() {
671671
})
672672

673673
It("should reconcile 1 time", func() {
674-
Eventually(func() int { return getReconcileCount(crunchyR) }, time.Second*15, time.Millisecond*250).
674+
Eventually(func() int { return getReconcileCount(crunchyR) }, time.Second*20, time.Millisecond*250).
675675
Should(Equal(reconcileCount + 1))
676676
})
677677

@@ -692,7 +692,7 @@ var _ = Describe("Watching secrets", Ordered, func() {
692692
})
693693

694694
It("should reconcile 2 times", func() {
695-
Eventually(func() int { return getReconcileCount(crunchyR) }, time.Second*15, time.Millisecond*250).
695+
Eventually(func() int { return getReconcileCount(crunchyR) }, time.Second*20, time.Millisecond*250).
696696
Should(Equal(reconcileCount + 2))
697697
})
698698
})

percona/controller/pgcluster/testutils_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
pNaming "github.com/percona/percona-postgresql-operator/percona/naming"
2525
"github.com/percona/percona-postgresql-operator/percona/utils/registry"
2626
"github.com/percona/percona-postgresql-operator/percona/watcher"
27+
pgv2 "github.com/percona/percona-postgresql-operator/pkg/apis/pgv2.percona.com/v2"
2728
v2 "github.com/percona/percona-postgresql-operator/pkg/apis/pgv2.percona.com/v2"
2829
"github.com/percona/percona-postgresql-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
2930
)
@@ -207,7 +208,9 @@ func buildFakeClient(ctx context.Context, cr *v2.PerconaPGCluster, objs ...clien
207208
objs = append(objs, dcs)
208209

209210
cl := new(fakeClient)
210-
cl.Client = fake.NewClientBuilder().WithScheme(s).WithObjects(objs...).WithStatusSubresource(objs...).Build()
211+
cl.Client = fake.NewClientBuilder().WithScheme(s).WithObjects(objs...).WithStatusSubresource(objs...).
212+
WithIndex(new(pgv2.PerconaPGBackup), pgv2.IndexFieldPGCluster, pgv2.PGClusterIndexerFunc).
213+
Build()
211214

212215
return cl, nil
213216
}

percona/k8s/testutils_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515

1616
"github.com/percona/percona-postgresql-operator/internal/naming"
1717
pNaming "github.com/percona/percona-postgresql-operator/percona/naming"
18+
pgv2 "github.com/percona/percona-postgresql-operator/pkg/apis/pgv2.percona.com/v2"
1819
v2 "github.com/percona/percona-postgresql-operator/pkg/apis/pgv2.percona.com/v2"
1920
"github.com/percona/percona-postgresql-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
2021
)
@@ -61,7 +62,9 @@ func buildFakeClient(ctx context.Context, cr *v2.PerconaPGCluster, objs ...clien
6162
objs = append(objs, dcs)
6263

6364
cl := new(fakeClient)
64-
cl.Client = fake.NewClientBuilder().WithScheme(s).WithObjects(objs...).WithStatusSubresource(objs...).Build()
65+
cl.Client = fake.NewClientBuilder().WithScheme(s).WithObjects(objs...).WithStatusSubresource(objs...).
66+
WithIndex(new(pgv2.PerconaPGBackup), pgv2.IndexFieldPGCluster, pgv2.PGClusterIndexerFunc).
67+
Build()
6568

6669
return cl, nil
6770
}

0 commit comments

Comments
 (0)