Skip to content

Commit

Permalink
Add builder for resource description
Browse files Browse the repository at this point in the history
  • Loading branch information
piyush-garg authored and tekton-robot committed Mar 13, 2020
1 parent dc6376d commit 988ccac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions test/builder/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,13 @@ func PipelineResourceSpec(resourceType v1alpha1.PipelineResourceType, ops ...Pip
}
}

// PipelineResourceDescription sets the description of the pipeline resource
func PipelineResourceDescription(desc string) PipelineResourceSpecOp {
return func(spec *v1alpha1.PipelineResourceSpec) {
spec.Description = desc
}
}

// PipelineResourceSpecParam adds a ResourceParam, with specified name and value, to the PipelineResourceSpec.
func PipelineResourceSpecParam(name, value string) PipelineResourceSpecOp {
return func(spec *v1alpha1.PipelineResourceSpec) {
Expand Down
5 changes: 3 additions & 2 deletions test/builder/pipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,12 +397,13 @@ func TestPipelineRunWithPipelineSpec(t *testing.T) {

func TestPipelineResource(t *testing.T) {
pipelineResource := tb.PipelineResource("git-resource", "foo", tb.PipelineResourceSpec(
v1alpha1.PipelineResourceTypeGit, tb.PipelineResourceSpecParam("URL", "https://foo.git"),
v1alpha1.PipelineResourceTypeGit, tb.PipelineResourceSpecParam("URL", "https://foo.git"), tb.PipelineResourceDescription("test description"),
))
expectedPipelineResource := &v1alpha1.PipelineResource{
ObjectMeta: metav1.ObjectMeta{Name: "git-resource", Namespace: "foo"},
Spec: v1alpha1.PipelineResourceSpec{
Type: v1alpha1.PipelineResourceTypeGit,
Description: "test description",
Type: v1alpha1.PipelineResourceTypeGit,
Params: []v1alpha1.ResourceParam{{
Name: "URL", Value: "https://foo.git",
}},
Expand Down

0 comments on commit 988ccac

Please sign in to comment.