Files
truecharts/charts/library/common-test/tests/cronjob/spec_test.yaml
T
Stavros Kois 006cae1856 fix(common): set correct default for restartPolicy for cronjobs (#28356)
**Description**
<!--
Please include a summary of the change and which issue is fixed. Please
also include relevant motivation and context. List any dependencies that
are required for this change.
-->
⚒️ Fixes  #28118

**⚙️ Type of change**

- [ ] ⚙️ Feature/App addition
- [x] 🪛 Bugfix
- [ ] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] 🔃 Refactor of current code

**🧪 How Has This Been Tested?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
<!-- Please enter any other relevant information here -->

**✔️ Checklist:**

- [x] ⚖️ My code follows the style guidelines of this project
- [x] 👀 I have performed a self-review of my own code
- [ ] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [x] 📄 I have made corresponding changes to the documentation
- [x] ⚠️ My changes generate no new warnings
- [x] 🧪 I have added tests to this description that prove my fix is
effective or that my feature works
- [x] ⬆️ I increased versions for any altered app according to semantic
versioning
- [x] I made sure the title starts with `feat(chart-name):`,
`fix(chart-name):` or `chore(chart-name):`

** App addition**

If this PR is an app addition please make sure you have done the
following.

- [ ] 🖼️ I have added an icon in the Chart's root directory called
`icon.png`

---

_Please don't blindly check all the boxes. Read them and only check
those that apply.
Those checkboxes are there for the reviewer to see what is this all
about and
the status of this PR with a quick glance._
2024-10-26 17:55:53 +02:00

132 lines
3.4 KiB
YAML

suite: cronjob spec test
templates:
- common.yaml
release:
name: test-release-name
namespace: test-release-namespace
tests:
- it: should pass with workload enabled
set:
workload:
workload-name:
enabled: true
primary: true
type: CronJob
schedule: "* * * * *"
podSpec: {}
asserts:
- documentIndex: &cronJobDoc 0
isKind:
of: CronJob
- documentIndex: *cronJobDoc
isAPIVersion:
of: batch/v1
- documentIndex: *cronJobDoc
isSubset:
path: spec
content:
schedule: "* * * * *"
timeZone: UTC
concurrencyPolicy: Forbid
failedJobsHistoryLimit: 1
successfulJobsHistoryLimit: 3
startingDeadlineSeconds: 600
- documentIndex: *cronJobDoc
isSubset:
path: spec.jobTemplate.spec
content:
backoffLimit: 5
completionMode: NonIndexed
completions:
parallelism: 1
ttlSecondsAfterFinished: 120
- it: should apply spec correctly
set:
cron: "*/5 * * * *"
someTimezone: America/New_York
workload:
workload-name:
enabled: true
primary: true
type: CronJob
schedule: "{{ .Values.cron }}"
timezone: "{{ .Values.someTimezone }}"
concurrencyPolicy: Allow
failedJobsHistoryLimit: 2
successfulJobsHistoryLimit: 4
startingDeadlineSeconds: 100
backoffLimit: 5
completionMode: Indexed
completions: 5
parallelism: 5
ttlSecondsAfterFinished: 100
activeDeadlineSeconds: 100
podSpec: {}
asserts:
- documentIndex: *cronJobDoc
isSubset:
path: spec
content:
schedule: "*/5 * * * *"
concurrencyPolicy: Allow
failedJobsHistoryLimit: 2
successfulJobsHistoryLimit: 4
startingDeadlineSeconds: 100
timeZone: America/New_York
- documentIndex: *cronJobDoc
isSubset:
path: spec.jobTemplate.spec
content:
backoffLimit: 5
completionMode: Indexed
completions: 5
parallelism: 5
ttlSecondsAfterFinished: 100
activeDeadlineSeconds: 100
- documentIndex: *cronJobDoc
isSubset:
path: spec.jobTemplate.spec.template.spec
content:
restartPolicy: OnFailure
- it: should set suspend to true
set:
workload:
workload-name:
enabled: true
primary: true
type: CronJob
schedule: "*/5 * * * *"
suspend: true
podSpec: {}
asserts:
- documentIndex: *cronJobDoc
isSubset:
path: spec
content:
schedule: "*/5 * * * *"
timeZone: UTC
suspend: true
- it: should set suspend to true on stopAll
set:
global:
stopAll: true
workload:
workload-name:
enabled: true
primary: true
type: CronJob
schedule: "*/5 * * * *"
suspend: false
podSpec: {}
asserts:
- documentIndex: *cronJobDoc
isSubset:
path: spec
content:
schedule: "*/5 * * * *"
timeZone: UTC
suspend: true