feat: add parallel test execution to improve runtime (#1882)

This commit is contained in:
christiandins
2024-12-12 01:47:10 +01:00
committed by GitHub
parent b9a5d1c573
commit 4dffab2e0a
14 changed files with 441 additions and 34 deletions

View File

@@ -8,6 +8,8 @@ import (
)
func TestPlatformParsing(t *testing.T) {
t.Parallel()
tests := []struct {
Input string
ExpectedOS string
@@ -34,6 +36,8 @@ func TestPlatformParsing(t *testing.T) {
for _, test := range tests {
t.Run(test.Input, func(t *testing.T) {
t.Parallel()
var p Platform
err := p.parsePlatform(test.Input)

View File

@@ -11,6 +11,8 @@ import (
)
func TestPreconditionParse(t *testing.T) {
t.Parallel()
tests := []struct {
content string
v any

View File

@@ -12,6 +12,8 @@ import (
)
func TestCmdParse(t *testing.T) {
t.Parallel()
const (
yamlCmd = `echo "a string command"`
yamlDep = `"task-name"`

View File

@@ -7,6 +7,8 @@ import (
)
func TestGitNode_ssh(t *testing.T) {
t.Parallel()
node, err := NewGitNode("git@github.com:foo/bar.git//Taskfile.yml?ref=main", "", false)
assert.NoError(t, err)
assert.Equal(t, "main", node.ref)
@@ -19,6 +21,8 @@ func TestGitNode_ssh(t *testing.T) {
}
func TestGitNode_sshWithDir(t *testing.T) {
t.Parallel()
node, err := NewGitNode("git@github.com:foo/bar.git//directory/Taskfile.yml?ref=main", "", false)
assert.NoError(t, err)
assert.Equal(t, "main", node.ref)
@@ -31,6 +35,8 @@ func TestGitNode_sshWithDir(t *testing.T) {
}
func TestGitNode_https(t *testing.T) {
t.Parallel()
node, err := NewGitNode("https://github.com/foo/bar.git//Taskfile.yml?ref=main", "", false)
assert.NoError(t, err)
assert.Equal(t, "main", node.ref)
@@ -43,6 +49,8 @@ func TestGitNode_https(t *testing.T) {
}
func TestGitNode_httpsWithDir(t *testing.T) {
t.Parallel()
node, err := NewGitNode("https://github.com/foo/bar.git//directory/Taskfile.yml?ref=main", "", false)
assert.NoError(t, err)
assert.Equal(t, "main", node.ref)
@@ -55,6 +63,8 @@ func TestGitNode_httpsWithDir(t *testing.T) {
}
func TestGitNode_FilenameAndDir(t *testing.T) {
t.Parallel()
node, err := NewGitNode("https://github.com/foo/bar.git//directory/Taskfile.yml?ref=main", "", false)
assert.NoError(t, err)
filename, dir := node.FilenameAndLastDir()

View File

@@ -7,6 +7,8 @@ import (
)
func TestScheme(t *testing.T) {
t.Parallel()
scheme, err := getScheme("https://github.com/foo/bar.git")
assert.NoError(t, err)
assert.Equal(t, "git", scheme)