1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-08-06 17:40:58 +00:00
forgejo-runner/act/jobparser/testdata_test.go
Earl Warren 57524e90f1 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>
2025-07-27 10:06:07 +00:00

25 lines
501 B
Go

package jobparser
import (
"bytes"
"embed"
"path/filepath"
"testing"
"github.com/nektos/act/pkg/model"
"github.com/stretchr/testify/require"
)
//go:embed testdata
var testdata embed.FS
func ReadTestdata(t *testing.T, name string) []byte {
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
}