@@ -25,6 +25,7 @@ import (
2525 ackerr "github.com/aws-controllers-k8s/runtime/pkg/errors"
2626 corev1 "k8s.io/api/core/v1"
2727
28+ metav1mocks "github.com/aws-controllers-k8s/runtime/mocks/apimachinery/pkg/apis/meta/v1"
2829 ackmocks "github.com/aws-controllers-k8s/runtime/mocks/pkg/types"
2930)
3031
@@ -111,7 +112,10 @@ func TestConditionGetters(t *testing.T) {
111112func TestConditionSetters (t * testing.T ) {
112113 r := & ackmocks.AWSResource {}
113114 r .On ("Conditions" ).Return ([]* ackv1alpha1.Condition {})
114-
115+ metaObject := & metav1mocks.Object {}
116+ var observedGeneration int64 = 1
117+ r .On ("MetaObject" ).Return (metaObject )
118+ metaObject .On ("GetGeneration" ).Return (observedGeneration )
115119 // Ensure that if there is no synced condition, it gets added...
116120 r .On (
117121 "ReplaceConditions" ,
@@ -132,6 +136,8 @@ func TestConditionSetters(t *testing.T) {
132136
133137 // Ensure that SetSynced doesn't overwrite any other conditions...
134138 r = & ackmocks.AWSResource {}
139+ r .On ("MetaObject" ).Return (metaObject )
140+ metaObject .On ("GetGeneration" ).Return (observedGeneration )
135141 r .On ("Conditions" ).Return (
136142 []* ackv1alpha1.Condition {
137143 & ackv1alpha1.Condition {
@@ -157,6 +163,8 @@ func TestConditionSetters(t *testing.T) {
157163
158164 // Ensure that SetSynced overwrites an existing synced condition...
159165 r = & ackmocks.AWSResource {}
166+ r .On ("MetaObject" ).Return (metaObject )
167+ metaObject .On ("GetGeneration" ).Return (observedGeneration )
160168 r .On ("Conditions" ).Return (
161169 []* ackv1alpha1.Condition {
162170 & ackv1alpha1.Condition {
@@ -183,6 +191,8 @@ func TestConditionSetters(t *testing.T) {
183191
184192 // Ensure that if there is no terminal condition, it gets added...
185193 r = & ackmocks.AWSResource {}
194+ r .On ("MetaObject" ).Return (metaObject )
195+ metaObject .On ("GetGeneration" ).Return (observedGeneration )
186196 r .On ("Conditions" ).Return ([]* ackv1alpha1.Condition {})
187197 r .On (
188198 "ReplaceConditions" ,
@@ -204,6 +214,8 @@ func TestConditionSetters(t *testing.T) {
204214 // ReferencesResolved condition
205215 // SetReferencesResolved
206216 r = & ackmocks.AWSResource {}
217+ r .On ("MetaObject" ).Return (metaObject )
218+ metaObject .On ("GetGeneration" ).Return (observedGeneration )
207219 r .On ("Conditions" ).Return ([]* ackv1alpha1.Condition {})
208220 r .On (
209221 "ReplaceConditions" ,
@@ -219,6 +231,8 @@ func TestConditionSetters(t *testing.T) {
219231
220232 //RemoveReferencesResolved
221233 r = & ackmocks.AWSResource {}
234+ r .On ("MetaObject" ).Return (metaObject )
235+ metaObject .On ("GetGeneration" ).Return (observedGeneration )
222236 r .On ("Conditions" ).Return (
223237 []* ackv1alpha1.Condition {
224238 & ackv1alpha1.Condition {
@@ -246,6 +260,8 @@ func TestConditionSetters(t *testing.T) {
246260 //WithReferencesResolvedCondition
247261 // Without Error
248262 r = & ackmocks.AWSResource {}
263+ r .On ("MetaObject" ).Return (metaObject )
264+ metaObject .On ("GetGeneration" ).Return (observedGeneration )
249265 r .On ("DeepCopy" ).Return (r )
250266 r .On ("Conditions" ).Return ([]* ackv1alpha1.Condition {})
251267 r .On (
@@ -263,6 +279,8 @@ func TestConditionSetters(t *testing.T) {
263279 errorMsg := "error message"
264280 err := errors .New (errorMsg )
265281 r = & ackmocks.AWSResource {}
282+ r .On ("MetaObject" ).Return (metaObject )
283+ metaObject .On ("GetGeneration" ).Return (observedGeneration )
266284 r .On ("DeepCopy" ).Return (r )
267285 r .On ("Conditions" ).Return ([]* ackv1alpha1.Condition {})
268286 r .On (
@@ -280,6 +298,8 @@ func TestConditionSetters(t *testing.T) {
280298 // With Terminal Error
281299 terminalError := ackerr .ResourceReferenceTerminal
282300 r = & ackmocks.AWSResource {}
301+ r .On ("MetaObject" ).Return (metaObject )
302+ metaObject .On ("GetGeneration" ).Return (observedGeneration )
283303 r .On ("DeepCopy" ).Return (r )
284304 r .On ("Conditions" ).Return ([]* ackv1alpha1.Condition {})
285305 r .On (
0 commit comments