Skip to content

Commit

Permalink
fix(database): ignore restoreFrom in isUpToDate
Browse files Browse the repository at this point in the history
Signed-off-by: Charel Baum (external expert on behalf of DB InfraGO AG) <charel.baum-extern@deutschebahn.com>
  • Loading branch information
Charel Baum (external expert on behalf of DB InfraGO AG) committed Apr 9, 2024
1 parent ddd940a commit a868348
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/clients/database/rds.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
23 changes: 23 additions & 0 deletions pkg/clients/database/rds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ var (
port = 123
port32 = int32(port)
resourceID = "resource"
restoreFromSource = "PointInTime"
retention = 2
retention32 = int32(retention)
status = "testStatus"
Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit a868348

Please sign in to comment.