Skip to content

Commit

Permalink
test: add regression tests for prefer-when-expression
Browse files Browse the repository at this point in the history
  • Loading branch information
madbence committed Oct 31, 2020
1 parent d01fb1c commit 62ff0eb
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 0 deletions.
64 changes: 64 additions & 0 deletions regression-tests/__snapshots__/regresion.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2770,6 +2770,70 @@ Array [
"path": "./regression-tests/pipeline-test.yaml",
"rule": "prefer-kebab-case",
},
Object {
"level": "error",
"loc": Object {
"endColumn": 19,
"endLine": 10,
"range": Array [
153,
157,
],
"startColumn": 15,
"startLine": 10,
},
"message": "Pipeline 'prefer-when-expression' references task 'task' but the referenced task cannot be found. To fix this, include all the task definitions to the lint task for this pipeline.",
"path": "./regression-tests/prefer-when-expression.yaml",
"rule": "no-missing-resource",
},
Object {
"level": "warning",
"loc": Object {
"endColumn": 5,
"endLine": 13,
"range": Array [
184,
214,
],
"startColumn": 9,
"startLine": 12,
},
"message": "Task 'task-1' in Pipeline 'prefer-when-expression' is guarded by condition(s) ('condition'). Conditions are deprecated, use WhenExpressions instead.",
"path": "./regression-tests/prefer-when-expression.yaml",
"rule": "prefer-when-expression",
},
Object {
"level": "error",
"loc": Object {
"endColumn": 1,
"endLine": 13,
"range": Array [
186,
210,
],
"startColumn": 11,
"startLine": 12,
},
"message": "Pipeline 'prefer-when-expression' references Condition 'condition' but the referenced Condition cannot be found. To fix this, include all the Condition definitions to the lint task for this pipeline.",
"path": "./regression-tests/prefer-when-expression.yaml",
"rule": "no-missing-resource",
},
Object {
"level": "error",
"loc": Object {
"endColumn": 19,
"endLine": 15,
"range": Array [
258,
262,
],
"startColumn": 15,
"startLine": 15,
},
"message": "Pipeline 'prefer-when-expression' references task 'task' but the referenced task cannot be found. To fix this, include all the task definitions to the lint task for this pipeline.",
"path": "./regression-tests/prefer-when-expression.yaml",
"rule": "no-missing-resource",
},
Object {
"level": "error",
"loc": Object {
Expand Down
37 changes: 37 additions & 0 deletions regression-tests/prefer-when-expression.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
apiVersion: tekton.dev/v1beta
kind: Pipeline
metadata:
name: prefer-when-expression
spec:
tasks:
- name: task-1
taskRef:
name: task
conditions:
- conditionRef: condition
- name: task-2
taskRef:
name: task
---
apiVersion: tekton.dev/v1alpha1
kind: TriggerTemplate
metadata:
name: prefer-when-expression
spec:
resourcetemplates:
- apiVersion: tekton.dev/v1beta
kind: PipelineRun
metadata:
name: prefer-when-expression-run
spec:
pipelineSpec:
tasks:
- name: task-1
taskRef:
name: task
conditions:
- conditionRef: condition
- name: task-2
taskRef:
name: task

0 comments on commit 62ff0eb

Please sign in to comment.