@@ -32,70 +32,65 @@ func TestCompareResource_S3_Bucket(t *testing.T) {
3232 crd := testutil .GetCRDByName (t , g , "Bucket" )
3333 require .NotNil (crd )
3434
35+ // The ACL field is ignored in the S3 generator config and therefore should
36+ // not appear in this output.
3537 expected := `
36- if ackcompare.HasNilDifference(a.ko.Spec.ACL, b.ko.Spec.ACL) {
37- delta.Add("Spec.ACL", a.ko.Spec.ACL, b.ko.Spec.ACL)
38- } else {
39- if *a.ko.Spec.ACL != *b.ko.Spec.ACL {
40- delta.Add("Spec.ACL", a.ko.Spec.ACL, b.ko.Spec.ACL)
41- }
42- }
4338 if ackcompare.HasNilDifference(a.ko.Spec.CreateBucketConfiguration, b.ko.Spec.CreateBucketConfiguration) {
4439 delta.Add("Spec.CreateBucketConfiguration", a.ko.Spec.CreateBucketConfiguration, b.ko.Spec.CreateBucketConfiguration)
45- } else {
40+ } else if a.ko.Spec.CreateBucketConfiguration != nil && b.ko.Spec.CreateBucketConfiguration != nil {
4641 if ackcompare.HasNilDifference(a.ko.Spec.CreateBucketConfiguration.LocationConstraint, b.ko.Spec.CreateBucketConfiguration.LocationConstraint) {
4742 delta.Add("Spec.CreateBucketConfiguration.LocationConstraint", a.ko.Spec.CreateBucketConfiguration.LocationConstraint, b.ko.Spec.CreateBucketConfiguration.LocationConstraint)
48- } else {
43+ } else if a.ko.Spec.CreateBucketConfiguration.LocationConstraint != nil && b.ko.Spec.CreateBucketConfiguration.LocationConstraint != nil {
4944 if *a.ko.Spec.CreateBucketConfiguration.LocationConstraint != *b.ko.Spec.CreateBucketConfiguration.LocationConstraint {
5045 delta.Add("Spec.CreateBucketConfiguration.LocationConstraint", a.ko.Spec.CreateBucketConfiguration.LocationConstraint, b.ko.Spec.CreateBucketConfiguration.LocationConstraint)
5146 }
5247 }
5348 }
5449 if ackcompare.HasNilDifference(a.ko.Spec.GrantFullControl, b.ko.Spec.GrantFullControl) {
5550 delta.Add("Spec.GrantFullControl", a.ko.Spec.GrantFullControl, b.ko.Spec.GrantFullControl)
56- } else {
51+ } else if a.ko.Spec.GrantFullControl != nil && b.ko.Spec.GrantFullControl != nil {
5752 if *a.ko.Spec.GrantFullControl != *b.ko.Spec.GrantFullControl {
5853 delta.Add("Spec.GrantFullControl", a.ko.Spec.GrantFullControl, b.ko.Spec.GrantFullControl)
5954 }
6055 }
6156 if ackcompare.HasNilDifference(a.ko.Spec.GrantRead, b.ko.Spec.GrantRead) {
6257 delta.Add("Spec.GrantRead", a.ko.Spec.GrantRead, b.ko.Spec.GrantRead)
63- } else {
58+ } else if a.ko.Spec.GrantRead != nil && b.ko.Spec.GrantRead != nil {
6459 if *a.ko.Spec.GrantRead != *b.ko.Spec.GrantRead {
6560 delta.Add("Spec.GrantRead", a.ko.Spec.GrantRead, b.ko.Spec.GrantRead)
6661 }
6762 }
6863 if ackcompare.HasNilDifference(a.ko.Spec.GrantReadACP, b.ko.Spec.GrantReadACP) {
6964 delta.Add("Spec.GrantReadACP", a.ko.Spec.GrantReadACP, b.ko.Spec.GrantReadACP)
70- } else {
65+ } else if a.ko.Spec.GrantReadACP != nil && b.ko.Spec.GrantReadACP != nil {
7166 if *a.ko.Spec.GrantReadACP != *b.ko.Spec.GrantReadACP {
7267 delta.Add("Spec.GrantReadACP", a.ko.Spec.GrantReadACP, b.ko.Spec.GrantReadACP)
7368 }
7469 }
7570 if ackcompare.HasNilDifference(a.ko.Spec.GrantWrite, b.ko.Spec.GrantWrite) {
7671 delta.Add("Spec.GrantWrite", a.ko.Spec.GrantWrite, b.ko.Spec.GrantWrite)
77- } else {
72+ } else if a.ko.Spec.GrantWrite != nil && b.ko.Spec.GrantWrite != nil {
7873 if *a.ko.Spec.GrantWrite != *b.ko.Spec.GrantWrite {
7974 delta.Add("Spec.GrantWrite", a.ko.Spec.GrantWrite, b.ko.Spec.GrantWrite)
8075 }
8176 }
8277 if ackcompare.HasNilDifference(a.ko.Spec.GrantWriteACP, b.ko.Spec.GrantWriteACP) {
8378 delta.Add("Spec.GrantWriteACP", a.ko.Spec.GrantWriteACP, b.ko.Spec.GrantWriteACP)
84- } else {
79+ } else if a.ko.Spec.GrantWriteACP != nil && b.ko.Spec.GrantWriteACP != nil {
8580 if *a.ko.Spec.GrantWriteACP != *b.ko.Spec.GrantWriteACP {
8681 delta.Add("Spec.GrantWriteACP", a.ko.Spec.GrantWriteACP, b.ko.Spec.GrantWriteACP)
8782 }
8883 }
8984 if ackcompare.HasNilDifference(a.ko.Spec.Name, b.ko.Spec.Name) {
9085 delta.Add("Spec.Name", a.ko.Spec.Name, b.ko.Spec.Name)
91- } else {
86+ } else if a.ko.Spec.Name != nil && b.ko.Spec.Name != nil {
9287 if *a.ko.Spec.Name != *b.ko.Spec.Name {
9388 delta.Add("Spec.Name", a.ko.Spec.Name, b.ko.Spec.Name)
9489 }
9590 }
9691 if ackcompare.HasNilDifference(a.ko.Spec.ObjectLockEnabledForBucket, b.ko.Spec.ObjectLockEnabledForBucket) {
9792 delta.Add("Spec.ObjectLockEnabledForBucket", a.ko.Spec.ObjectLockEnabledForBucket, b.ko.Spec.ObjectLockEnabledForBucket)
98- } else {
93+ } else if a.ko.Spec.ObjectLockEnabledForBucket != nil && b.ko.Spec.ObjectLockEnabledForBucket != nil {
9994 if *a.ko.Spec.ObjectLockEnabledForBucket != *b.ko.Spec.ObjectLockEnabledForBucket {
10095 delta.Add("Spec.ObjectLockEnabledForBucket", a.ko.Spec.ObjectLockEnabledForBucket, b.ko.Spec.ObjectLockEnabledForBucket)
10196 }
0 commit comments