Skip to content

Commit

Permalink
path_util: Allowing ParallelRuns=0
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Hinderberger committed Jun 7, 2024
1 parent 982a026 commit 33bed31
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/lib/util/path_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func ParsePathSpec(s string) (spec PathSpec, err error) {
spec.ParallelRuns = 1
}

if !ok || spec.Path == "" || spec.ParallelRuns <= 0 {
if !ok || spec.Path == "" || spec.ParallelRuns < 0 {
return PathSpec{}, fmt.Errorf("invalid path spec %q", s)
}

Expand Down
9 changes: 8 additions & 1 deletion pkg/lib/util/path_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ func TestParsePathSpec(t *testing.T) {
Path: "baz.json",
},
},
{
s: "0@foobar.json",
expected: PathSpec{
ParallelRuns: 0,
Path: "foobar.json",
},
},
}

for i := range testCases {
Expand All @@ -51,7 +58,7 @@ func TestParsePathSpec(t *testing.T) {
"", // empty
"foo@bar.baz", "1.23@foo.json", // non-digit parallel runs
"p@old.syntax", "p5@old.syntax", "p123@old.syntax", // old syntax
"0@foo.json", "-1@foo.json", "-123@foo.json", // zero or negative parallel runs
"-1@foo.json", "-123@foo.json", // negative parallel runs
}

for _, testCase := range testCases {
Expand Down

0 comments on commit 33bed31

Please sign in to comment.