@@ -116,12 +116,10 @@ func mockBundle() *bundle.Bundle {
116
116
Type : []interface {}{"string" , "boolean" },
117
117
},
118
118
},
119
- Outputs : & bundle.OutputsDefinition {
120
- Fields : map [string ]bundle.OutputDefinition {
121
- "some-output" : {
122
- Path : "/tmp/some/path" ,
123
- Definition : "ParamOne" ,
124
- },
119
+ Outputs : map [string ]bundle.Output {
120
+ "some-output" : {
121
+ Path : "/tmp/some/path" ,
122
+ Definition : "ParamOne" ,
125
123
},
126
124
},
127
125
Parameters : map [string ]bundle.Parameter {
@@ -335,9 +333,9 @@ func TestSetOutputsOnClaim(t *testing.T) {
335
333
336
334
// Non strings given a good type should also work
337
335
t .Run ("null succeeds" , func (t * testing.T ) {
338
- field := c .Bundle .Outputs . Fields ["some-output" ]
339
- field .Definition = "NullParam"
340
- c .Bundle .Outputs . Fields ["some-output" ] = field
336
+ o := c .Bundle .Outputs ["some-output" ]
337
+ o .Definition = "NullParam"
338
+ c .Bundle .Outputs ["some-output" ] = o
341
339
output := map [string ]string {
342
340
"/tmp/some/path" : "null" ,
343
341
}
@@ -346,9 +344,9 @@ func TestSetOutputsOnClaim(t *testing.T) {
346
344
})
347
345
348
346
t .Run ("boolean succeeds" , func (t * testing.T ) {
349
- field := c .Bundle .Outputs . Fields ["some-output" ]
350
- field .Definition = "BooleanParam"
351
- c .Bundle .Outputs . Fields ["some-output" ] = field
347
+ o := c .Bundle .Outputs ["some-output" ]
348
+ o .Definition = "BooleanParam"
349
+ c .Bundle .Outputs ["some-output" ] = o
352
350
output := map [string ]string {
353
351
"/tmp/some/path" : "true" ,
354
352
}
@@ -357,9 +355,9 @@ func TestSetOutputsOnClaim(t *testing.T) {
357
355
})
358
356
359
357
t .Run ("object succeeds" , func (t * testing.T ) {
360
- field := c .Bundle .Outputs . Fields ["some-output" ]
361
- field .Definition = "ObjectParam"
362
- c .Bundle .Outputs . Fields ["some-output" ] = field
358
+ o := c .Bundle .Outputs ["some-output" ]
359
+ o .Definition = "ObjectParam"
360
+ c .Bundle .Outputs ["some-output" ] = o
363
361
output := map [string ]string {
364
362
"/tmp/some/path" : "{}" ,
365
363
}
@@ -368,9 +366,9 @@ func TestSetOutputsOnClaim(t *testing.T) {
368
366
})
369
367
370
368
t .Run ("array succeeds" , func (t * testing.T ) {
371
- field := c .Bundle .Outputs . Fields ["some-output" ]
369
+ field := c .Bundle .Outputs ["some-output" ]
372
370
field .Definition = "ArrayParam"
373
- c .Bundle .Outputs . Fields ["some-output" ] = field
371
+ c .Bundle .Outputs ["some-output" ] = field
374
372
output := map [string ]string {
375
373
"/tmp/some/path" : "[]" ,
376
374
}
@@ -379,9 +377,9 @@ func TestSetOutputsOnClaim(t *testing.T) {
379
377
})
380
378
381
379
t .Run ("number succeeds" , func (t * testing.T ) {
382
- field := c .Bundle .Outputs . Fields ["some-output" ]
380
+ field := c .Bundle .Outputs ["some-output" ]
383
381
field .Definition = "NumberParam"
384
- c .Bundle .Outputs . Fields ["some-output" ] = field
382
+ c .Bundle .Outputs ["some-output" ] = field
385
383
output := map [string ]string {
386
384
"/tmp/some/path" : "3.14" ,
387
385
}
@@ -390,9 +388,9 @@ func TestSetOutputsOnClaim(t *testing.T) {
390
388
})
391
389
392
390
t .Run ("integer as number succeeds" , func (t * testing.T ) {
393
- field := c .Bundle .Outputs . Fields ["some-output" ]
391
+ field := c .Bundle .Outputs ["some-output" ]
394
392
field .Definition = "NumberParam"
395
- c .Bundle .Outputs . Fields ["some-output" ] = field
393
+ c .Bundle .Outputs ["some-output" ] = field
396
394
output := map [string ]string {
397
395
"/tmp/some/path" : "372" ,
398
396
}
@@ -401,9 +399,9 @@ func TestSetOutputsOnClaim(t *testing.T) {
401
399
})
402
400
403
401
t .Run ("integer succeeds" , func (t * testing.T ) {
404
- field := c .Bundle .Outputs . Fields ["some-output" ]
405
- field .Definition = "IntegerParam"
406
- c .Bundle .Outputs . Fields ["some-output" ] = field
402
+ o := c .Bundle .Outputs ["some-output" ]
403
+ o .Definition = "IntegerParam"
404
+ c .Bundle .Outputs ["some-output" ] = o
407
405
output := map [string ]string {
408
406
"/tmp/some/path" : "372" ,
409
407
}
@@ -415,9 +413,9 @@ func TestSetOutputsOnClaim(t *testing.T) {
415
413
func TestSetOutputsOnClaim_MultipleTypes (t * testing.T ) {
416
414
c := newClaim ()
417
415
c .Bundle = mockBundle ()
418
- field := c .Bundle .Outputs . Fields ["some-output" ]
419
- field .Definition = "BooleanAndIntegerParam"
420
- c .Bundle .Outputs . Fields ["some-output" ] = field
416
+ o := c .Bundle .Outputs ["some-output" ]
417
+ o .Definition = "BooleanAndIntegerParam"
418
+ c .Bundle .Outputs ["some-output" ] = o
421
419
422
420
t .Run ("BooleanOrInteger, so boolean succeeds" , func (t * testing.T ) {
423
421
output := map [string ]string {
@@ -442,9 +440,9 @@ func TestSetOutputsOnClaim_MultipleTypes(t *testing.T) {
442
440
func TestSetOutputsOnClaim_MultipleTypesWithString (t * testing.T ) {
443
441
c := newClaim ()
444
442
c .Bundle = mockBundle ()
445
- field := c .Bundle .Outputs . Fields ["some-output" ]
446
- field .Definition = "StringAndBooleanParam"
447
- c .Bundle .Outputs . Fields ["some-output" ] = field
443
+ o := c .Bundle .Outputs ["some-output" ]
444
+ o .Definition = "StringAndBooleanParam"
445
+ c .Bundle .Outputs ["some-output" ] = o
448
446
449
447
t .Run ("null succeeds" , func (t * testing.T ) {
450
448
output := map [string ]string {
@@ -467,9 +465,9 @@ func TestSetOutputsOnClaim_MismatchType(t *testing.T) {
467
465
c := newClaim ()
468
466
c .Bundle = mockBundle ()
469
467
470
- field := c .Bundle .Outputs . Fields ["some-output" ]
471
- field .Definition = "BooleanParam"
472
- c .Bundle .Outputs . Fields ["some-output" ] = field
468
+ o := c .Bundle .Outputs ["some-output" ]
469
+ o .Definition = "BooleanParam"
470
+ c .Bundle .Outputs ["some-output" ] = o
473
471
474
472
t .Run ("error case: content type does not match output definition" , func (t * testing.T ) {
475
473
invalidParsableOutput := map [string ]string {
0 commit comments