Skip to content

Commit 45545ba

Browse files
committed
added recorder obj to pg cluster and database reconciler instances
1 parent 43de5a3 commit 45545ba

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

internal/controller/postgrescluster_controller_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
apierrors "k8s.io/apimachinery/pkg/api/errors"
2424
"k8s.io/apimachinery/pkg/api/meta"
2525
"k8s.io/apimachinery/pkg/api/resource"
26+
"k8s.io/client-go/tools/record"
2627

2728
cnpgv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1"
2829
. "github.com/onsi/ginkgo/v2"
@@ -121,8 +122,9 @@ var _ = Describe("PostgresCluster Controller", func() {
121122
}
122123

123124
reconciler = &PostgresClusterReconciler{
124-
Client: k8sClient,
125-
Scheme: k8sClient.Scheme(),
125+
Client: k8sClient,
126+
Scheme: k8sClient.Scheme(),
127+
Recorder: record.NewFakeRecorder(100),
126128
}
127129
req = reconcile.Request{NamespacedName: types.NamespacedName{Name: clusterName, Namespace: namespace}}
128130
})

internal/controller/postgresdatabase_controller_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3333
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
3434
"k8s.io/apimachinery/pkg/types"
35+
"k8s.io/client-go/tools/record"
3536
ctrl "sigs.k8s.io/controller-runtime"
3637
"sigs.k8s.io/controller-runtime/pkg/client"
3738
"sigs.k8s.io/controller-runtime/pkg/reconcile"
@@ -41,8 +42,9 @@ const postgresDatabaseFinalizer = "postgresdatabases.enterprise.splunk.com/final
4142

4243
func reconcilePostgresDatabase(ctx context.Context, nn types.NamespacedName) (ctrl.Result, error) {
4344
reconciler := &PostgresDatabaseReconciler{
44-
Client: k8sClient,
45-
Scheme: k8sClient.Scheme(),
45+
Client: k8sClient,
46+
Scheme: k8sClient.Scheme(),
47+
Recorder: record.NewFakeRecorder(100),
4648
}
4749
return reconciler.Reconcile(ctx, reconcile.Request{NamespacedName: nn})
4850
}

0 commit comments

Comments
 (0)