mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-09-27 22:12:00 +00:00
Testing procBuilder
This commit is contained in:
parent
c9f2346c2c
commit
df50b7ef40
1 changed files with 46 additions and 1 deletions
|
@ -15,6 +15,7 @@
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/laszlocph/drone-oss-08/model"
|
"github.com/laszlocph/drone-oss-08/model"
|
||||||
|
@ -36,11 +37,55 @@ bbb`,
|
||||||
xxx:
|
xxx:
|
||||||
image: scratch
|
image: scratch
|
||||||
yyy: ${DRONE_COMMIT_MESSAGE}
|
yyy: ${DRONE_COMMIT_MESSAGE}
|
||||||
|
`, `pipeline:
|
||||||
|
build:
|
||||||
|
image: scratch
|
||||||
|
yyy: ${DRONE_COMMIT_MESSAGE}
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := b.Build(); err != nil {
|
if buildItems, err := b.Build(); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
} else {
|
||||||
|
fmt.Println(buildItems)
|
||||||
|
build := &model.Build{}
|
||||||
|
setBuildProcs(build, buildItems)
|
||||||
|
fmt.Println(build)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestMultiPipeline(t *testing.T) {
|
||||||
|
b := procBuilder{
|
||||||
|
Repo: &model.Repo{},
|
||||||
|
Curr: &model.Build{},
|
||||||
|
Last: &model.Build{},
|
||||||
|
Netrc: &model.Netrc{},
|
||||||
|
Secs: []*model.Secret{},
|
||||||
|
Regs: []*model.Registry{},
|
||||||
|
Link: "",
|
||||||
|
Yamls: []string{`pipeline:
|
||||||
|
lint:
|
||||||
|
image: scratch
|
||||||
|
yyy: ${DRONE_COMMIT_MESSAGE}
|
||||||
|
`, `pipeline:
|
||||||
|
test:
|
||||||
|
image: scratch
|
||||||
|
yyy: ${DRONE_COMMIT_MESSAGE}
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
buildItems, err := b.Build()
|
||||||
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
if len(buildItems) != 2 {
|
||||||
|
t.Fatal("Should have generated 2 buildItems")
|
||||||
|
}
|
||||||
|
|
||||||
|
// fmt.Println(buildItems)
|
||||||
|
// build := &model.Build{}
|
||||||
|
// setBuildProcs(build, buildItems)
|
||||||
|
// fmt.Println(build)
|
||||||
}
|
}
|
Loading…
Reference in a new issue