MCPcopy Create free account
hub / github.com/github/gh-aw / TestJobManager_AddJob

Function TestJobManager_AddJob

pkg/workflow/jobs_test.go:10–95  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestJobManager_AddJob(t *testing.T) {
11 jm := NewJobManager()
12
13 tests := []struct {
14 name string
15 job *Job
16 wantErr bool
17 errMsg string
18 }{
19 {
20 name: "valid job",
21 job: &Job{
22 Name: "test-job",
23 RunsOn: "ubuntu-latest",
24 },
25 wantErr: false,
26 },
27 {
28 name: "empty job name",
29 job: &Job{
30 Name: "",
31 RunsOn: "ubuntu-latest",
32 },
33 wantErr: true,
34 errMsg: "job name cannot be empty",
35 },
36 {
37 name: "duplicate job name",
38 job: &Job{
39 Name: "test-job", // Same name as first test
40 RunsOn: "windows-latest",
41 },
42 wantErr: true,
43 errMsg: "job 'test-job' already exists",
44 },
45 {
46 name: "reusable workflow caller cannot set timeout-minutes",
47 job: &Job{
48 Name: "call-reusable",
49 Uses: "./.github/workflows/reusable.yml",
50 TimeoutMinutes: 10,
51 },
52 wantErr: true,
53 errMsg: "uses a reusable workflow and cannot set timeout-minutes",
54 },
55 {
56 name: "reusable workflow caller cannot set templated timeout-minutes",
57 job: &Job{
58 Name: "call-reusable-templated",
59 Uses: "./.github/workflows/reusable.yml",
60 TimeoutMinutesExpression: "${{ inputs.timeout }}",
61 },
62 wantErr: true,
63 errMsg: "uses a reusable workflow and cannot set timeout-minutes",
64 },
65 {
66 name: "cannot set timeout-minutes as both integer and expression",
67 job: &Job{

Callers

nothing calls this directly

Calls 5

AddJobMethod · 0.95
NewJobManagerFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected