-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Note
This issue is done. It will be merged in small batches once #8685 is merged.
Summary
While working on issue #7442 in #8685 it stood out that step and sidecar validation is implemented inconsistent with the validation of the other core structs like Pipeline, PipelineSpec, Task, TaskSpec, etc.
. They implement the apis.Validatable
interface and are tested against the Validate
method.
After merging of #8685 step and sidecar validation will be in container_validation.go
but their tests in task_validation_test.go
. They can not be moved without changing the scope of container_validation_test.go
or making the step and sidecar validation functions public.
This refactoring should resolve the mentioned inconsistencies.
Tasks
Main branch with all the changes below commit by commit.
Steps
- PR Refactor Step validation to implement apis.Validatable. #8717
- Add a
StepList
type with aValidate
method. It should replacevalidateSteps
function. - Implement a
Validate
method onStep
which should replacevalidateStep
function. - Move
names
validation up to the caller. - Move tests for new
Validate
methods tocontainer_validation_test.go
. The old tests can be refactored to run against the newValidate
methods. Affected tests are:- Commit with a first batch of moved tests:
-
TestTaskSpecValidateErrorWithArtifactsRefFlagNotEnabled
-
TestTaskSpecValidateSuccessWithArtifactsRefFlagEnabled
- Open PR, once the others are merged:
-
- Comimt with a second batch of moved tests:
-
TestTaskSpecValidateErrorWithStepActionRef_CreateUpdateEvent
-
TestTaskSpecValidateErrorWithStepActionRef
- Open PR, once the others are merged:
-
- Commit with a third batch of moved tests:
-
TestStepOnError
-
TestIncompatibleAPIVersions
- Open PR, once the others are merged:
-
- Commit with a fourth batch of moved tests:
-
TestTaskSpecValidateErrorWithStepResultRef
-
TestTaskSpecValidateErrorWithArtifactsRef
- Open PR, once the others are merged:
-
- Commit with a fifth batch of moved tests:
-
TestTaskSpecValidateError
-
TestTaskSpecValidate
- Open PR, once the others are merged:
-
- Commit with a last moved test:
-
TestTaskSpecStepActionReferenceValidate
- Open PR, once the others are merged:
-
- Commit with a first batch of moved tests:
- Add a
Sidecar
- PR Refactor sidecar validation to implement apis.Validatable. #8710
- Do a similar refactoring for
validateSidecars
which should be simpler. Affected tests are:-
TestTaskSpecValidateErrorSidecarName
-
TestTaskSpecValidateErrorSidecars
-
- Do a similar refactoring for
Test Coverage
- PR Raise test coverage in
task_validation.go
andcontainer_validation.go
. #8714- Improve coverage by adding test cases for conditions which are not covered. Check non-covered conditions:
go test ./pkg/apis/pipeline/v1 -coverprofile=coverage.out
go tool cover -html=coverage.out
/kind cleanup
/good-first-issue
/assign
Metadata
Metadata
Labels
Type
Projects
Status