Files
library-charts/library/common-test/tests/pod/node_selector_test.yaml
Stavros Kois 695f3d7e5c fix(nodeSelector, hostUsers): make sure booleans are quoted, respect user defined value over automatic calculation (#827)
**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  #823 
⚒️ Partially #826 

**⚙️ 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
- [x] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [ ] 📄 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
- [ ] 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-06-07 00:46:25 +02:00

180 lines
4.3 KiB
YAML

suite: pod node selector test
templates:
- common.yaml
release:
name: test-release-name
namespace: test-release-namespace
tests:
- it: should pass without default arch set
set:
podOptions:
nodeSelector:
kubernetes.io/arch: ""
workload:
workload-name1:
enabled: true
primary: true
type: CronJob
schedule: "*/1 * * * *"
podSpec: {}
asserts:
- documentIndex: &cronJobDoc 0
isKind:
of: CronJob
- documentIndex: *cronJobDoc
notExists:
path: spec.jobTemplate.spec.template.spec.nodeSelector
- it: should pass with empty nodeSelector
set:
podOptions:
nodeSelector: {}
workload:
workload-name1:
enabled: true
primary: true
type: CronJob
schedule: "*/1 * * * *"
podSpec: {}
asserts:
- documentIndex: *cronJobDoc
equal:
path: spec.jobTemplate.spec.template.spec.nodeSelector
value:
kubernetes.io/arch: amd64
- it: should pass with nodeSelector from "global"
set:
podOptions:
nodeSelector:
disk: ssd
cpu: intel
hasGPU: "true"
workload:
workload-name1:
enabled: true
primary: true
type: CronJob
schedule: "*/1 * * * *"
podSpec: {}
asserts:
- documentIndex: *cronJobDoc
equal:
path: spec.jobTemplate.spec.template.spec.nodeSelector
value:
disk: ssd
cpu: intel
kubernetes.io/arch: amd64
hasGPU: "true"
- it: should set nodeSelector to non-existing on DaemonSet with stopAll
set:
global:
stopAll: true
podOptions:
nodeSelector:
disk: ssd
workload:
workload-name1:
enabled: true
primary: true
type: DaemonSet
podSpec: {}
asserts:
- documentIndex: *cronJobDoc
equal:
path: spec.template.spec.nodeSelector
value:
non-existing: "true"
- it: should not set nodeSelector to non-existent on non-DaemonSet with stopAll
set:
global:
stopAll: true
podOptions:
nodeSelector:
disk: ssd
workload:
workload-name1:
enabled: true
primary: true
type: Deployment
podSpec: {}
asserts:
- documentIndex: *cronJobDoc
notEqual:
path: spec.template.spec.nodeSelector
value:
non-existing: "true"
- it: should pass with nodeSelector from "pod"
set:
podOptions:
nodeSelector:
disk: ssd
cpu: intel
hasGPU: "false"
workload:
workload-name1:
enabled: true
primary: true
type: CronJob
schedule: "*/1 * * * *"
podSpec:
nodeSelector:
disk: hdd
cpu: amd
hasGPU: "true"
asserts:
- documentIndex: *cronJobDoc
equal:
path: spec.jobTemplate.spec.template.spec.nodeSelector
value:
disk: hdd
cpu: amd
hasGPU: "true"
- it: should pass with nodeSelector from "pod" with tpl
set:
disk_type: hdd
podOptions:
nodeSelector:
disk: ssd
cpu: intel
workload:
workload-name1:
enabled: true
primary: true
type: CronJob
schedule: "*/1 * * * *"
podSpec:
nodeSelector:
disk: "{{ .Values.disk_type }}"
cpu: amd
asserts:
- documentIndex: *cronJobDoc
equal:
path: spec.jobTemplate.spec.template.spec.nodeSelector
value:
disk: hdd
cpu: amd
- it: should ignore with empty value on nodeSelector
set:
podOptions:
nodeSelector:
disk: ""
workload:
workload-name1:
enabled: true
primary: true
type: CronJob
schedule: "*/1 * * * *"
podSpec: {}
asserts:
- documentIndex: *cronJobDoc
equal:
path: spec.jobTemplate.spec.template.spec.nodeSelector
value:
kubernetes.io/arch: amd64