1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-12-24 10:07:21 +02:00

add just more dag tests (#3083)

This commit is contained in:
6543 2023-12-30 16:45:11 +01:00 committed by GitHub
parent c74dc9ce92
commit 2cb7669413
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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