-
Notifications
You must be signed in to change notification settings - Fork 669
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 <[email protected]> * support all err msg Signed-off-by: Future-Outlier <[email protected]> * add execution_validator tests Signed-off-by: Future-Outlier <[email protected]> * add launch_plan_validator tests Signed-off-by: Future-Outlier <[email protected]> * add tests for signal_validator Signed-off-by: Future-Outlier <[email protected]> * change var Signed-off-by: Future-Outlier <[email protected]> * add tests for compiler_errors Signed-off-by: Future-Outlier <[email protected]> * support nodes/array/handler.go Signed-off-by: Future-Outlier <[email protected]> * fix imports Signed-off-by: Future-Outlier <[email protected]> * add tests for k8s/inputs and catalog/datacatalog/transformer Signed-off-by: Future-Outlier <[email protected]> * kevin's change Signed-off-by: Kevin Su <[email protected]> * update all pingsu's interface Signed-off-by: Future-Outlier <[email protected]> * Trigger Build Signed-off-by: Future-Outlier <[email protected]> * update pingsu's advice Signed-off-by: Future-Outlier <[email protected]> Co-authored-by: pingsutw <[email protected]> * nit Signed-off-by: Future-Outlier <[email protected]> * use InvalidLiteralTypeErr instead of NewIDLTypeNotFoundErr Signed-off-by: Future-Outlier <[email protected]> * nit Signed-off-by: Kevin Su <[email protected]> --------- Signed-off-by: Future-Outlier <[email protected]> Signed-off-by: Kevin Su <[email protected]> Co-authored-by: Kevin Su <[email protected]>
- 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.