-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix output schema type in workflow model schema * add output schema happy path test * add unserialize test * add output schema error path tests
- Loading branch information
Showing
6 changed files
with
168 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package workflow_test | ||
|
||
import ( | ||
"go.arcalot.io/assert" | ||
"go.flow.arcalot.io/engine/workflow" | ||
"testing" | ||
) | ||
|
||
var versionExp = "v0.2.0" | ||
var inputExp = map[string]any{ | ||
"root": "RootObject", | ||
"objects": map[string]any{ | ||
"RootObject": map[string]any{ | ||
"id": "RootObject", | ||
"properties": map[string]any{}}}, | ||
} | ||
var stepsExp = map[string]any{ | ||
"long_wait": map[string]any{ | ||
"plugin": map[string]any{ | ||
"src": "n/a", | ||
"deployment_type": "builtin", | ||
}, | ||
"step": "wait", | ||
"input": map[string]any{ | ||
"wait_time_ms": 1}}, | ||
} | ||
var outputID = "success" | ||
var outputsExp = map[string]any{ | ||
outputID: "!expr $.steps.long_wait.outputs", | ||
} | ||
var outputSchemaRootID = "RootObjectOut" | ||
var stepOutputSchemaInput = map[string]any{ | ||
"schema": map[string]any{ | ||
"root": outputSchemaRootID, | ||
"objects": map[string]any{ | ||
outputSchemaRootID: map[string]any{ | ||
"id": outputSchemaRootID, | ||
"properties": map[string]any{ | ||
"message": map[string]any{ | ||
"type": map[string]any{ | ||
"type_id": "string", | ||
}}}}}}, | ||
} | ||
var outputSchemaInput = map[string]any{ | ||
outputID: stepOutputSchemaInput, | ||
} | ||
var workflowSchemaInput = map[string]any{ | ||
"version": versionExp, | ||
"input": inputExp, | ||
"steps": stepsExp, | ||
"outputs": outputsExp, | ||
"outputSchema": outputSchemaInput, | ||
} | ||
|
||
// Test_SchemaWorkflow tests the workflow model schema's ability | ||
// to validate the compatibility of a fully specified and valid | ||
// workflow. | ||
func Test_SchemaWorkflow_ValidateCompatibility(t *testing.T) { | ||
workflowModelSchema := workflow.GetSchema() | ||
assert.NoError(t, workflowModelSchema.ValidateCompatibility(workflowSchemaInput)) | ||
} | ||
|
||
// Test_SchemaWorkflow tests the workflow model schema's ability | ||
// to unserialize a fully specified and valid workflow. | ||
func Test_SchemaWorkflow_UnserializeType(t *testing.T) { | ||
workflowModelSchema := workflow.GetSchema() | ||
_, err := workflowModelSchema.UnserializeType(workflowSchemaInput) | ||
assert.NoError(t, err) | ||
} |
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