From 2cb7669413965f99cad7c3817411eb3747474cf6 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sat, 30 Dec 2023 16:45:11 +0100 Subject: [PATCH] add just more dag tests (#3083) --- pipeline/frontend/yaml/compiler/dag_test.go | 69 +++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/pipeline/frontend/yaml/compiler/dag_test.go b/pipeline/frontend/yaml/compiler/dag_test.go index e5a9d975d..86131b1d0 100644 --- a/pipeline/frontend/yaml/compiler/dag_test.go +++ b/pipeline/frontend/yaml/compiler/dag_test.go @@ -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) }