From 67577f392746c51d0391fb7a0efb089cdf23c39a Mon Sep 17 00:00:00 2001 From: "Maximilian Blatt (external expert on behalf of DB Netz)" Date: Wed, 22 Nov 2023 18:32:37 +0100 Subject: [PATCH] fix(database): Ignore immutable field DBName in isUpToDate Signed-off-by: Maximilian Blatt (external expert on behalf of DB Netz) (cherry picked from commit 70d1618e2ed165eeda471134088fd1384cbdd0d7) --- pkg/clients/database/rds.go | 1 + pkg/clients/database/rds_test.go | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/pkg/clients/database/rds.go b/pkg/clients/database/rds.go index cc139e9f9a..b1749c99b8 100644 --- a/pkg/clients/database/rds.go +++ b/pkg/clients/database/rds.go @@ -720,6 +720,7 @@ func IsUpToDate(ctx context.Context, kube client.Client, r *v1beta1.RDSInstance, cmpopts.IgnoreTypes(&xpv1.Reference{}, &xpv1.Selector{}, []xpv1.Reference{}), cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "Region"), cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "Tags"), + cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "DBName"), cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "EngineVersion"), cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "SkipFinalSnapshotBeforeDeletion"), cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "FinalDBSnapshotIdentifier"), diff --git a/pkg/clients/database/rds_test.go b/pkg/clients/database/rds_test.go index f6a160ed99..52d0385a27 100644 --- a/pkg/clients/database/rds_test.go +++ b/pkg/clients/database/rds_test.go @@ -335,6 +335,21 @@ func TestIsUpToDate(t *testing.T) { }, want: true, }, + "IgnoresDBName": { + args: args{ + db: rdstypes.DBInstance{ + DBName: nil, + }, + r: v1beta1.RDSInstance{ + Spec: v1beta1.RDSInstanceSpec{ + ForProvider: v1beta1.RDSInstanceParameters{ + DBName: &dbName, + }, + }, + }, + }, + want: true, + }, "SamePassword": { args: args{ db: rdstypes.DBInstance{