Skip to content

Commit

Permalink
go fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
psschwei committed Apr 19, 2021
1 parent ac92457 commit 6c177d7
Showing 1 changed file with 71 additions and 71 deletions.
142 changes: 71 additions & 71 deletions pkg/apis/pipeline/v1beta1/pipelinerun_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,89 +38,89 @@ func TestPipelineRun_Invalid(t *testing.T) {
want *apis.FieldError
wc func(context.Context) context.Context
}{{
name: "no pipeline reference",
pr: v1beta1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{
Name: "pipelinelineName",
},
Spec: v1beta1.PipelineRunSpec{
ServiceAccountName: "foo",
},
name: "no pipeline reference",
pr: v1beta1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{
Name: "pipelinelineName",
},
want: apis.ErrMissingField("spec.pipelineref.name, spec.pipelinespec"),
}, {
name: "negative pipeline timeout",
pr: v1beta1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{
Name: "pipelinelineName",
},
Spec: v1beta1.PipelineRunSpec{
PipelineRef: &v1beta1.PipelineRef{
Name: "prname",
},
Timeout: &metav1.Duration{Duration: -48 * time.Hour},
},
Spec: v1beta1.PipelineRunSpec{
ServiceAccountName: "foo",
},
want: apis.ErrInvalidValue("-48h0m0s should be >= 0", "spec.timeout"),
}, {
name: "wrong pipelinerun cancel",
pr: v1beta1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{
Name: "pipelinelineName",
},
Spec: v1beta1.PipelineRunSpec{
PipelineRef: &v1beta1.PipelineRef{
Name: "prname",
},
Status: "PipelineRunCancell",
},
},
want: apis.ErrMissingField("spec.pipelineref.name, spec.pipelinespec"),
}, {
name: "negative pipeline timeout",
pr: v1beta1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{
Name: "pipelinelineName",
},
want: apis.ErrInvalidValue("PipelineRunCancell should be PipelineRunCancelled or PipelineRunPending", "spec.status"),
}, {
name: "use of bundle without the feature flag set",
pr: v1beta1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{
Name: "pipelinelineName",
},
Spec: v1beta1.PipelineRunSpec{
PipelineRef: &v1beta1.PipelineRef{
Name: "my-pipeline",
Bundle: "docker.io/foo",
},
Spec: v1beta1.PipelineRunSpec{
PipelineRef: &v1beta1.PipelineRef{
Name: "prname",
},
Timeout: &metav1.Duration{Duration: -48 * time.Hour},
},
want: apis.ErrDisallowedFields("spec.pipelineref.bundle"),
}, {
name: "bundle missing name",
pr: v1beta1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{
Name: "pipelinelineName",
},
want: apis.ErrInvalidValue("-48h0m0s should be >= 0", "spec.timeout"),
}, {
name: "wrong pipelinerun cancel",
pr: v1beta1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{
Name: "pipelinelineName",
},
Spec: v1beta1.PipelineRunSpec{
PipelineRef: &v1beta1.PipelineRef{
Name: "prname",
},
Spec: v1beta1.PipelineRunSpec{
PipelineRef: &v1beta1.PipelineRef{
Bundle: "docker.io/foo",
},
PipelineSpec: &v1beta1.PipelineSpec{Description: "foo"},
Status: "PipelineRunCancell",
},
},
want: apis.ErrInvalidValue("PipelineRunCancell should be PipelineRunCancelled or PipelineRunPending", "spec.status"),
}, {
name: "use of bundle without the feature flag set",
pr: v1beta1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{
Name: "pipelinelineName",
},
Spec: v1beta1.PipelineRunSpec{
PipelineRef: &v1beta1.PipelineRef{
Name: "my-pipeline",
Bundle: "docker.io/foo",
},
},
want: apis.ErrMissingField("spec.pipelineref.name"),
wc: enableTektonOCIBundles(t),
}, {
name: "invalid bundle reference",
pr: v1beta1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{
Name: "pipelinelineName",
},
want: apis.ErrDisallowedFields("spec.pipelineref.bundle"),
}, {
name: "bundle missing name",
pr: v1beta1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{
Name: "pipelinelineName",
},
Spec: v1beta1.PipelineRunSpec{
PipelineRef: &v1beta1.PipelineRef{
Bundle: "docker.io/foo",
},
Spec: v1beta1.PipelineRunSpec{
PipelineRef: &v1beta1.PipelineRef{
Name: "my-pipeline",
Bundle: "not a valid reference",
},
PipelineSpec: &v1beta1.PipelineSpec{Description: "foo"},
},
},
want: apis.ErrMissingField("spec.pipelineref.name"),
wc: enableTektonOCIBundles(t),
}, {
name: "invalid bundle reference",
pr: v1beta1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{
Name: "pipelinelineName",
},
Spec: v1beta1.PipelineRunSpec{
PipelineRef: &v1beta1.PipelineRef{
Name: "my-pipeline",
Bundle: "not a valid reference",
},
},
want: apis.ErrInvalidValue("invalid bundle reference (could not parse reference: not a valid reference)", "spec.pipelineref.bundle"),
wc: enableTektonOCIBundles(t),
},
want: apis.ErrInvalidValue("invalid bundle reference (could not parse reference: not a valid reference)", "spec.pipelineref.bundle"),
wc: enableTektonOCIBundles(t),
},
{
name: "pipelinerun pending while running",
pr: v1beta1.PipelineRun{
Expand Down

0 comments on commit 6c177d7

Please sign in to comment.