@@ -37,6 +37,7 @@ import (
3737 "github.com/crossplane/crossplane-runtime/pkg/resource"
3838 "github.com/crossplane/crossplane-runtime/pkg/resource/unstructured/claim"
3939 "github.com/crossplane/crossplane-runtime/pkg/resource/unstructured/composite"
40+ "github.com/crossplane/crossplane-runtime/pkg/resource/unstructured/reference"
4041 "github.com/crossplane/crossplane-runtime/pkg/test"
4142)
4243
@@ -141,7 +142,7 @@ func TestReconcile(t *testing.T) {
141142 case * claim.Unstructured :
142143 // We won't try to get an XR unless the claim
143144 // references one.
144- o .SetResourceReference (& corev1. ObjectReference {Name : "cool-composite" })
145+ o .SetResourceReference (& reference. Composite {Name : "cool-composite" })
145146 case * composite.Unstructured :
146147 // Return an error getting the XR.
147148 return errBoom
@@ -150,7 +151,7 @@ func TestReconcile(t *testing.T) {
150151 }),
151152 MockStatusUpdate : WantClaim (t , NewClaim (func (cm * claim.Unstructured ) {
152153 // Check that we set our status condition.
153- cm .SetResourceReference (& corev1. ObjectReference {Name : "cool-composite" })
154+ cm .SetResourceReference (& reference. Composite {Name : "cool-composite" })
154155 cm .SetConditions (xpv1 .ReconcileError (errors .Wrap (errBoom , errGetComposite )))
155156 })),
156157 },
@@ -168,18 +169,18 @@ func TestReconcile(t *testing.T) {
168169 case * claim.Unstructured :
169170 // We won't try to get an XR unless the claim
170171 // references one.
171- o .SetResourceReference (& corev1. ObjectReference {Name : "cool-composite" })
172+ o .SetResourceReference (& reference. Composite {Name : "cool-composite" })
172173 case * composite.Unstructured :
173174 // This XR was created, and references another
174175 // claim.
175176 o .SetCreationTimestamp (now )
176- o .SetClaimReference (& claim. Reference {Name : "some-other-claim" })
177+ o .SetClaimReference (& reference. Claim {Name : "some-other-claim" })
177178 }
178179 return nil
179180 }),
180181 MockStatusUpdate : WantClaim (t , NewClaim (func (cm * claim.Unstructured ) {
181182 // Check that we set our status condition.
182- cm .SetResourceReference (& corev1. ObjectReference {Name : "cool-composite" })
183+ cm .SetResourceReference (& reference. Composite {Name : "cool-composite" })
183184 cm .SetConditions (xpv1 .ReconcileError (errors .Errorf (errFmtUnbound , "" , "some-other-claim" )))
184185 })),
185186 },
@@ -198,7 +199,7 @@ func TestReconcile(t *testing.T) {
198199 o .SetDeletionTimestamp (& now )
199200 // We won't try to get an XR unless the claim
200201 // references one.
201- o .SetResourceReference (& corev1. ObjectReference {Name : "cool-composite" })
202+ o .SetResourceReference (& reference. Composite {Name : "cool-composite" })
202203 case * composite.Unstructured :
203204 // Pretend the XR exists.
204205 o .SetCreationTimestamp (now )
@@ -209,7 +210,7 @@ func TestReconcile(t *testing.T) {
209210 MockStatusUpdate : WantClaim (t , NewClaim (func (cm * claim.Unstructured ) {
210211 // Check that we set our status condition.
211212 cm .SetDeletionTimestamp (& now )
212- cm .SetResourceReference (& corev1. ObjectReference {Name : "cool-composite" })
213+ cm .SetResourceReference (& reference. Composite {Name : "cool-composite" })
213214 cm .SetConditions (xpv1 .Deleting ())
214215 cm .SetConditions (xpv1 .ReconcileError (errors .Wrap (errBoom , errDeleteComposite )))
215216 })),
@@ -312,14 +313,14 @@ func TestReconcile(t *testing.T) {
312313 o .SetDeletionTimestamp (& now )
313314 // We won't try to get an XR unless the claim
314315 // references one.
315- o .SetResourceReference (& corev1. ObjectReference {Name : "cool-composite" })
316+ o .SetResourceReference (& reference. Composite {Name : "cool-composite" })
316317 // We want to foreground delete.
317318 fg := xpv1 .CompositeDeleteForeground
318319 o .SetCompositeDeletePolicy (& fg )
319320 case * composite.Unstructured :
320321 // Pretend the XR exists and is bound.
321322 o .SetCreationTimestamp (now )
322- o .SetClaimReference (& claim. Reference {})
323+ o .SetClaimReference (& reference. Claim {})
323324 }
324325 return nil
325326 }),
@@ -345,7 +346,7 @@ func TestReconcile(t *testing.T) {
345346 o .SetDeletionTimestamp (& now )
346347 // We won't try to get an XR unless the claim
347348 // references one.
348- o .SetResourceReference (& corev1. ObjectReference {Name : "cool-composite" })
349+ o .SetResourceReference (& reference. Composite {Name : "cool-composite" })
349350 // We want to foreground delete.
350351 fg := xpv1 .CompositeDeleteForeground
351352 o .SetCompositeDeletePolicy (& fg )
@@ -354,12 +355,12 @@ func TestReconcile(t *testing.T) {
354355 // being deleted.
355356 o .SetCreationTimestamp (now )
356357 o .SetDeletionTimestamp (& now )
357- o .SetClaimReference (& claim. Reference {})
358+ o .SetClaimReference (& reference. Claim {})
358359 }
359360 return nil
360361 }),
361362 MockStatusUpdate : WantClaim (t , NewClaim (func (cm * claim.Unstructured ) {
362- cm .SetResourceReference (& corev1. ObjectReference {Name : "cool-composite" })
363+ cm .SetResourceReference (& reference. Composite {Name : "cool-composite" })
363364 // We want to foreground delete.
364365 fg := xpv1 .CompositeDeleteForeground
365366 cm .SetCompositeDeletePolicy (& fg )
@@ -429,19 +430,19 @@ func TestReconcile(t *testing.T) {
429430 case * claim.Unstructured :
430431 // We won't try to get an XR unless the claim
431432 // references one.
432- o .SetResourceReference (& corev1. ObjectReference {Name : "cool-composite" })
433+ o .SetResourceReference (& reference. Composite {Name : "cool-composite" })
433434 case * composite.Unstructured :
434435 // Pretend the XR exists and is bound, but is
435436 // still being created.
436437 o .SetCreationTimestamp (now )
437- o .SetClaimReference (& claim. Reference {})
438+ o .SetClaimReference (& reference. Claim {})
438439 o .SetConditions (xpv1 .Creating ())
439440 }
440441 return nil
441442 }),
442443 MockStatusUpdate : WantClaim (t , NewClaim (func (cm * claim.Unstructured ) {
443444 // Check that we set our status condition.
444- cm .SetResourceReference (& corev1. ObjectReference {Name : "cool-composite" })
445+ cm .SetResourceReference (& reference. Composite {Name : "cool-composite" })
445446 cm .SetConditions (xpv1 .ReconcileSuccess ())
446447 cm .SetConditions (Waiting ())
447448 })),
@@ -466,18 +467,18 @@ func TestReconcile(t *testing.T) {
466467 case * claim.Unstructured :
467468 // We won't try to get an XR unless the claim
468469 // references one.
469- o .SetResourceReference (& corev1. ObjectReference {Name : "cool-composite" })
470+ o .SetResourceReference (& reference. Composite {Name : "cool-composite" })
470471 case * composite.Unstructured :
471472 // Pretend the XR exists and is available.
472473 o .SetCreationTimestamp (now )
473- o .SetClaimReference (& claim. Reference {})
474+ o .SetClaimReference (& reference. Claim {})
474475 o .SetConditions (xpv1 .Available ())
475476 }
476477 return nil
477478 }),
478479 MockStatusUpdate : WantClaim (t , NewClaim (func (cm * claim.Unstructured ) {
479480 // Check that we set our status condition.
480- cm .SetResourceReference (& corev1. ObjectReference {Name : "cool-composite" })
481+ cm .SetResourceReference (& reference. Composite {Name : "cool-composite" })
481482 cm .SetConditions (xpv1 .ReconcileError (errors .Wrap (errBoom , errPropagateCDs )))
482483 })),
483484 },
@@ -504,18 +505,18 @@ func TestReconcile(t *testing.T) {
504505 case * claim.Unstructured :
505506 // We won't try to get an XR unless the claim
506507 // references one.
507- o .SetResourceReference (& corev1. ObjectReference {Name : "cool-composite" })
508+ o .SetResourceReference (& reference. Composite {Name : "cool-composite" })
508509 case * composite.Unstructured :
509510 // Pretend the XR exists and is available.
510511 o .SetCreationTimestamp (now )
511- o .SetClaimReference (& claim. Reference {})
512+ o .SetClaimReference (& reference. Claim {})
512513 o .SetConditions (xpv1 .Available ())
513514 }
514515 return nil
515516 }),
516517 MockStatusUpdate : WantClaim (t , NewClaim (func (cm * claim.Unstructured ) {
517518 // Check that we set our status condition.
518- cm .SetResourceReference (& corev1. ObjectReference {Name : "cool-composite" })
519+ cm .SetResourceReference (& reference. Composite {Name : "cool-composite" })
519520 cm .SetConnectionDetailsLastPublishedTime (& now )
520521 cm .SetConditions (xpv1 .ReconcileSuccess ())
521522 cm .SetConditions (xpv1 .Available ())
@@ -544,7 +545,7 @@ func TestReconcile(t *testing.T) {
544545 case * claim.Unstructured :
545546 // We won't try to get an XR unless the claim
546547 // references one.
547- o .SetResourceReference (& corev1. ObjectReference {Name : "cool-composite" })
548+ o .SetResourceReference (& reference. Composite {Name : "cool-composite" })
548549 // The system conditions are already set.
549550 o .SetConditions (xpv1 .ReconcileSuccess ())
550551 o .SetConditions (xpv1 .Available ())
@@ -557,7 +558,7 @@ func TestReconcile(t *testing.T) {
557558 case * composite.Unstructured :
558559 // Pretend the XR exists and is available.
559560 o .SetCreationTimestamp (now )
560- o .SetClaimReference (& claim. Reference {})
561+ o .SetClaimReference (& reference. Claim {})
561562 o .SetConditions (xpv1 .Available ())
562563 o .SetConditions (
563564 // Database has become ready.
@@ -588,7 +589,7 @@ func TestReconcile(t *testing.T) {
588589 }),
589590 MockStatusUpdate : WantClaim (t , NewClaim (func (cm * claim.Unstructured ) {
590591 // Check that we set our status condition.
591- cm .SetResourceReference (& corev1. ObjectReference {Name : "cool-composite" })
592+ cm .SetResourceReference (& reference. Composite {Name : "cool-composite" })
592593 cm .SetConnectionDetailsLastPublishedTime (& now )
593594 cm .SetConditions (xpv1 .ReconcileSuccess ())
594595 cm .SetConditions (xpv1 .Available ())
0 commit comments