Skip to content

Commit 38f7dd6

Browse files
committed
refactor: move Step StepActionReference test
Now that `Step` implements the `Validatable` interface the tests for the `Step` validation are moved from `task_validation_test.go` to `container_validation_test.go`. The following tests is moved and renamed: - `TestTaskSpecStepActionReferenceValidate` - `TestStepWithStepActionReferenceValidate` Issue #8700. Signed-off-by: Stanislav Jakuschevskij <[email protected]>
1 parent 2306719 commit 38f7dd6

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

pkg/apis/pipeline/v1/container_validation_test.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,43 @@ func TestStepValidateErrorWithArtifactsRef(t *testing.T) {
985985
}
986986
}
987987

988+
func TestStepWithStepActionReferenceValidate(t *testing.T) {
989+
tests := []struct {
990+
name string
991+
Step v1.Step
992+
}{{
993+
name: "valid stepAction ref",
994+
Step: v1.Step{
995+
Name: "mystep",
996+
Ref: &v1.Ref{
997+
Name: "stepAction",
998+
},
999+
},
1000+
}, {
1001+
name: "valid use of params with Ref",
1002+
Step: v1.Step{
1003+
Ref: &v1.Ref{
1004+
Name: "stepAction",
1005+
},
1006+
Params: v1.Params{{
1007+
Name: "param",
1008+
}},
1009+
},
1010+
}}
1011+
for _, st := range tests {
1012+
t.Run(st.name, func(t *testing.T) {
1013+
ctx := config.ToContext(t.Context(), &config.Config{
1014+
FeatureFlags: &config.FeatureFlags{
1015+
EnableStepActions: true,
1016+
},
1017+
})
1018+
if err := st.Step.Validate(ctx); err != nil {
1019+
t.Errorf("Step.Validate() = %v", err)
1020+
}
1021+
})
1022+
}
1023+
}
1024+
9881025
func TestSidecarValidate(t *testing.T) {
9891026
tests := []struct {
9901027
name string

0 commit comments

Comments
 (0)