mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-30 08:06:52 +02:00
Add test for variable expansion
This commit is contained in:
parent
27e807bcda
commit
107867c771
@ -37,6 +37,19 @@ func TestParse(t *testing.T) {
|
||||
g.Assert(out.Pipeline[2].Name).Equal("notify")
|
||||
g.Assert(out.Pipeline[2].Image).Equal("slack")
|
||||
})
|
||||
// Check to make sure variable expansion works in yaml.MapSlice
|
||||
g.It("Should unmarshal variables", func() {
|
||||
out, err := ParseString(sampleVarYaml)
|
||||
if err != nil {
|
||||
g.Fail(err)
|
||||
}
|
||||
g.Assert(out.Pipeline[0].Name).Equal("notify_fail")
|
||||
g.Assert(out.Pipeline[0].Image).Equal("plugins/slack")
|
||||
g.Assert(len(out.Pipeline[0].Constraints.Event.Include)).Equal(0)
|
||||
g.Assert(out.Pipeline[1].Name).Equal("notify_success")
|
||||
g.Assert(out.Pipeline[1].Image).Equal("plugins/slack")
|
||||
g.Assert(out.Pipeline[1].Constraints.Event.Include).Equal([]string{"success"})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -81,3 +94,15 @@ volumes:
|
||||
custom:
|
||||
driver: blockbridge
|
||||
`
|
||||
|
||||
var sampleVarYaml = `
|
||||
_slack: &SLACK
|
||||
image: plugins/slack
|
||||
|
||||
pipeline:
|
||||
notify_fail: *SLACK
|
||||
notify_success:
|
||||
<< : *SLACK
|
||||
when:
|
||||
event: success
|
||||
`
|
||||
|
Loading…
Reference in New Issue
Block a user