Select and check downstream preflight targets

This commit is contained in:
2026-11-27 16:41:09 +00:00
parent 2db2554d1e
commit b9b154e59e
5 changed files with 165 additions and 1 deletions

View File

@@ -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)
}
}