@@ -332,7 +332,10 @@ func TestValidateGroup(t *testing.T) {
332
332
component := "alias1"
333
333
334
334
noDefaultCmdErr := ".*there should be exactly one default command, currently there is no default command"
335
- multipleDefaultCmdErr := ".*there should be exactly one default command, currently there is more than one default command"
335
+ multipleDefaultError := ".*there should be exactly one default command, currently there is more than one default command"
336
+ multipleDefaultCmdErr := multipleDefaultError + "; command: run command; command: customcommand"
337
+ invalidCmdErrWithImportAttributes := multipleDefaultError +
338
+ "; command: run command; command: customcommand, imported from uri: http://127.0.0.1:8080, in parent overrides from main devfile"
336
339
337
340
tests := []struct {
338
341
name string
@@ -347,6 +350,30 @@ func TestValidateGroup(t *testing.T) {
347
350
},
348
351
wantErr : & multipleDefaultCmdErr ,
349
352
},
353
+ {
354
+ name : "Two default run commands with import source attribute" ,
355
+ commands : []v1alpha2.Command {
356
+ generateDummyExecCommand ("run command" , component , & v1alpha2.CommandGroup {Kind : runGroup , IsDefault : true }),
357
+ {
358
+ Attributes : attributes.Attributes {}.PutString (ImportSourceAttribute ,
359
+ "uri: http://127.0.0.1:8080" ).PutString (ParentOverrideAttribute , "main devfile" ),
360
+ Id : "customcommand" ,
361
+ CommandUnion : v1alpha2.CommandUnion {
362
+ Exec : & v1alpha2.ExecCommand {
363
+ LabeledCommand : v1alpha2.LabeledCommand {
364
+ BaseCommand : v1alpha2.BaseCommand {
365
+ Group : & v1alpha2.CommandGroup {Kind : runGroup , IsDefault : true },
366
+ },
367
+ },
368
+ CommandLine : "command" ,
369
+ Component : component ,
370
+ WorkingDir : "workDir" ,
371
+ },
372
+ },
373
+ },
374
+ },
375
+ wantErr : & invalidCmdErrWithImportAttributes ,
376
+ },
350
377
{
351
378
name : "No default for more than one build commands" ,
352
379
commands : []v1alpha2.Command {
0 commit comments