mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-22 09:51:01 +00:00
add just more dag tests (#3083)
This commit is contained in:
parent
c74dc9ce92
commit
2cb7669413
1 changed files with 69 additions and 0 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue