|
| 1 | +suite: test deployment |
| 2 | +templates: |
| 3 | + - deployment.yaml |
| 4 | +tests: |
| 5 | + - it: should work (defaults) |
| 6 | + set: |
| 7 | + image.tag: latest |
| 8 | + asserts: |
| 9 | + - isKind: |
| 10 | + of: Deployment |
| 11 | + - equal: |
| 12 | + path: metadata.name |
| 13 | + value: version-checker |
| 14 | + - equal: |
| 15 | + path: spec.template.spec.containers[0].image |
| 16 | + value: quay.io/jetstack/version-checker:latest |
| 17 | + - equal: |
| 18 | + path: spec.template.spec.containers[0].resources |
| 19 | + value: {} |
| 20 | + - equal: |
| 21 | + path: spec.template.metadata.labels["app.kubernetes.io/name"] |
| 22 | + value: version-checker |
| 23 | + - equal: |
| 24 | + path: spec.template.metadata.labels["app.kubernetes.io/instance"] |
| 25 | + value: RELEASE-NAME |
| 26 | + - equal: |
| 27 | + path: spec.template.spec.containers[0].name |
| 28 | + value: version-checker |
| 29 | + - equal: |
| 30 | + path: spec.template.spec.containers[0].livenessProbe |
| 31 | + value: |
| 32 | + httpGet: |
| 33 | + path: /readyz |
| 34 | + port: 8080 |
| 35 | + initialDelaySeconds: 3 |
| 36 | + periodSeconds: 3 |
| 37 | + - equal: |
| 38 | + path: spec.template.spec.containers[0].readinessProbe |
| 39 | + value: |
| 40 | + httpGet: |
| 41 | + path: /readyz |
| 42 | + port: 8080 |
| 43 | + initialDelaySeconds: 3 |
| 44 | + periodSeconds: 3 |
| 45 | + - isNullOrEmpty: |
| 46 | + path: spec.template.spec.volumes |
| 47 | + |
| 48 | + # ACR |
| 49 | + - it: ACR should work |
| 50 | + set: |
| 51 | + acr.refreshToken: ajbhvdsbjvh |
| 52 | + acr.username: jsgbjkas |
| 53 | + acr.password: sgkjnabskjga |
| 54 | + asserts: |
| 55 | + - contains: |
| 56 | + path: spec.template.spec.containers[0].env |
| 57 | + count: 1 |
| 58 | + content: |
| 59 | + name: VERSION_CHECKER_ACR_REFRESH_TOKEN |
| 60 | + valueFrom: |
| 61 | + secretKeyRef: |
| 62 | + key: acr.refreshToken |
| 63 | + name: version-checker |
| 64 | + - contains: |
| 65 | + path: spec.template.spec.containers[0].env |
| 66 | + count: 1 |
| 67 | + content: |
| 68 | + name: VERSION_CHECKER_ACR_USERNAME |
| 69 | + valueFrom: |
| 70 | + secretKeyRef: |
| 71 | + key: acr.username |
| 72 | + name: version-checker |
| 73 | + - contains: |
| 74 | + path: spec.template.spec.containers[0].env |
| 75 | + count: 1 |
| 76 | + content: |
| 77 | + name: VERSION_CHECKER_ACR_PASSWORD |
| 78 | + valueFrom: |
| 79 | + secretKeyRef: |
| 80 | + key: acr.password |
| 81 | + name: version-checker |
| 82 | + |
| 83 | + # ECR |
| 84 | + - it: ECR should work |
| 85 | + set: |
| 86 | + ecr.iamRoleArn: ajbhvdsbjvh |
| 87 | + ecr.accessKeyID: jsgbjkas |
| 88 | + ecr.secretAccessKey: sgkjnabskjga |
| 89 | + ecr.sessionToken: asgjasg |
| 90 | + asserts: |
| 91 | + - contains: |
| 92 | + path: spec.template.spec.containers[0].env |
| 93 | + count: 1 |
| 94 | + content: |
| 95 | + name: VERSION_CHECKER_ECR_IAM_ROLE_ARN |
| 96 | + value: ajbhvdsbjvh |
| 97 | + - contains: |
| 98 | + path: spec.template.spec.containers[0].env |
| 99 | + count: 1 |
| 100 | + content: |
| 101 | + name: VERSION_CHECKER_ECR_ACCESS_KEY_ID |
| 102 | + valueFrom: |
| 103 | + secretKeyRef: |
| 104 | + key: ecr.accessKeyID |
| 105 | + name: version-checker |
| 106 | + - contains: |
| 107 | + path: spec.template.spec.containers[0].env |
| 108 | + count: 1 |
| 109 | + content: |
| 110 | + name: VERSION_CHECKER_ECR_SECRET_ACCESS_KEY |
| 111 | + valueFrom: |
| 112 | + secretKeyRef: |
| 113 | + key: ecr.secretAccessKey |
| 114 | + name: version-checker |
| 115 | + - contains: |
| 116 | + path: spec.template.spec.containers[0].env |
| 117 | + count: 1 |
| 118 | + content: |
| 119 | + name: VERSION_CHECKER_ECR_SESSION_TOKEN |
| 120 | + valueFrom: |
| 121 | + secretKeyRef: |
| 122 | + key: ecr.sessionToken |
| 123 | + name: version-checker |
| 124 | + |
| 125 | + # Docker |
| 126 | + - it: Docker should work |
| 127 | + set: |
| 128 | + docker.token: ajbhvdsbjvh |
| 129 | + docker.username: username |
| 130 | + docker.password: hunter1 |
| 131 | + asserts: |
| 132 | + - contains: |
| 133 | + path: spec.template.spec.containers[0].env |
| 134 | + count: 1 |
| 135 | + content: |
| 136 | + name: VERSION_CHECKER_DOCKER_TOKEN |
| 137 | + valueFrom: |
| 138 | + secretKeyRef: |
| 139 | + key: docker.token |
| 140 | + name: version-checker |
| 141 | + - contains: |
| 142 | + path: spec.template.spec.containers[0].env |
| 143 | + count: 1 |
| 144 | + content: |
| 145 | + name: VERSION_CHECKER_DOCKER_USERNAME |
| 146 | + valueFrom: |
| 147 | + secretKeyRef: |
| 148 | + key: docker.username |
| 149 | + name: version-checker |
| 150 | + - contains: |
| 151 | + path: spec.template.spec.containers[0].env |
| 152 | + count: 1 |
| 153 | + content: |
| 154 | + name: VERSION_CHECKER_DOCKER_PASSWORD |
| 155 | + valueFrom: |
| 156 | + secretKeyRef: |
| 157 | + key: docker.password |
| 158 | + name: version-checker |
| 159 | + |
| 160 | + # GCR |
| 161 | + - it: GCR should work |
| 162 | + set: |
| 163 | + gcr.token: ajbhvdsbjvh |
| 164 | + asserts: |
| 165 | + - contains: |
| 166 | + path: spec.template.spec.containers[0].env |
| 167 | + count: 1 |
| 168 | + content: |
| 169 | + name: VERSION_CHECKER_GCR_TOKEN |
| 170 | + valueFrom: |
| 171 | + secretKeyRef: |
| 172 | + key: gcr.token |
| 173 | + name: version-checker |
| 174 | + |
| 175 | + # Quay |
| 176 | + - it: Quay should work |
| 177 | + set: |
| 178 | + quay.token: ajbhvdsbjvh |
| 179 | + asserts: |
| 180 | + - contains: |
| 181 | + path: spec.template.spec.containers[0].env |
| 182 | + count: 1 |
| 183 | + content: |
| 184 | + name: VERSION_CHECKER_QUAY_TOKEN |
| 185 | + valueFrom: |
| 186 | + secretKeyRef: |
| 187 | + key: quay.token |
| 188 | + name: version-checker |
| 189 | + |
| 190 | + # Self Hosted |
| 191 | + - it: Self hosted should work |
| 192 | + set: |
| 193 | + selfhosted: |
| 194 | + - name: bob |
| 195 | + host: http://example.com |
| 196 | + username: asgasasf |
| 197 | + password: hunter1 |
| 198 | + asserts: |
| 199 | + - contains: |
| 200 | + path: spec.template.spec.containers[0].env |
| 201 | + count: 1 |
| 202 | + content: |
| 203 | + name: VERSION_CHECKER_SELFHOSTED_HOST_bob |
| 204 | + valueFrom: |
| 205 | + secretKeyRef: |
| 206 | + key: selfhosted.bob.host |
| 207 | + name: version-checker |
| 208 | + - contains: |
| 209 | + path: spec.template.spec.containers[0].env |
| 210 | + count: 1 |
| 211 | + content: |
| 212 | + name: VERSION_CHECKER_SELFHOSTED_USERNAME_bob |
| 213 | + valueFrom: |
| 214 | + secretKeyRef: |
| 215 | + key: selfhosted.bob.username |
| 216 | + name: version-checker |
| 217 | + - contains: |
| 218 | + path: spec.template.spec.containers[0].env |
| 219 | + count: 1 |
| 220 | + content: |
| 221 | + name: VERSION_CHECKER_SELFHOSTED_PASSWORD_bob |
| 222 | + valueFrom: |
| 223 | + secretKeyRef: |
| 224 | + key: selfhosted.bob.password |
| 225 | + name: version-checker |
| 226 | + - notContains: |
| 227 | + path: spec.template.spec.containers[0].env |
| 228 | + content: |
| 229 | + name: VERSION_CHECKER_SELFHOSTED_TOKEN_bob |
| 230 | + valueFrom: |
| 231 | + secretKeyRef: |
| 232 | + key: selfhosted.bob.password |
| 233 | + name: version-checker |
| 234 | + |
| 235 | + # Multiple Self Hosted |
| 236 | + - it: Multiple Self hosted should work |
| 237 | + set: |
| 238 | + selfhosted: |
| 239 | + - name: bob |
| 240 | + host: http://example.com |
| 241 | + username: asgasasf |
| 242 | + password: hunter1 |
| 243 | + - name: bill |
| 244 | + host: http://sub.example.com |
| 245 | + token: askjgnasbjkgas |
| 246 | + asserts: |
| 247 | + - contains: |
| 248 | + path: spec.template.spec.containers[0].env |
| 249 | + count: 1 |
| 250 | + content: |
| 251 | + name: VERSION_CHECKER_SELFHOSTED_HOST_bob |
| 252 | + valueFrom: |
| 253 | + secretKeyRef: |
| 254 | + key: selfhosted.bob.host |
| 255 | + name: version-checker |
| 256 | + - contains: |
| 257 | + path: spec.template.spec.containers[0].env |
| 258 | + count: 1 |
| 259 | + content: |
| 260 | + name: VERSION_CHECKER_SELFHOSTED_USERNAME_bob |
| 261 | + valueFrom: |
| 262 | + secretKeyRef: |
| 263 | + key: selfhosted.bob.username |
| 264 | + name: version-checker |
| 265 | + - contains: |
| 266 | + path: spec.template.spec.containers[0].env |
| 267 | + count: 1 |
| 268 | + content: |
| 269 | + name: VERSION_CHECKER_SELFHOSTED_PASSWORD_bob |
| 270 | + valueFrom: |
| 271 | + secretKeyRef: |
| 272 | + key: selfhosted.bob.password |
| 273 | + name: version-checker |
| 274 | + - notContains: |
| 275 | + path: spec.template.spec.containers[0].env |
| 276 | + content: |
| 277 | + name: VERSION_CHECKER_SELFHOSTED_TOKEN_bob |
| 278 | + valueFrom: |
| 279 | + secretKeyRef: |
| 280 | + key: selfhosted.bob.password |
| 281 | + name: version-checker |
| 282 | + - contains: |
| 283 | + path: spec.template.spec.containers[0].env |
| 284 | + content: |
| 285 | + name: VERSION_CHECKER_SELFHOSTED_TOKEN_bill |
| 286 | + valueFrom: |
| 287 | + secretKeyRef: |
| 288 | + key: selfhosted.bill.token |
| 289 | + name: version-checker |
| 290 | + - contains: |
| 291 | + path: spec.template.spec.containers[0].env |
| 292 | + content: |
| 293 | + name: VERSION_CHECKER_SELFHOSTED_HOST_bill |
| 294 | + valueFrom: |
| 295 | + secretKeyRef: |
| 296 | + key: selfhosted.bill.host |
| 297 | + name: version-checker |
| 298 | + |
| 299 | + - it: SecretEnabled |
| 300 | + set: |
| 301 | + acr.refreshToken: asgasga |
| 302 | + asserts: |
| 303 | + - contains: |
| 304 | + path: spec.template.spec.volumes |
| 305 | + content: |
| 306 | + name: version-checker |
| 307 | + secret: |
| 308 | + secretName: version-checker |
0 commit comments