Skip to content

Commit

Permalink
Migrate some test builder references to structs
Browse files Browse the repository at this point in the history
Also delete test/builder/ since it appears to be unused
  • Loading branch information
imjasonh authored and tekton-robot committed Sep 1, 2020
1 parent 2a4d3e4 commit a677751
Show file tree
Hide file tree
Showing 37 changed files with 475 additions and 4,221 deletions.
124 changes: 0 additions & 124 deletions internal/builder/v1alpha1/condition_test.go

This file was deleted.

154 changes: 0 additions & 154 deletions internal/builder/v1alpha1/examples_test.go

This file was deleted.

6 changes: 3 additions & 3 deletions internal/builder/v1alpha1/param.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1"
// ParamSpecOp is an operation which modify a ParamSpec struct.
type ParamSpecOp func(*v1alpha1.ParamSpec)

// ArrayOrString creates an ArrayOrString of type ParamTypeString or ParamTypeArray, based on
// arrayOrString creates an ArrayOrString of type ParamTypeString or ParamTypeArray, based on
// how many inputs are given (>1 input will create an array, not string).
func ArrayOrString(value string, additionalValues ...string) *v1alpha1.ArrayOrString {
func arrayOrString(value string, additionalValues ...string) *v1alpha1.ArrayOrString {
if len(additionalValues) > 0 {
additionalValues = append([]string{value}, additionalValues...)
return &v1alpha1.ArrayOrString{
Expand All @@ -43,7 +43,7 @@ func ParamSpecDescription(desc string) ParamSpecOp {

// ParamSpecDefault sets the default value of a ParamSpec.
func ParamSpecDefault(value string, additionalValues ...string) ParamSpecOp {
arrayOrString := ArrayOrString(value, additionalValues...)
arrayOrString := arrayOrString(value, additionalValues...)
return func(ps *v1alpha1.ParamSpec) {
ps.Default = arrayOrString
}
Expand Down
44 changes: 0 additions & 44 deletions internal/builder/v1alpha1/param_test.go

This file was deleted.

6 changes: 3 additions & 3 deletions internal/builder/v1alpha1/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func PipelineTaskRefKind(kind v1alpha1.TaskKind) PipelineTaskOp {

// PipelineTaskParam adds a ResourceParam, with specified name and value, to the PipelineTask.
func PipelineTaskParam(name string, value string, additionalValues ...string) PipelineTaskOp {
arrayOrString := ArrayOrString(value, additionalValues...)
arrayOrString := arrayOrString(value, additionalValues...)
return func(pt *v1alpha1.PipelineTask) {
pt.Params = append(pt.Params, v1alpha1.Param{
Name: name,
Expand Down Expand Up @@ -287,7 +287,7 @@ func PipelineTaskConditionParam(name, val string) PipelineTaskConditionOp {
}
condition.Params = append(condition.Params, v1alpha1.Param{
Name: name,
Value: *ArrayOrString(val),
Value: *arrayOrString(val),
})
}
}
Expand Down Expand Up @@ -436,7 +436,7 @@ func PipelineRunServiceAccountNameTask(taskName, sa string) PipelineRunSpecOp {

// PipelineRunParam add a param, with specified name and value, to the PipelineRunSpec.
func PipelineRunParam(name string, value string, additionalValues ...string) PipelineRunSpecOp {
arrayOrString := ArrayOrString(value, additionalValues...)
arrayOrString := arrayOrString(value, additionalValues...)
return func(prs *v1alpha1.PipelineRunSpec) {
prs.Params = append(prs.Params, v1alpha1.Param{
Name: name,
Expand Down
Loading

0 comments on commit a677751

Please sign in to comment.