Set Operator Namespace for test
Reconcile expects that the PostgresOperatorNamespace be set so that the root
cert can be created. This test was failing because the namespace wasn't set.
@@ -44,6 +44,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"sigs.k8s.io/yaml"
+ "github.com/crunchydata/postgres-operator/internal/naming"
"github.com/crunchydata/postgres-operator/internal/patroni"
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1alpha1"
)
@@ -79,6 +80,9 @@ func TestReconcilerHandleDelete(t *testing.T) {
assert.NilError(t, cc.Create(ctx, ns))
t.Cleanup(func() { assert.Check(t, cc.Delete(ctx, ns)) })
+ // set the operator namespace variable
+ naming.PostgresOperatorNamespace = ns.Name
+
// TODO(cbandy): namespace rbac
assert.NilError(t, cc.Create(ctx, &v1.ServiceAccount{
ObjectMeta: metav1.ObjectMeta{Namespace: ns.Name, Name: "postgres-operator"},
