mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-03-20 03:46:09 +08:00
test: missing shell property in composite action (#20)
Make sure we report schema errors consistently Reviewed-on: https://gitea.com/actions-oss/act-cli/pulls/20 Co-authored-by: Christopher Homberger <christopher.homberger@web.de> Co-committed-by: Christopher Homberger <christopher.homberger@web.de>
This commit is contained in:
committed by
ChristopherHX
parent
ce0890578a
commit
0cdc6fd88b
@@ -223,3 +223,41 @@ jobs:
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestActionSchemaErrors(t *testing.T) {
|
||||||
|
table := []struct {
|
||||||
|
name string // test name
|
||||||
|
input string // workflow yaml input
|
||||||
|
err string // error message substring
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "missing property shell",
|
||||||
|
input: `
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- run: echo failure
|
||||||
|
`,
|
||||||
|
err: "missing property shell",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, test := range table {
|
||||||
|
t.Run(test.name, func(t *testing.T) {
|
||||||
|
var node yaml.Node
|
||||||
|
err := yaml.Unmarshal([]byte(test.input), &node)
|
||||||
|
if !assert.NoError(t, err) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = (&Node{
|
||||||
|
Definition: "action-root",
|
||||||
|
Schema: GetActionSchema(),
|
||||||
|
}).UnmarshalYAML(&node)
|
||||||
|
if test.err != "" {
|
||||||
|
assert.ErrorContains(t, err, test.err)
|
||||||
|
} else {
|
||||||
|
assert.NoError(t, err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user