Skip to content

Commit

Permalink
Merge pull request #2042 from crossplane-contrib/backport-2038-to-rel…
Browse files Browse the repository at this point in the history
…ease-0.47

[Backport release-0.47] Fix changes detection for route53.ResourceRecordSet
  • Loading branch information
MisterMX authored Apr 15, 2024
2 parents 90551c8 + b517610 commit 3739ae7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
2 changes: 2 additions & 0 deletions pkg/clients/resourcerecordset/resourcerecordset.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ func LateInitialize(in *v1alpha1.ResourceRecordSetParameters, rrSet *route53type
rrType := string(rrSet.Type)
in.Type = pointer.LateInitializeValueFromPtr(in.Type, &rrType)
in.TTL = pointer.LateInitialize(in.TTL, rrSet.TTL)
in.MultiValueAnswer = pointer.LateInitialize(in.MultiValueAnswer, rrSet.MultiValueAnswer)
in.SetIdentifier = pointer.LateInitialize(in.SetIdentifier, rrSet.SetIdentifier)
if len(in.ResourceRecords) == 0 && len(rrSet.ResourceRecords) != 0 {
in.ResourceRecords = make([]v1alpha1.ResourceRecord, len(rrSet.ResourceRecords))
for i, val := range rrSet.ResourceRecords {
Expand Down
32 changes: 28 additions & 4 deletions pkg/clients/resourcerecordset/resourcerecordset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,43 @@ func TestCreatePatch(t *testing.T) {
patch: &v1alpha1.ResourceRecordSetParameters{},
},
},
"SameFieldsWithMultiValueAnswer": {
args: args{
rrSet: route53types.ResourceRecordSet{
Name: &resourceRecordSetName,
TTL: &ttl,
MultiValueAnswer: aws.Bool(true),
SetIdentifier: aws.String("id"),
},
p: v1alpha1.ResourceRecordSetParameters{
TTL: &ttl,
MultiValueAnswer: aws.Bool(true),
SetIdentifier: aws.String("id"),
},
},
want: want{
patch: &v1alpha1.ResourceRecordSetParameters{},
},
},
"DifferentFields": {
args: args{
rrSet: route53types.ResourceRecordSet{
Name: &resourceRecordSetName,
TTL: &ttl,
Name: &resourceRecordSetName,
TTL: &ttl,
MultiValueAnswer: aws.Bool(true),
SetIdentifier: aws.String("id"),
},
p: v1alpha1.ResourceRecordSetParameters{
TTL: &ttl2,
TTL: &ttl2,
MultiValueAnswer: aws.Bool(false),
SetIdentifier: aws.String("id2"),
},
},
want: want{
patch: &v1alpha1.ResourceRecordSetParameters{
TTL: &ttl2,
TTL: &ttl2,
MultiValueAnswer: aws.Bool(false),
SetIdentifier: aws.String("id2"),
},
},
},
Expand Down

0 comments on commit 3739ae7

Please sign in to comment.