mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 11:51:02 +00:00
adb2c82790
https://go.dev/doc/modules/release-workflow#breaking Fixes https://github.com/woodpecker-ci/woodpecker/issues/2913 fixes #2654 ``` runephilosof@fedora:~/code/platform-woodpecker/woodpecker-repo-configurator (master)$ go get go.woodpecker-ci.org/woodpecker@v2.0.0 go: go.woodpecker-ci.org/woodpecker@v2.0.0: invalid version: module contains a go.mod file, so module path must match major version ("go.woodpecker-ci.org/woodpecker/v2") ``` --------- Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
52 lines
1,012 B
Go
52 lines
1,012 B
Go
package pipeline
|
|
|
|
import (
|
|
"testing"
|
|
|
|
sharedPipeline "go.woodpecker-ci.org/woodpecker/v2/pipeline"
|
|
"go.woodpecker-ci.org/woodpecker/v2/pipeline/backend/types"
|
|
"go.woodpecker-ci.org/woodpecker/v2/server/model"
|
|
)
|
|
|
|
func TestSetPipelineStepsOnPipeline(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
pipeline := &model.Pipeline{
|
|
ID: 1,
|
|
Event: model.EventPush,
|
|
}
|
|
|
|
pipelineItems := []*sharedPipeline.Item{{
|
|
Workflow: &model.Workflow{
|
|
PID: 1,
|
|
},
|
|
Config: &types.Config{
|
|
Stages: []*types.Stage{
|
|
{
|
|
Steps: []*types.Step{
|
|
{
|
|
Name: "clone",
|
|
},
|
|
},
|
|
},
|
|
{
|
|
Steps: []*types.Step{
|
|
{
|
|
Name: "step",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}}
|
|
pipeline = setPipelineStepsOnPipeline(pipeline, pipelineItems)
|
|
if len(pipeline.Workflows) != 1 {
|
|
t.Fatal("Should generate three in total")
|
|
}
|
|
if pipeline.Workflows[0].PipelineID != 1 {
|
|
t.Fatal("Should set workflow's pipeline ID")
|
|
}
|
|
if pipeline.Workflows[0].Children[0].PPID != 1 {
|
|
t.Fatal("Should set step PPID")
|
|
}
|
|
}
|