mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-05 15:18:43 +00:00
Add TestPipelineName
to procBuilder_test.go
(#461)
test for a bug where pipelines that use `depends_on` were not built in multi-pipeline builds. The problem is that pipelines names keep a leading `'/'` when the pipeline path does not have a trailing `'/'`.
This commit is contained in:
parent
bbbb53b9bc
commit
fd8e0b248b
1 changed files with 35 additions and 0 deletions
|
@ -174,6 +174,41 @@ runs_on:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestPipelineName(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
b := ProcBuilder{
|
||||||
|
Repo: &model.Repo{Config: ".woodpecker"},
|
||||||
|
Curr: &model.Build{},
|
||||||
|
Last: &model.Build{},
|
||||||
|
Netrc: &model.Netrc{},
|
||||||
|
Secs: []*model.Secret{},
|
||||||
|
Regs: []*model.Registry{},
|
||||||
|
Link: "",
|
||||||
|
Yamls: []*remote.FileMeta{
|
||||||
|
&remote.FileMeta{Name: ".woodpecker/lint.yml", Data: []byte(`
|
||||||
|
pipeline:
|
||||||
|
build:
|
||||||
|
image: scratch
|
||||||
|
`)},
|
||||||
|
&remote.FileMeta{Name: ".woodpecker/.test.yml", Data: []byte(`
|
||||||
|
pipeline:
|
||||||
|
build:
|
||||||
|
image: scratch
|
||||||
|
`)},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
buildItems, err := b.Build()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
pipelineNames := []string{buildItems[0].Proc.Name, buildItems[1].Proc.Name}
|
||||||
|
if !containsItemWithName("lint", buildItems) || !containsItemWithName("test", buildItems) {
|
||||||
|
t.Fatalf("Pipeline name should be 'lint' and 'test' but are '%v'", pipelineNames)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestBranchFilter(t *testing.T) {
|
func TestBranchFilter(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue