mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-12 03:26:30 +00:00
46 lines
928 B
Go
46 lines
928 B
Go
package builtin
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/drone/drone/engine/compiler/parse"
|
|
"github.com/drone/drone/engine/runner"
|
|
|
|
"github.com/franela/goblin"
|
|
)
|
|
|
|
func Test_args(t *testing.T) {
|
|
|
|
g := goblin.Goblin(t)
|
|
g.Describe("plugins arguments", func() {
|
|
|
|
g.It("should ignore non-plugin containers", func() {
|
|
root := parse.NewRootNode()
|
|
c := root.NewShellNode()
|
|
c.Container = runner.Container{}
|
|
c.Vargs = map[string]interface{}{
|
|
"depth": 50,
|
|
}
|
|
|
|
ops := NewArgsOp()
|
|
ops.VisitContainer(c)
|
|
|
|
g.Assert(c.Container.Environment["PLUGIN_DEPTH"]).Equal("")
|
|
})
|
|
|
|
g.It("should include args as environment variable", func() {
|
|
root := parse.NewRootNode()
|
|
c := root.NewPluginNode()
|
|
c.Container = runner.Container{}
|
|
c.Vargs = map[string]interface{}{
|
|
"depth": 50,
|
|
}
|
|
|
|
ops := NewArgsOp()
|
|
ops.VisitContainer(c)
|
|
|
|
g.Assert(c.Container.Environment["PLUGIN_DEPTH"]).Equal("50")
|
|
})
|
|
})
|
|
|
|
}
|