Skip to content

Commit

Permalink
add comment to test
Browse files Browse the repository at this point in the history
  • Loading branch information
mfleader committed Dec 5, 2023
1 parent c2f203a commit 54a73f3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
34 changes: 19 additions & 15 deletions workflow/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,18 +556,32 @@ func (e *executor) buildOutputProperties(
if stageOutputsLen > 0 {
// only add stages with outputs
stageOutputProperties := make(map[string]*schema.PropertySchema, stageOutputsLen)
m, err2 := e.addOutputProperties(
stageOutputs, err2 := e.addOutputProperties(
stage, stepID, runnableStep, dag, stepNode,
stageOutputProperties, outputProperties)
stageOutputProperties)
if err2 != nil {
return m, err2
return nil, err2
}
outputProperties[stage.ID] = schema.NewPropertySchema(
stageOutputs,
nil,
true,
nil,
nil,
nil,
nil,
nil,
)
}
}
return outputProperties, nil
}

func (e *executor) addOutputProperties(stage step.LifecycleStageWithSchema, stepID string, runnableStep step.RunnableStep, dag dgraph.DirectedGraph[*DAGItem], stepNode dgraph.Node[*DAGItem], stageOutputProperties map[string]*schema.PropertySchema, outputProperties map[string]*schema.PropertySchema) (map[string]*schema.PropertySchema, error) {
func (e *executor) addOutputProperties(
stage step.LifecycleStageWithSchema, stepID string, runnableStep step.RunnableStep,
dag dgraph.DirectedGraph[*DAGItem], stepNode dgraph.Node[*DAGItem],
stageOutputProperties map[string]*schema.PropertySchema) (*schema.ObjectSchema, error) {

for outputID, outputSchema := range stage.Outputs {
stageDAGItem := &DAGItem{
Kind: DAGItemKindStepStageOutput,
Expand Down Expand Up @@ -609,17 +623,7 @@ func (e *executor) addOutputProperties(stage step.LifecycleStageWithSchema, step
stageOutputProperties,
)

outputProperties[stage.ID] = schema.NewPropertySchema(
stageOutputs,
nil,
true,
nil,
nil,
nil,
nil,
nil,
)
return nil, nil
return stageOutputs, nil
}

func (e *executor) getRunData(stepKind step.Provider, runnableStep step.RunnableStep, stepID string, stepDataMap map[any]any) (map[string]any, error) {
Expand Down
5 changes: 5 additions & 0 deletions workflow/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,14 @@ outputs:
func TestDependOnNoOutputs(t *testing.T) {
// This test is to validate that this error is caught at workflow
// preparation instead of workflow execution.

// The error handling does not currently distinguish between the edge cases:
// - wait_1 = {}; not having a property named 'deploy',
// - wait_1 = { deploy: nil }; the 'deploy' property has no outputs (i.e. nil output)
//
// This is not a robust test. It should be improved, or removed, if it continues to break.
// To improve this test the engine needs to improve observability
// into the workflow's path structure at preparation time.
_, err := getTestImplPreparedWorkflow(t, invalidWaitfor)
assert.Error(t, err)
assert.Contains(t, err.Error(), "object wait_1 does not have a property named deploy")
Expand Down

0 comments on commit 54a73f3

Please sign in to comment.