From a868348727e4d5eee24619b0373bd7ae1d75c98c Mon Sep 17 00:00:00 2001 From: "Charel Baum (external expert on behalf of DB InfraGO AG)" Date: Tue, 9 Apr 2024 15:09:01 +0200 Subject: [PATCH] fix(database): ignore restoreFrom in isUpToDate Signed-off-by: Charel Baum (external expert on behalf of DB InfraGO AG) --- pkg/clients/database/rds.go | 1 + pkg/clients/database/rds_test.go | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/pkg/clients/database/rds.go b/pkg/clients/database/rds.go index 45fecd369d..c618b54d9d 100644 --- a/pkg/clients/database/rds.go +++ b/pkg/clients/database/rds.go @@ -712,6 +712,7 @@ func IsUpToDate(ctx context.Context, kube client.Client, r *v1beta1.RDSInstance, cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "Region"), cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "Tags"), cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "DBName"), + cmpopts.IgnoreFields(v1beta1.RDSInstanceParameters{}, "RestoreFrom"), 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 dd23a83d1b..4265958bdd 100644 --- a/pkg/clients/database/rds_test.go +++ b/pkg/clients/database/rds_test.go @@ -69,6 +69,7 @@ var ( port = 123 port32 = int32(port) resourceID = "resource" + restoreFromSource = "PointInTime" retention = 2 retention32 = int32(retention) status = "testStatus" @@ -281,6 +282,28 @@ func TestIsUpToDate(t *testing.T) { }, want: true, }, + "IgnoresRestoreFrom": { + args: args{ + db: rdstypes.DBInstance{ + DBName: &dbName, + }, + r: v1beta1.RDSInstance{ + Spec: v1beta1.RDSInstanceSpec{ + ForProvider: v1beta1.RDSInstanceParameters{ + DBName: &dbName, + RestoreFrom: &v1beta1.RestoreBackupConfiguration{ + PointInTime: &v1beta1.PointInTimeRestoreBackupConfiguration{ + SourceDBInstanceIdentifier: &resourceID, + UseLatestRestorableTime: true, + }, + Source: &restoreFromSource, + }, + }, + }, + }, + }, + want: true, + }, "SamePassword": { args: args{ db: rdstypes.DBInstance{