Commit c711ddd
committed
Feat #99: add helm-unittest tests + README External Batch section
Tests (openstudio-server/tests/job-external-batch_test.yaml, 14 cases):
- default-disabled renders nothing
- enabled renders Job with correct spec (completions, parallelism,
completionMode: Indexed, backoffLimit, activeDeadlineSeconds,
ttlSecondsAfterFinished, restartPolicy, priorityClassName,
terminationGracePeriodSeconds)
- enabled renders ConfigMap carrying run_chunk.rb
- container image renders as the pinned digest
- JOB_COMPLETION_INDEX is projected via downward API
- NFS PVC + runner-script ConfigMap mounts
- storage.existingClaim override propagates
- container args invoke run_chunk.rb with the correct flag set
(snapshot)
- resources block renders limits + requests
- ConfigMap data.run_chunk.rb starts with #!/usr/bin/env ruby shebang
and contains the correct Usage: line (matchRegex)
- empty container.image fails the render with a clear error
- cluster-autoscaler safe-to-evict annotation is set
- pod uses worker node-group affinity (isSubset)
helm-unittest gotchas worked through (worth recording):
* 'err:' is not a valid field; the right field for failure assertions
is 'failedTemplate:' with an errorMessage.
* 'service:' under release: is not parsed. Only name/namespace/revision
/upgrade are accepted.
* documentSelector: only takes path/value/matchMany/skipEmptyTemplates.
Use the test-job level 'template:' to scope a single template.
* Map keys containing '.' in path expressions use bracket syntax:
data["run_chunk.rb"], not data.run_chunk.rb.
* 'contains' requires an array path; for string fields use matchRegex.
* Go regexp matches ^ at start-of-line by default; use \A for
start-of-string anchors.
* 'isSubset' matches an object subset; 'contains' matches an array
element. The affinity block is an object, so isSubset.
Snapshot tests cover the full run_chunk.rb script (truncated on
display but verified via diff against the upstream file) and the
container args block. Snapshot files live under
openstudio-server/tests/__snapshot__/ and are committed.
Docs (README.md):
- New 'External Batch (Indexed Jobs)' section explaining dual-mode
operation, the digest pin rationale, the dispatch workflow
(package -> render template -> kubectl apply), the parameter
table, and explicit notes on what this is NOT (not a worker
replacement, not a substitute for AWS Batch/SLURM/Nomad).
Verification:
- helm unittest: 14/14 pass
- helm lint: clean
- README renders correctly1 parent 604bca9 commit c711ddd
3 files changed
Lines changed: 398 additions & 0 deletions
File tree
- openstudio-server/tests
- __snapshot__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
0 commit comments