Skip to content

Commit eb08b6f

Browse files
committed
Improve the pgBackRest repo host RBAC test
This commit updates the pgBackRest repo host RBAC test to ensure desired annotations are passed as expected.
1 parent d0a80f0 commit eb08b6f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

internal/controller/postgrescluster/pgbackrest_test.go

+10-4
Original file line numberDiff line numberDiff line change
@@ -727,10 +727,6 @@ func TestReconcilePGBackRestRBAC(t *testing.T) {
727727
}
728728

729729
func TestReconcileRepoHostRBAC(t *testing.T) {
730-
// Garbage collector cleans up test resources before the test completes
731-
if strings.EqualFold(os.Getenv("USE_EXISTING_CLUSTER"), "true") {
732-
t.Skip("USE_EXISTING_CLUSTER: Test fails due to garbage collection")
733-
}
734730

735731
ctx := context.Background()
736732
_, tClient := setupKubernetes(t)
@@ -745,6 +741,15 @@ func TestReconcileRepoHostRBAC(t *testing.T) {
745741

746742
// create a PostgresCluster to test with
747743
postgresCluster := fakePostgresCluster(clusterName, ns.GetName(), clusterUID, true)
744+
// create an example AWS ARN annotation
745+
annotations := map[string]string{
746+
"eks.amazonaws.com/role-arn": "arn:aws:iam::123456768901:role/allow_bucket_access",
747+
}
748+
// set the annotation on the cluster
749+
postgresCluster.Spec.Metadata = &v1beta1.Metadata{
750+
Annotations: annotations,
751+
}
752+
748753
postgresCluster.Status.PGBackRest = &v1beta1.PGBackRestStatus{
749754
Repos: []v1beta1.RepoStatus{{Name: "repo1", StanzaCreated: false}},
750755
}
@@ -760,6 +765,7 @@ func TestReconcileRepoHostRBAC(t *testing.T) {
760765
Namespace: postgresCluster.GetNamespace(),
761766
}, sa)
762767
assert.NilError(t, err)
768+
assert.DeepEqual(t, sa.Annotations, annotations)
763769
}
764770

765771
func TestReconcileStanzaCreate(t *testing.T) {

0 commit comments

Comments
 (0)