|
| 1 | +suite: Common - deployment and pod fields |
| 2 | +templates: |
| 3 | + - deployment.worker.yaml |
| 4 | +set: |
| 5 | + fullnameOverride: black |
| 6 | +tests: |
| 7 | + - it: 'renders one replica when replicaCount is absent' |
| 8 | + asserts: |
| 9 | + - equal: |
| 10 | + path: spec.replicas |
| 11 | + value: 1 |
| 12 | + |
| 13 | + - it: 'keeps an explicit replicaCount of 0, so a stopped deployment stays stopped' |
| 14 | + set: |
| 15 | + worker: |
| 16 | + replicaCount: 0 |
| 17 | + asserts: |
| 18 | + - equal: |
| 19 | + path: spec.replicas |
| 20 | + value: 0 |
| 21 | + |
| 22 | + - it: 'passes any other replicaCount through' |
| 23 | + set: |
| 24 | + worker: |
| 25 | + replicaCount: 3 |
| 26 | + asserts: |
| 27 | + - equal: |
| 28 | + path: spec.replicas |
| 29 | + value: 3 |
| 30 | + |
| 31 | + - it: 'renders no replicas when autoscaling owns them' |
| 32 | + set: |
| 33 | + worker: |
| 34 | + replicaCount: 0 |
| 35 | + autoscaling: |
| 36 | + enabled: true |
| 37 | + asserts: |
| 38 | + - notExists: |
| 39 | + path: spec.replicas |
| 40 | + |
| 41 | + - it: 'leaves revisionHistoryLimit and terminationGracePeriodSeconds to Kubernetes by default' |
| 42 | + asserts: |
| 43 | + - notExists: |
| 44 | + path: spec.revisionHistoryLimit |
| 45 | + - notExists: |
| 46 | + path: spec.template.spec.terminationGracePeriodSeconds |
| 47 | + |
| 48 | + - it: 'passes revisionHistoryLimit and terminationGracePeriodSeconds through' |
| 49 | + set: |
| 50 | + worker: |
| 51 | + revisionHistoryLimit: 3 |
| 52 | + terminationGracePeriodSeconds: 60 |
| 53 | + asserts: |
| 54 | + - equal: |
| 55 | + path: spec.revisionHistoryLimit |
| 56 | + value: 3 |
| 57 | + - equal: |
| 58 | + path: spec.template.spec.terminationGracePeriodSeconds |
| 59 | + value: 60 |
| 60 | + |
| 61 | + - it: 'renders no automountServiceAccountToken for a named service account by default' |
| 62 | + asserts: |
| 63 | + - equal: |
| 64 | + path: spec.template.spec.serviceAccountName |
| 65 | + value: superman |
| 66 | + - notExists: |
| 67 | + path: spec.template.spec.automountServiceAccountToken |
| 68 | + |
| 69 | + - it: 'mounts the token when there is no service account, as before' |
| 70 | + set: |
| 71 | + worker: |
| 72 | + serviceAccount: null |
| 73 | + asserts: |
| 74 | + - notExists: |
| 75 | + path: spec.template.spec.serviceAccountName |
| 76 | + - equal: |
| 77 | + path: spec.template.spec.automountServiceAccountToken |
| 78 | + value: true |
| 79 | + |
| 80 | + - it: 'honours automountServiceAccountToken false with a named service account' |
| 81 | + set: |
| 82 | + worker: |
| 83 | + automountServiceAccountToken: false |
| 84 | + asserts: |
| 85 | + - equal: |
| 86 | + path: spec.template.spec.serviceAccountName |
| 87 | + value: superman |
| 88 | + - equal: |
| 89 | + path: spec.template.spec.automountServiceAccountToken |
| 90 | + value: false |
| 91 | + |
| 92 | + - it: 'honours automountServiceAccountToken false without a service account' |
| 93 | + set: |
| 94 | + worker: |
| 95 | + serviceAccount: null |
| 96 | + automountServiceAccountToken: false |
| 97 | + asserts: |
| 98 | + - equal: |
| 99 | + path: spec.template.spec.automountServiceAccountToken |
| 100 | + value: false |
0 commit comments