@@ -1308,7 +1308,7 @@ func TestDAGExecutionQueueSequentialRuns(t *testing.T) {
1308
1308
}
1309
1309
1310
1310
func TestPipelineRunState_CompletedOrSkippedDAGTasks (t * testing.T ) {
1311
- largePipelineState := buildPipelineStateWithLargeDepencyGraph (t )
1311
+ largePipelineState := buildPipelineStateWithLargeDependencyGraph (t )
1312
1312
tcs := []struct {
1313
1313
name string
1314
1314
state PipelineRunState
@@ -1353,6 +1353,14 @@ func TestPipelineRunState_CompletedOrSkippedDAGTasks(t *testing.T) {
1353
1353
name : "large deps, not started" ,
1354
1354
state : largePipelineState ,
1355
1355
expectedNames : []string {},
1356
+ }, {
1357
+ name : "large deps through params, not started" ,
1358
+ state : buildPipelineStateWithMultipleTaskResults (t , false ),
1359
+ expectedNames : []string {},
1360
+ }, {
1361
+ name : "large deps through params and when expressions, not started" ,
1362
+ state : buildPipelineStateWithMultipleTaskResults (t , true ),
1363
+ expectedNames : []string {},
1356
1364
}, {
1357
1365
name : "one-run-started" ,
1358
1366
state : oneRunStartedState ,
@@ -1386,7 +1394,7 @@ func TestPipelineRunState_CompletedOrSkippedDAGTasks(t *testing.T) {
1386
1394
}
1387
1395
}
1388
1396
1389
- func buildPipelineStateWithLargeDepencyGraph (t * testing.T ) PipelineRunState {
1397
+ func buildPipelineStateWithLargeDependencyGraph (t * testing.T ) PipelineRunState {
1390
1398
t .Helper ()
1391
1399
var task = & v1beta1.Task {
1392
1400
ObjectMeta : metav1.ObjectMeta {
@@ -1445,6 +1453,74 @@ func buildPipelineStateWithLargeDepencyGraph(t *testing.T) PipelineRunState {
1445
1453
return pipelineRunState
1446
1454
}
1447
1455
1456
+ func buildPipelineStateWithMultipleTaskResults (t * testing.T , includeWhen bool ) PipelineRunState {
1457
+ t .Helper ()
1458
+ var task = & v1beta1.Task {
1459
+ ObjectMeta : metav1.ObjectMeta {
1460
+ Name : "task" ,
1461
+ },
1462
+ Spec : v1beta1.TaskSpec {
1463
+ Steps : []v1beta1.Step {{
1464
+ Name : "step1" ,
1465
+ }},
1466
+ },
1467
+ }
1468
+ var pipelineRunState PipelineRunState
1469
+ pipelineRunState = []* ResolvedPipelineTask {{
1470
+ PipelineTask : & v1beta1.PipelineTask {
1471
+ Name : "t1" ,
1472
+ TaskRef : & v1beta1.TaskRef {Name : "task" },
1473
+ },
1474
+ TaskRun : nil ,
1475
+ ResolvedTaskResources : & resources.ResolvedTaskResources {
1476
+ TaskSpec : & task .Spec ,
1477
+ },
1478
+ }}
1479
+ for i := 2 ; i < 400 ; i ++ {
1480
+ var params []v1beta1.Param
1481
+ whenExpressions := v1beta1.WhenExpressions {}
1482
+ var alpha byte
1483
+ // the task has a reference to multiple task results (a through j) from each parent task - causing a redundant references
1484
+ // the task dependents on all predecessors in a graph through params and/or whenExpressions
1485
+ for j := 1 ; j < i ; j ++ {
1486
+ for alpha = 'a' ; alpha <= 'j' ; alpha ++ {
1487
+ // include param with task results
1488
+ params = append (params , v1beta1.Param {
1489
+ Name : fmt .Sprintf ("%c" , alpha ),
1490
+ Value : v1beta1.ArrayOrString {
1491
+ Type : v1beta1 .ParamTypeString ,
1492
+ StringVal : fmt .Sprintf ("$(tasks.t%d.results.%c)" , j , alpha ),
1493
+ },
1494
+ })
1495
+ }
1496
+ if includeWhen {
1497
+ for alpha = 'a' ; alpha <= 'j' ; alpha ++ {
1498
+ // include when expressions with task results
1499
+ whenExpressions = append (whenExpressions , v1beta1.WhenExpression {
1500
+ Input : fmt .Sprintf ("$(tasks.t%d.results.%c)" , j , alpha ),
1501
+ Operator : selection .In ,
1502
+ Values : []string {"true" },
1503
+ })
1504
+ }
1505
+ }
1506
+ }
1507
+ pipelineRunState = append (pipelineRunState , & ResolvedPipelineTask {
1508
+ PipelineTask : & v1beta1.PipelineTask {
1509
+ Name : fmt .Sprintf ("t%d" , i ),
1510
+ Params : params ,
1511
+ TaskRef : & v1beta1.TaskRef {Name : "task" },
1512
+ WhenExpressions : whenExpressions ,
1513
+ },
1514
+ TaskRun : nil ,
1515
+ ResolvedTaskResources : & resources.ResolvedTaskResources {
1516
+ TaskSpec : & task .Spec ,
1517
+ },
1518
+ },
1519
+ )
1520
+ }
1521
+ return pipelineRunState
1522
+ }
1523
+
1448
1524
func TestPipelineRunState_GetFinalTasks (t * testing.T ) {
1449
1525
tcs := []struct {
1450
1526
name string
0 commit comments