@@ -475,3 +475,49 @@ func TestCompareResource_APIGatewayv2_Route(t *testing.T) {
475
475
),
476
476
)
477
477
}
478
+
479
+ func TestCompareResource_MemoryDB_User (t * testing.T ) {
480
+ assert := assert .New (t )
481
+ require := require .New (t )
482
+
483
+ g := testutil .NewModelForService (t , "memorydb" )
484
+
485
+ crd := testutil .GetCRDByName (t , g , "User" )
486
+ require .NotNil (crd )
487
+ expected := `
488
+ if ackcompare.HasNilDifference(a.ko.Spec.AccessString, b.ko.Spec.AccessString) {
489
+ delta.Add("Spec.AccessString", a.ko.Spec.AccessString, b.ko.Spec.AccessString)
490
+ } else if a.ko.Spec.AccessString != nil && b.ko.Spec.AccessString != nil {
491
+ if *a.ko.Spec.AccessString != *b.ko.Spec.AccessString {
492
+ delta.Add("Spec.AccessString", a.ko.Spec.AccessString, b.ko.Spec.AccessString)
493
+ }
494
+ }
495
+ if ackcompare.HasNilDifference(a.ko.Spec.AuthenticationMode, b.ko.Spec.AuthenticationMode) {
496
+ delta.Add("Spec.AuthenticationMode", a.ko.Spec.AuthenticationMode, b.ko.Spec.AuthenticationMode)
497
+ } else if a.ko.Spec.AuthenticationMode != nil && b.ko.Spec.AuthenticationMode != nil {
498
+ if ackcompare.HasNilDifference(a.ko.Spec.AuthenticationMode.Type, b.ko.Spec.AuthenticationMode.Type) {
499
+ delta.Add("Spec.AuthenticationMode.Type", a.ko.Spec.AuthenticationMode.Type, b.ko.Spec.AuthenticationMode.Type)
500
+ } else if a.ko.Spec.AuthenticationMode.Type != nil && b.ko.Spec.AuthenticationMode.Type != nil {
501
+ if *a.ko.Spec.AuthenticationMode.Type != *b.ko.Spec.AuthenticationMode.Type {
502
+ delta.Add("Spec.AuthenticationMode.Type", a.ko.Spec.AuthenticationMode.Type, b.ko.Spec.AuthenticationMode.Type)
503
+ }
504
+ }
505
+ }
506
+ if ackcompare.HasNilDifference(a.ko.Spec.Name, b.ko.Spec.Name) {
507
+ delta.Add("Spec.Name", a.ko.Spec.Name, b.ko.Spec.Name)
508
+ } else if a.ko.Spec.Name != nil && b.ko.Spec.Name != nil {
509
+ if *a.ko.Spec.Name != *b.ko.Spec.Name {
510
+ delta.Add("Spec.Name", a.ko.Spec.Name, b.ko.Spec.Name)
511
+ }
512
+ }
513
+ if !reflect.DeepEqual(a.ko.Spec.Tags, b.ko.Spec.Tags) {
514
+ delta.Add("Spec.Tags", a.ko.Spec.Tags, b.ko.Spec.Tags)
515
+ }
516
+ `
517
+ assert .Equal (
518
+ expected ,
519
+ code .CompareResource (
520
+ crd .Config (), crd , "delta" , "a.ko" , "b.ko" , 1 ,
521
+ ),
522
+ )
523
+ }
0 commit comments