Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add builder for resource description #2224

Merged
merged 1 commit into from
Mar 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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