(t *testing.T)
| 13 | ) |
| 14 | |
| 15 | func TestConclusionJob(t *testing.T) { |
| 16 | tests := []struct { |
| 17 | name string |
| 18 | addCommentConfig bool |
| 19 | aiReaction string |
| 20 | command []string |
| 21 | safeOutputJobNames []string |
| 22 | expectJob bool |
| 23 | expectConditions []string |
| 24 | expectNeeds []string |
| 25 | expectUpdateStep bool // whether to expect the "Update reaction comment" step |
| 26 | }{ |
| 27 | { |
| 28 | name: "conclusion job created when add-comment and ai-reaction are configured", |
| 29 | addCommentConfig: true, |
| 30 | aiReaction: "eyes", |
| 31 | command: nil, |
| 32 | safeOutputJobNames: []string{"add_comment", "create_issue", "missing_tool"}, |
| 33 | expectJob: true, |
| 34 | expectUpdateStep: false, // No automatic bundling - status-comment must be explicit |
| 35 | expectConditions: []string{ |
| 36 | "always()", |
| 37 | "needs.agent.result != 'skipped'", |
| 38 | "!(needs.add_comment.outputs.comment_id)", |
| 39 | }, |
| 40 | expectNeeds: []string{string(constants.AgentJobName), string(constants.ActivationJobName), "add_comment", "create_issue", "missing_tool"}, |
| 41 | }, |
| 42 | { |
| 43 | name: "conclusion job depends on all safe output jobs", |
| 44 | addCommentConfig: true, |
| 45 | aiReaction: "eyes", |
| 46 | command: nil, |
| 47 | safeOutputJobNames: []string{"add_comment", "create_issue", "missing_tool"}, |
| 48 | expectJob: true, |
| 49 | expectUpdateStep: false, // No automatic bundling - status-comment must be explicit |
| 50 | expectConditions: []string{ |
| 51 | "always()", |
| 52 | "needs.agent.result != 'skipped'", |
| 53 | "!(needs.add_comment.outputs.comment_id)", |
| 54 | }, |
| 55 | expectNeeds: []string{string(constants.AgentJobName), string(constants.ActivationJobName), "add_comment", "create_issue", "missing_tool"}, |
| 56 | }, |
| 57 | { |
| 58 | name: "conclusion job not created when add-comment is not configured", |
| 59 | addCommentConfig: false, |
| 60 | aiReaction: "", |
| 61 | command: nil, |
| 62 | safeOutputJobNames: []string{}, |
| 63 | expectJob: false, |
| 64 | expectUpdateStep: false, |
| 65 | }, |
| 66 | { |
| 67 | name: "conclusion job created when add-comment is configured but ai-reaction is not", |
| 68 | addCommentConfig: true, |
| 69 | aiReaction: "", |
| 70 | command: nil, |
| 71 | safeOutputJobNames: []string{"add_comment", "missing_tool"}, |
| 72 | expectJob: true, |
nothing calls this directly
no test coverage detected