@@ -173,6 +173,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
173173 res : func () * un.Unstructured {
174174 xr := tu .NewResource ("example.org/v1" , "XR1" , "my-xr" ).Build ()
175175 _ = un .SetNestedField (xr .Object , "referenced-comp" , "spec" , "compositionRef" , "name" )
176+
176177 return xr
177178 }(),
178179 },
@@ -202,6 +203,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
202203 res : func () * un.Unstructured {
203204 xr := tu .NewResource ("example.org/v1" , "XR1" , "my-xr" ).Build ()
204205 _ = un .SetNestedField (xr .Object , "incompatible-comp" , "spec" , "compositionRef" , "name" )
206+
205207 return xr
206208 }(),
207209 },
@@ -230,6 +232,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
230232 res : func () * un.Unstructured {
231233 xr := tu .NewResource ("example.org/v1" , "XR1" , "my-xr" ).Build ()
232234 _ = un .SetNestedField (xr .Object , "non-existent-comp" , "spec" , "compositionRef" , "name" )
235+
233236 return xr
234237 }(),
235238 },
@@ -261,6 +264,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
261264 _ = un .SetNestedStringMap (xr .Object , map [string ]string {
262265 "environment" : "production" ,
263266 }, "spec" , "compositionSelector" , "matchLabels" )
267+
264268 return xr
265269 }(),
266270 },
@@ -288,6 +292,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
288292 comp .SetLabels (map [string ]string {
289293 "environment" : "staging" ,
290294 })
295+
291296 return comp
292297 }(),
293298 },
@@ -299,6 +304,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
299304 _ = un .SetNestedStringMap (xr .Object , map [string ]string {
300305 "environment" : "production" ,
301306 }, "spec" , "compositionSelector" , "matchLabels" )
307+
302308 return xr
303309 }(),
304310 },
@@ -330,6 +336,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
330336 _ = un .SetNestedStringMap (xr .Object , map [string ]string {
331337 "environment" : "production" ,
332338 }, "spec" , "compositionSelector" , "matchLabels" )
339+
333340 return xr
334341 }(),
335342 },
@@ -378,6 +385,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
378385 res : func () * un.Unstructured {
379386 xr := tu .NewResource ("example.org/v1" , "XR1" , "my-xr" ).Build ()
380387 _ = un .SetNestedField (xr .Object , "referenced-comp" , "spec" , "compositionRef" , "name" )
388+
381389 return xr
382390 }(),
383391 },
@@ -406,6 +414,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
406414 _ = un .SetNestedStringMap (xr .Object , map [string ]string {
407415 "environment" : "production" ,
408416 }, "spec" , "compositionSelector" , "matchLabels" )
417+
409418 return xr
410419 }(),
411420 },
@@ -497,6 +506,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
497506 }).Build (),
498507 }, nil
499508 }
509+
500510 return []* un.Unstructured {}, nil
501511 }).
502512 Build (),
@@ -599,6 +609,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
599609 }).Build (),
600610 }, nil
601611 }
612+
602613 return []* un.Unstructured {}, nil
603614 }).
604615 Build (),
@@ -688,6 +699,7 @@ func TestDefaultCompositionClient_FindMatchingComposition(t *testing.T) {
688699 }).Build (),
689700 }, nil
690701 }
702+
691703 return []* un.Unstructured {}, nil
692704 }).
693705 Build (),
@@ -798,13 +810,17 @@ func TestDefaultCompositionClient_GetComposition(t *testing.T) {
798810 u := & un.Unstructured {}
799811 u .SetGroupVersionKind (gvk )
800812 u .SetName (name )
813+
801814 obj , err := runtime .DefaultUnstructuredConverter .ToUnstructured (testComp )
802815 if err != nil {
803816 return nil , err
804817 }
818+
805819 u .SetUnstructuredContent (obj )
820+
806821 return u , nil
807822 }
823+
808824 return nil , errors .New ("composition not found" )
809825 }).
810826 Build ()
@@ -920,6 +936,7 @@ func TestDefaultCompositionClient_ListCompositions(t *testing.T) {
920936 if gvk .Group == CrossplaneAPIExtGroup && gvk .Kind == "Composition" {
921937 return []* un.Unstructured {u1 , u2 }, nil
922938 }
939+
923940 return nil , errors .New ("unexpected GVK" )
924941 }).
925942 Build (),
0 commit comments