-
Notifications
You must be signed in to change notification settings - Fork 680
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flytepropeller][flyteadmin] Compiler unknown literal type error hand…
…ling (#5651) * [propeller][admin] Compiler literal type error handling Signed-off-by: Future-Outlier <eric901201@gmail.com> * support all err msg Signed-off-by: Future-Outlier <eric901201@gmail.com> * add execution_validator tests Signed-off-by: Future-Outlier <eric901201@gmail.com> * add launch_plan_validator tests Signed-off-by: Future-Outlier <eric901201@gmail.com> * add tests for signal_validator Signed-off-by: Future-Outlier <eric901201@gmail.com> * change var Signed-off-by: Future-Outlier <eric901201@gmail.com> * add tests for compiler_errors Signed-off-by: Future-Outlier <eric901201@gmail.com> * support nodes/array/handler.go Signed-off-by: Future-Outlier <eric901201@gmail.com> * fix imports Signed-off-by: Future-Outlier <eric901201@gmail.com> * add tests for k8s/inputs and catalog/datacatalog/transformer Signed-off-by: Future-Outlier <eric901201@gmail.com> * kevin's change Signed-off-by: Kevin Su <pingsutw@apache.org> * update all pingsu's interface Signed-off-by: Future-Outlier <eric901201@gmail.com> * Trigger Build Signed-off-by: Future-Outlier <eric901201@gmail.com> * update pingsu's advice Signed-off-by: Future-Outlier <eric901201@gmail.com> Co-authored-by: pingsutw <pingsutw@apache.org> * nit Signed-off-by: Future-Outlier <eric901201@gmail.com> * use InvalidLiteralTypeErr instead of NewIDLTypeNotFoundErr Signed-off-by: Future-Outlier <eric901201@gmail.com> * nit Signed-off-by: Kevin Su <pingsutw@apache.org> --------- Signed-off-by: Future-Outlier <eric901201@gmail.com> Signed-off-by: Kevin Su <pingsutw@apache.org> Co-authored-by: Kevin Su <pingsutw@apache.org>
- Loading branch information
1 parent
c255605
commit 66ff152
Showing
19 changed files
with
358 additions
and
26 deletions.
There are no files selected for viewing
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
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
54 changes: 54 additions & 0 deletions
54
flytepropeller/pkg/compiler/transformers/k8s/inputs_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 |
---|---|---|
@@ -1 +1,55 @@ | ||
package k8s | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core" | ||
"github.com/flyteorg/flyte/flytepropeller/pkg/compiler/common" | ||
"github.com/flyteorg/flyte/flytepropeller/pkg/compiler/errors" | ||
) | ||
|
||
func TestValidateInputs_InvalidLiteralType(t *testing.T) { | ||
nodeID := common.NodeID("test-node") | ||
|
||
iface := &core.TypedInterface{ | ||
Inputs: &core.VariableMap{ | ||
Variables: map[string]*core.Variable{ | ||
"input1": { | ||
Type: &core.LiteralType{ | ||
Type: &core.LiteralType_Simple{ | ||
Simple: 1000, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
inputs := core.LiteralMap{ | ||
Literals: map[string]*core.Literal{ | ||
"input1": nil, // Set this to nil to trigger the nil case | ||
}, | ||
} | ||
|
||
errs := errors.NewCompileErrors() | ||
ok := validateInputs(nodeID, iface, inputs, errs) | ||
|
||
assert.False(t, ok) | ||
assert.True(t, errs.HasErrors()) | ||
|
||
idlNotFound := false | ||
var errMsg string | ||
for _, err := range errs.Errors().List() { | ||
if err.Code() == "InvalidLiteralType" { | ||
idlNotFound = true | ||
errMsg = err.Error() | ||
break | ||
} | ||
} | ||
assert.True(t, idlNotFound, "Expected InvalidLiteralType error was not found in errors") | ||
|
||
expectedContainedErrorMsg := "Failed to validate literal type" | ||
assert.Contains(t, errMsg, expectedContainedErrorMsg) | ||
} |
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
Oops, something went wrong.