forked from flyteorg/flyte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow multiple arguments to be substituted in one run (flyteorg#92)
- Loading branch information
Ketan Umare
authored
May 26, 2020
1 parent
37469ac
commit c0f3135
Showing
8 changed files
with
153 additions
and
29 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
flyteplugins/go/tasks/pluginmachinery/utils/error_collection.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package utils | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
) | ||
|
||
type ErrorCollection struct { | ||
Errors []error | ||
} | ||
|
||
func (e ErrorCollection) Error() string { | ||
sb := strings.Builder{} | ||
for idx, err := range e.Errors { | ||
sb.WriteString(fmt.Sprintf("%v: %v\r\n", idx, err)) | ||
} | ||
|
||
return sb.String() | ||
} |
22 changes: 22 additions & 0 deletions
22
flyteplugins/go/tasks/pluginmachinery/utils/error_collection_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package utils | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestErrorCollection(t *testing.T) { | ||
ec := ErrorCollection{} | ||
|
||
assert.Empty(t, ec.Error()) | ||
|
||
ec.Errors = append(ec.Errors, fmt.Errorf("error1")) | ||
assert.NotEmpty(t, ec.Error()) | ||
|
||
ec.Errors = append(ec.Errors, fmt.Errorf("error2")) | ||
assert.NotEmpty(t, ec.Error()) | ||
|
||
assert.Equal(t, "0: error1\r\n1: error2\r\n", ec.Error()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters