@@ -156,23 +156,25 @@ func TestRunFunction(t *testing.T) {
156
156
{
157
157
Name : "cool-resource" ,
158
158
Base : & runtime.RawExtension {Raw : []byte (`{"apiVersion":"example.org/v1","kind":"CD"}` )},
159
- Patches : []v1beta1.Patch {
159
+ Patches : []v1beta1.ComposedPatch {
160
160
{
161
- Type : v1beta1 .PatchTypeFromCompositeFieldPath ,
162
- FromFieldPath : ptr.To [string ]("spec.widgets" ),
163
- ToFieldPath : ptr.To [string ]("spec.watchers" ),
164
- Transforms : []v1beta1.Transform {
165
- {
166
- Type : v1beta1 .TransformTypeConvert ,
167
- Convert : & v1beta1.ConvertTransform {
168
- ToType : v1beta1 .TransformIOTypeInt64 ,
161
+ Type : v1beta1 .PatchTypeFromCompositeFieldPath ,
162
+ Patch : v1beta1.Patch {
163
+ FromFieldPath : ptr.To [string ]("spec.widgets" ),
164
+ ToFieldPath : ptr.To [string ]("spec.watchers" ),
165
+ Transforms : []v1beta1.Transform {
166
+ {
167
+ Type : v1beta1 .TransformTypeConvert ,
168
+ Convert : & v1beta1.ConvertTransform {
169
+ ToType : v1beta1 .TransformIOTypeInt64 ,
170
+ },
169
171
},
170
- },
171
- {
172
- Type : v1beta1 .TransformTypeMath ,
173
- Math : & v1beta1.MathTransform {
174
- Type : v1beta1 . MathTransformTypeMultiply ,
175
- Multiply : ptr. To [ int64 ]( 3 ) ,
172
+ {
173
+ Type : v1beta1 . TransformTypeMath ,
174
+ Math : & v1beta1.MathTransform {
175
+ Type : v1beta1 .MathTransformTypeMultiply ,
176
+ Multiply : ptr. To [ int64 ]( 3 ) ,
177
+ } ,
176
178
},
177
179
},
178
180
},
@@ -221,23 +223,25 @@ func TestRunFunction(t *testing.T) {
221
223
// patch the resource named "cool-resource" in
222
224
// the desired resources array.
223
225
Name : "cool-resource" ,
224
- Patches : []v1beta1.Patch {
226
+ Patches : []v1beta1.ComposedPatch {
225
227
{
226
- Type : v1beta1 .PatchTypeFromCompositeFieldPath ,
227
- FromFieldPath : ptr.To [string ]("spec.widgets" ),
228
- ToFieldPath : ptr.To [string ]("spec.watchers" ),
229
- Transforms : []v1beta1.Transform {
230
- {
231
- Type : v1beta1 .TransformTypeConvert ,
232
- Convert : & v1beta1.ConvertTransform {
233
- ToType : v1beta1 .TransformIOTypeInt64 ,
228
+ Type : v1beta1 .PatchTypeFromCompositeFieldPath ,
229
+ Patch : v1beta1.Patch {
230
+ FromFieldPath : ptr.To [string ]("spec.widgets" ),
231
+ ToFieldPath : ptr.To [string ]("spec.watchers" ),
232
+ Transforms : []v1beta1.Transform {
233
+ {
234
+ Type : v1beta1 .TransformTypeConvert ,
235
+ Convert : & v1beta1.ConvertTransform {
236
+ ToType : v1beta1 .TransformIOTypeInt64 ,
237
+ },
234
238
},
235
- },
236
- {
237
- Type : v1beta1 .TransformTypeMath ,
238
- Math : & v1beta1.MathTransform {
239
- Type : v1beta1 . MathTransformTypeMultiply ,
240
- Multiply : ptr. To [ int64 ]( 3 ) ,
239
+ {
240
+ Type : v1beta1 . TransformTypeMath ,
241
+ Math : & v1beta1.MathTransform {
242
+ Type : v1beta1 .MathTransformTypeMultiply ,
243
+ Multiply : ptr. To [ int64 ]( 3 ) ,
244
+ } ,
241
245
},
242
246
},
243
247
},
@@ -291,11 +295,13 @@ func TestRunFunction(t *testing.T) {
291
295
// patch the resource named "cool-resource" in
292
296
// the desired resources array.
293
297
Name : "cool-resource" ,
294
- Patches : []v1beta1.Patch {
298
+ Patches : []v1beta1.ComposedPatch {
295
299
{
296
- Type : v1beta1 .PatchTypeFromCompositeFieldPath ,
297
- FromFieldPath : ptr.To [string ]("spec.widgets" ),
298
- ToFieldPath : ptr.To [string ]("spec.watchers" ),
300
+ Type : v1beta1 .PatchTypeFromCompositeFieldPath ,
301
+ Patch : v1beta1.Patch {
302
+ FromFieldPath : ptr.To [string ]("spec.widgets" ),
303
+ ToFieldPath : ptr.To [string ]("spec.watchers" ),
304
+ },
299
305
},
300
306
},
301
307
},
@@ -387,25 +393,29 @@ func TestRunFunction(t *testing.T) {
387
393
// patch the resource named "cool-resource" in
388
394
// the desired resources array.
389
395
Name : "cool-resource" ,
390
- Patches : []v1beta1.Patch {
396
+ Patches : []v1beta1.ComposedPatch {
391
397
{
392
398
// This patch should work.
393
- Type : v1beta1 .PatchTypeFromCompositeFieldPath ,
394
- FromFieldPath : ptr.To [string ]("spec.widgets" ),
395
- ToFieldPath : ptr.To [string ]("spec.watchers" ),
399
+ Type : v1beta1 .PatchTypeFromCompositeFieldPath ,
400
+ Patch : v1beta1.Patch {
401
+ FromFieldPath : ptr.To [string ]("spec.widgets" ),
402
+ ToFieldPath : ptr.To [string ]("spec.watchers" ),
403
+ },
396
404
},
397
405
{
398
406
// This patch should return an error,
399
407
// because the required path does not
400
408
// exist.
401
- Type : v1beta1 .PatchTypeFromCompositeFieldPath ,
402
- FromFieldPath : ptr.To [string ]("spec.doesNotExist" ),
403
- ToFieldPath : ptr.To [string ]("spec.explode" ),
404
- Policy : & v1beta1.PatchPolicy {
405
- FromFieldPath : func () * v1beta1.FromFieldPathPolicy {
406
- r := v1beta1 .FromFieldPathPolicyRequired
407
- return & r
408
- }(),
409
+ Type : v1beta1 .PatchTypeFromCompositeFieldPath ,
410
+ Patch : v1beta1.Patch {
411
+ FromFieldPath : ptr.To [string ]("spec.doesNotExist" ),
412
+ ToFieldPath : ptr.To [string ]("spec.explode" ),
413
+ Policy : & v1beta1.PatchPolicy {
414
+ FromFieldPath : func () * v1beta1.FromFieldPathPolicy {
415
+ r := v1beta1 .FromFieldPathPolicyRequired
416
+ return & r
417
+ }(),
418
+ },
409
419
},
410
420
},
411
421
},
@@ -572,23 +582,25 @@ func TestRunFunction(t *testing.T) {
572
582
{
573
583
Name : "cool-resource" ,
574
584
Base : & runtime.RawExtension {Raw : []byte (`{"apiVersion":"example.org/v1","kind":"CD"}` )},
575
- Patches : []v1beta1.Patch {
585
+ Patches : []v1beta1.ComposedPatch {
576
586
{
577
- Type : v1beta1 .PatchTypeToCompositeFieldPath ,
578
- FromFieldPath : ptr.To [string ]("spec.widgets" ),
579
- ToFieldPath : ptr.To [string ]("spec.watchers" ),
580
- Transforms : []v1beta1.Transform {
581
- {
582
- Type : v1beta1 .TransformTypeConvert ,
583
- Convert : & v1beta1.ConvertTransform {
584
- ToType : v1beta1 .TransformIOTypeInt64 ,
587
+ Type : v1beta1 .PatchTypeToCompositeFieldPath ,
588
+ Patch : v1beta1.Patch {
589
+ FromFieldPath : ptr.To [string ]("spec.widgets" ),
590
+ ToFieldPath : ptr.To [string ]("spec.watchers" ),
591
+ Transforms : []v1beta1.Transform {
592
+ {
593
+ Type : v1beta1 .TransformTypeConvert ,
594
+ Convert : & v1beta1.ConvertTransform {
595
+ ToType : v1beta1 .TransformIOTypeInt64 ,
596
+ },
585
597
},
586
- },
587
- {
588
- Type : v1beta1 .TransformTypeMath ,
589
- Math : & v1beta1.MathTransform {
590
- Type : v1beta1 . MathTransformTypeMultiply ,
591
- Multiply : ptr. To [ int64 ]( 3 ) ,
598
+ {
599
+ Type : v1beta1 . TransformTypeMath ,
600
+ Math : & v1beta1.MathTransform {
601
+ Type : v1beta1 .MathTransformTypeMultiply ,
602
+ Multiply : ptr. To [ int64 ]( 3 ) ,
603
+ } ,
592
604
},
593
605
},
594
606
},
0 commit comments