@@ -103,3 +103,48 @@ func TestCompareResource_S3_Bucket(t *testing.T) {
103103 ),
104104 )
105105}
106+
107+ func TestCompareResource_Lambda_CodeSigningConfig (t * testing.T ) {
108+ assert := assert .New (t )
109+ require := require .New (t )
110+
111+ g := testutil .NewGeneratorForService (t , "lambda" )
112+
113+ crd := testutil .GetCRDByName (t , g , "CodeSigningConfig" )
114+ require .NotNil (crd )
115+
116+ expected := `
117+ if ackcompare.HasNilDifference(a.ko.Spec.AllowedPublishers, b.ko.Spec.AllowedPublishers) {
118+ delta.Add("Spec.AllowedPublishers", a.ko.Spec.AllowedPublishers, b.ko.Spec.AllowedPublishers)
119+ } else if a.ko.Spec.AllowedPublishers != nil && b.ko.Spec.AllowedPublishers != nil {
120+
121+ if !ackcompare.SliceStringPEqual(a.ko.Spec.AllowedPublishers.SigningProfileVersionARNs, b.ko.Spec.AllowedPublishers.SigningProfileVersionARNs) {
122+ delta.Add("Spec.AllowedPublishers.SigningProfileVersionARNs", a.ko.Spec.AllowedPublishers.SigningProfileVersionARNs, b.ko.Spec.AllowedPublishers.SigningProfileVersionARNs)
123+ }
124+ }
125+ if ackcompare.HasNilDifference(a.ko.Spec.CodeSigningPolicies, b.ko.Spec.CodeSigningPolicies) {
126+ delta.Add("Spec.CodeSigningPolicies", a.ko.Spec.CodeSigningPolicies, b.ko.Spec.CodeSigningPolicies)
127+ } else if a.ko.Spec.CodeSigningPolicies != nil && b.ko.Spec.CodeSigningPolicies != nil {
128+ if ackcompare.HasNilDifference(a.ko.Spec.CodeSigningPolicies.UntrustedArtifactOnDeployment, b.ko.Spec.CodeSigningPolicies.UntrustedArtifactOnDeployment) {
129+ delta.Add("Spec.CodeSigningPolicies.UntrustedArtifactOnDeployment", a.ko.Spec.CodeSigningPolicies.UntrustedArtifactOnDeployment, b.ko.Spec.CodeSigningPolicies.UntrustedArtifactOnDeployment)
130+ } else if a.ko.Spec.CodeSigningPolicies.UntrustedArtifactOnDeployment != nil && b.ko.Spec.CodeSigningPolicies.UntrustedArtifactOnDeployment != nil {
131+ if *a.ko.Spec.CodeSigningPolicies.UntrustedArtifactOnDeployment != *b.ko.Spec.CodeSigningPolicies.UntrustedArtifactOnDeployment {
132+ delta.Add("Spec.CodeSigningPolicies.UntrustedArtifactOnDeployment", a.ko.Spec.CodeSigningPolicies.UntrustedArtifactOnDeployment, b.ko.Spec.CodeSigningPolicies.UntrustedArtifactOnDeployment)
133+ }
134+ }
135+ }
136+ if ackcompare.HasNilDifference(a.ko.Spec.Description, b.ko.Spec.Description) {
137+ delta.Add("Spec.Description", a.ko.Spec.Description, b.ko.Spec.Description)
138+ } else if a.ko.Spec.Description != nil && b.ko.Spec.Description != nil {
139+ if *a.ko.Spec.Description != *b.ko.Spec.Description {
140+ delta.Add("Spec.Description", a.ko.Spec.Description, b.ko.Spec.Description)
141+ }
142+ }
143+ `
144+ assert .Equal (
145+ expected ,
146+ code .CompareResource (
147+ crd .Config (), crd , "delta" , "a.ko" , "b.ko" , 1 ,
148+ ),
149+ )
150+ }
0 commit comments