Skip to content

Commit

Permalink
test: add regression tests for no-duplicate-env
Browse files Browse the repository at this point in the history
  • Loading branch information
madbence committed Oct 25, 2020
1 parent db88dfe commit da5f5d1
Show file tree
Hide file tree
Showing 2 changed files with 172 additions and 0 deletions.
96 changes: 96 additions & 0 deletions regression-tests/__snapshots__/regresion.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,102 @@ Array [
"path": "./regression-tests/eventlistener-test.yaml",
"rule": "no-missing-resource",
},
Object {
"level": "warning",
"loc": Object {
"endColumn": 20,
"endLine": 9,
"range": Array [
130,
136,
],
"startColumn": 14,
"startLine": 9,
},
"message": "Invalid image: 'alpine'. Specify the image tag instead of using ':latest'",
"path": "./regression-tests/no-duplicate-env.yaml",
"rule": "no-latest-image",
},
Object {
"level": "warning",
"loc": Object {
"endColumn": 20,
"endLine": 21,
"range": Array [
318,
324,
],
"startColumn": 14,
"startLine": 21,
},
"message": "Invalid image: 'alpine'. Specify the image tag instead of using ':latest'",
"path": "./regression-tests/no-duplicate-env.yaml",
"rule": "no-latest-image",
},
Object {
"level": "error",
"loc": Object {
"endColumn": 20,
"endLine": 25,
"range": Array [
393,
396,
],
"startColumn": 17,
"startLine": 25,
},
"message": "Step 'step-2' has env variable 'FOO' duplicated in task 'no-duplicate-env-1'.",
"path": "./regression-tests/no-duplicate-env.yaml",
"rule": "no-duplicate-env",
},
Object {
"level": "warning",
"loc": Object {
"endColumn": 20,
"endLine": 33,
"range": Array [
506,
512,
],
"startColumn": 14,
"startLine": 33,
},
"message": "Invalid image: 'alpine'. Specify the image tag instead of using ':latest'",
"path": "./regression-tests/no-duplicate-env.yaml",
"rule": "no-latest-image",
},
Object {
"level": "warning",
"loc": Object {
"endColumn": 20,
"endLine": 52,
"range": Array [
797,
803,
],
"startColumn": 14,
"startLine": 52,
},
"message": "Invalid image: 'alpine'. Specify the image tag instead of using ':latest'",
"path": "./regression-tests/no-duplicate-env.yaml",
"rule": "no-latest-image",
},
Object {
"level": "warning",
"loc": Object {
"endColumn": 20,
"endLine": 69,
"range": Array [
1051,
1057,
],
"startColumn": 14,
"startLine": 69,
},
"message": "Invalid image: 'alpine'. Specify the image tag instead of using ':latest'",
"path": "./regression-tests/no-duplicate-env.yaml",
"rule": "no-latest-image",
},
Object {
"level": "warning",
"loc": Object {
Expand Down
76 changes: 76 additions & 0 deletions regression-tests/no-duplicate-env.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: no-duplicate-env-1
spec:
steps:
- name: step-1
image: alpine
env:
- name: FOO
value: foo
- name: BAR
value: bar
script: |
#!/bin/sh
echo ${FOO}
- name: step-2
image: alpine
env:
- name: FOO
value: foo
- name: FOO
value: foo
script: |
#!/bin/sh
echo ${FOO}
- name: step-3
image: alpine
script: |
#!/bin/sh
echo ${FOO}
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: no-duplicate-env-2
spec:
stepTemplate:
env:
- name: FOO
value: foo
- name: FOO
value: foo
steps:
- name: step-1
image: alpine
script: |
#!/bin/sh
echo ${FOO}
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: no-duplicate-env-3
spec:
stepTemplate:
env:
- name: FOO
value: foo
steps:
- name: step-1
image: alpine
env:
- name: FOO
value: foo
script: |
#!/bin/sh
echo ${FOO}

0 comments on commit da5f5d1

Please sign in to comment.