Select and check downstream preflight targets
This commit is contained in:
@@ -127,3 +127,27 @@ func TestInspectionTargetsExpandSelectedFamilyAndIgnoreUnrelatedRange(t *testing
|
||||
t.Fatalf("unrelated targets = %+v, error = %v", targets, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDownstreamTargetSelectionForPolish(t *testing.T) {
|
||||
cfg := &config.Config{Pipeline: &config.PipelineConfig{}}
|
||||
for _, tc := range []struct {
|
||||
name string
|
||||
stages []projectedStage
|
||||
want bool
|
||||
}{
|
||||
{"selected", []projectedStage{{Name: "polish", Decision: preExecutionDecision{action: stageActionRun}}}, true},
|
||||
{"reused", []projectedStage{{Name: "polish", Decision: preExecutionDecision{action: stageActionSkip}}}, false},
|
||||
{"unrelated", []projectedStage{{Name: "prepare", Decision: preExecutionDecision{action: stageActionRun}}}, false},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
got, err := executionDownstreamTargets(cfg, "session", &workProjection{Stages: tc.stages})
|
||||
if err != nil || got.Polish != tc.want || len(got.Scriptorium) != 0 {
|
||||
t.Fatalf("targets: %+v %v", got, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
got, err := validationDownstreamTargets(cfg, "session")
|
||||
if err != nil || !got.Polish {
|
||||
t.Fatalf("validation targets: %+v %v", got, err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user