mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-09-15 18:57:01 +00:00
fix: tolerate strings for fail-fast, max-parallel, timeout-minutes, cancel-timeout-minutes (#203)
- the model defines them as strings and can parse them either as string or their effective type (boolean, number) - add workflow validation when reading all testdata - add fail-fast, max-parallel, timeout-minutes, cancel-timeout-minutes to test workflows in the jobparser tests Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/203 Reviewed-by: Michael Kriese <michael.kriese@gmx.de> Co-authored-by: Earl Warren <contact@earl-warren.org> Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
parent
82dea3fdda
commit
57524e90f1
6 changed files with 73 additions and 8 deletions
|
@ -1,10 +1,13 @@
|
|||
package jobparser
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"embed"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/nektos/act/pkg/model"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
@ -12,7 +15,11 @@ import (
|
|||
var testdata embed.FS
|
||||
|
||||
func ReadTestdata(t *testing.T, name string) []byte {
|
||||
content, err := testdata.ReadFile(filepath.Join("testdata", name))
|
||||
require.NoError(t, err)
|
||||
t.Helper()
|
||||
filename := filepath.Join("testdata", name)
|
||||
content, err := testdata.ReadFile(filename)
|
||||
require.NoError(t, err, filename)
|
||||
_, err = model.ReadWorkflow(bytes.NewReader(content), true)
|
||||
require.NoError(t, err, filename)
|
||||
return content
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue