Skip to content

Commit

Permalink
add just more dag tests (#3083)
Browse files Browse the repository at this point in the history
  • Loading branch information
6543 authored Dec 30, 2023
1 parent c74dc9c commit 2cb7669
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions pipeline/frontend/yaml/compiler/dag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,73 @@ func TestConvertDAGToStages(t *testing.T) {
}
_, err = convertDAGToStages(steps, "")
assert.ErrorIs(t, err, &ErrStepMissingDependency{})

steps = map[string]*dagCompilerStep{
"echo env": {
position: 0,
name: "echo env",
group: "",
step: &backend_types.Step{
Name: "test_step_0",
UUID: "01HJDPEW6R7J0JBE3F1T7Q0TYX",
Type: "commands",
Alias: "echo env",
Image: "bash",
},
},
"echo 1": {
position: 1,
name: "echo 1",
group: "",
dependsOn: []string{"echo env", "echo 2"},
step: &backend_types.Step{
Name: "test_step_1",
UUID: "01HJDPF770QGRZER8RF79XVS4M",
Type: "commands",
Alias: "echo 1",
Image: "bash",
},
},
"echo 2": {
position: 2,
name: "echo 2",
group: "",
step: &backend_types.Step{
Name: "test_step_2",
UUID: "01HJDPFF5RMEYZW0YTGR1Y1ZR0",
Type: "commands",
Alias: "echo 2",
Image: "bash",
},
},
}
stages, err := convertDAGToStages(steps, "test")
assert.NoError(t, err)
assert.EqualValues(t, []*backend_types.Stage{{
Name: "test_stage_0",
Alias: "test_stage_0",
Steps: []*backend_types.Step{{
Name: "test_step_0",
UUID: "01HJDPEW6R7J0JBE3F1T7Q0TYX",
Type: "commands",
Alias: "echo env",
Image: "bash",
}, {
Name: "test_step_2",
UUID: "01HJDPFF5RMEYZW0YTGR1Y1ZR0",
Type: "commands",
Alias: "echo 2",
Image: "bash",
}},
}, {
Name: "test_stage_1",
Alias: "test_stage_1",
Steps: []*backend_types.Step{{
Name: "test_step_1",
UUID: "01HJDPF770QGRZER8RF79XVS4M",
Type: "commands",
Alias: "echo 1",
Image: "bash",
}},
}}, stages)
}

0 comments on commit 2cb7669

Please sign in to comment.