Give warning for common error missing 'run' key

This commit is contained in:
Luke Kysow
2019-03-05 13:32:08 -05:00
parent c97c922f91
commit 65c8f1317a
4 changed files with 4 additions and 4 deletions

View File

@@ -58,7 +58,7 @@ func TestStage_Validate(t *testing.T) {
},
}
validation.ErrorTag = "yaml"
ErrEquals(t, "steps: (0: \"invalid\" is not a valid step type.).", s.Validate())
ErrEquals(t, "steps: (0: \"invalid\" is not a valid step type, maybe you omitted the 'run' key.).", s.Validate())
// Empty steps should validate.
Ok(t, (raw.Stage{}).Validate())

View File

@@ -83,7 +83,7 @@ func (s Step) Validate() error {
validStep := func(value interface{}) error {
str := *value.(*string)
if str != InitStepName && str != PlanStepName && str != ApplyStepName {
return fmt.Errorf("%q is not a valid step type", str)
return fmt.Errorf("%q is not a valid step type, maybe you omitted the 'run' key", str)
}
return nil
}

View File

@@ -216,7 +216,7 @@ func TestStep_Validate(t *testing.T) {
input: raw.Step{
Key: String("invalid"),
},
expErr: "\"invalid\" is not a valid step type",
expErr: "\"invalid\" is not a valid step type, maybe you omitted the 'run' key",
},
{
description: "multiple keys in map",

View File

@@ -104,7 +104,7 @@ func TestWorkflow_Validate(t *testing.T) {
},
}
validation.ErrorTag = "yaml"
ErrEquals(t, "apply: (steps: (0: \"invalid\" is not a valid step type.).).", w.Validate())
ErrEquals(t, "apply: (steps: (0: \"invalid\" is not a valid step type, maybe you omitted the 'run' key.).).", w.Validate())
// Unset keys should validate.
Ok(t, (raw.Workflow{}).Validate())