|
| 1 | +templates: |
| 2 | +- deployment.yaml |
| 3 | +- config-upstream.yaml |
| 4 | +- config-ssh-git-servers.yaml |
| 5 | +- secret-ssh-git-servers.yaml |
| 6 | + |
| 7 | +tests: |
| 8 | +- it: should not render initContainers by default |
| 9 | + template: deployment.yaml |
| 10 | + asserts: |
| 11 | + - hasDocuments: |
| 12 | + count: 1 |
| 13 | + - notExists: |
| 14 | + path: spec.template.spec.initContainers |
| 15 | + |
| 16 | +- it: should render extraInitContainers on their own |
| 17 | + template: deployment.yaml |
| 18 | + set: |
| 19 | + extraInitContainers: |
| 20 | + - name: init |
| 21 | + image: busybox:1.28 |
| 22 | + command: ['sh', '-c', "echo 'hello world'"] |
| 23 | + asserts: |
| 24 | + - hasDocuments: |
| 25 | + count: 1 |
| 26 | + - equal: |
| 27 | + path: spec.template.spec.initContainers |
| 28 | + value: |
| 29 | + - name: init |
| 30 | + image: busybox:1.28 |
| 31 | + command: ['sh', '-c', "echo 'hello world'"] |
| 32 | + |
| 33 | +# Regression: extraInitContainers used a different indentation than the |
| 34 | +# copy-key-files init container, producing invalid YAML when both were set. |
| 35 | +- it: should render extraInitContainers after the sshGitServers init container |
| 36 | + template: deployment.yaml |
| 37 | + set: |
| 38 | + sshGitServers: |
| 39 | + - host: git.example.com |
| 40 | + path: "/asd" |
| 41 | + user: git |
| 42 | + privateKey: | |
| 43 | + -----BEGIN RSA PRIVATE KEY----- |
| 44 | + -----END RSA PRIVATE KEY----- |
| 45 | + port: 22 |
| 46 | + extraInitContainers: |
| 47 | + - name: init |
| 48 | + image: busybox:1.28 |
| 49 | + command: ['sh', '-c', "echo 'hello world'"] |
| 50 | + asserts: |
| 51 | + - hasDocuments: |
| 52 | + count: 1 |
| 53 | + - lengthEqual: |
| 54 | + path: spec.template.spec.initContainers |
| 55 | + count: 2 |
| 56 | + - equal: |
| 57 | + path: spec.template.spec.initContainers[0].name |
| 58 | + value: copy-key-files |
| 59 | + - equal: |
| 60 | + path: spec.template.spec.initContainers[1] |
| 61 | + value: |
| 62 | + name: init |
| 63 | + image: busybox:1.28 |
| 64 | + command: ['sh', '-c', "echo 'hello world'"] |
0 commit comments