From c42f34010a2da7ddc035d29c399aba1a90a32375 Mon Sep 17 00:00:00 2001 From: Piyush Garg Date: Fri, 13 Mar 2020 20:58:22 +0530 Subject: [PATCH] Add builder for resource description --- test/builder/pipeline.go | 7 +++++++ test/builder/pipeline_test.go | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/test/builder/pipeline.go b/test/builder/pipeline.go index a8f7615634d..52aee709ed7 100644 --- a/test/builder/pipeline.go +++ b/test/builder/pipeline.go @@ -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) { diff --git a/test/builder/pipeline_test.go b/test/builder/pipeline_test.go index 646f8829247..bb074a9b179 100644 --- a/test/builder/pipeline_test.go +++ b/test/builder/pipeline_test.go @@ -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", }},