Files
Stavros Kois 2fe00ebdd1 replace <> with [] in fail messages (#586)
**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  #584 

**⚙️ Type of change**

- [ ] ⚙️ Feature/App addition
- [ ] 🪛 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:**

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

** App addition**

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

- [ ] 🪞 I have opened a PR on
[truecharts/containers](https://github.com/truecharts/containers) adding
the container to TrueCharts mirror repo.
- [ ] 🖼️ 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._
2023-11-12 19:16:09 +01:00

171 lines
6.1 KiB
YAML

suite: podDisruptionBudget validation test
templates:
- common.yaml
release:
name: test-release-name
namespace: test-release-namespace
tests:
- it: should fail with name longer than 63 characters
set:
podDisruptionBudget:
my-poddisruptionbudget-super-long-name-that-is-longer-than-63-characters:
enabled: true
asserts:
- failedTemplate:
errorMessage: Name [test-release-name-common-test-my-poddisruptionbudget-super-long-name-that-is-longer-than-63-characters] is not valid. Must start and end with an alphanumeric lowercase character. It can contain '-'. And must be at most 63 characters.
- it: should fail with name starting with underscore
set:
podDisruptionBudget:
_my-poddisruptionbudget:
enabled: true
asserts:
- failedTemplate:
errorMessage: Name [test-release-name-common-test-_my-poddisruptionbudget] is not valid. Must start and end with an alphanumeric lowercase character. It can contain '-'. And must be at most 63 characters.
- it: should fail with namespace longer than 63 characters
set:
podDisruptionBudget:
my-poddisruptionbudget:
enabled: true
minAvailable: 1
targetSelector: my-pod
namespace: my-extra-super-duper-long-name-that-is-longer-than-63-characters
asserts:
- failedTemplate:
errorMessage: Pod Disruption Budget - Namespace [my-extra-super-duper-long-name-that-is-longer-than-63-characters] is not valid. Must start and end with an alphanumeric lowercase character. It can contain '-'. And must be at most 63 characters.
- it: should fail with namespace not starting with [ix-] in TrueNAS SCALE
set:
global:
ixChartContext:
iAmNotEmpty: true
podDisruptionBudget:
my-poddisruptionbudget:
enabled: true
minAvailable: 1
targetSelector: my-pod
namespace: my-namespace
asserts:
- failedTemplate:
errorMessage: Pod Disruption Budget - Namespace [my-namespace] expected to have [ix-] prefix when installed in TrueNAS SCALE
- it: should fail with labels not a dict
set:
podDisruptionBudget:
my-poddisruptionbudget:
enabled: true
targetSelector: my-pod
labels: "not a dict"
asserts:
- failedTemplate:
errorMessage: Pod Disruption Budget - Expected [labels] to be a dictionary, but got [string]
- it: should fail with annotations not a dict
set:
podDisruptionBudget:
my-poddisruptionbudget:
enabled: true
targetSelector: my-pod
annotations: "not a dict"
asserts:
- failedTemplate:
errorMessage: Pod Disruption Budget - Expected [annotations] to be a dictionary, but got [string]
- it: should fail with not valid unhealthyPodEvictionPolicy
set:
configmap:
podDisruptionBudget:
my-poddisruptionbudget:
enabled: true
targetSelector: my-pod
unhealthyPodEvictionPolicy: "not valid"
asserts:
- failedTemplate:
errorMessage: Pod Disruption Budget - Expected [unhealthyPodEvictionPolicy] to be one of [IfHealthyBudget, AlwaysAllow], but got [not valid]
- it: should fail with empty minAvailable
set:
podDisruptionBudget:
my-poddisruptionbudget:
enabled: true
targetSelector: my-pod
minAvailable:
asserts:
- failedTemplate:
errorMessage: Pod Disruption Budget - Expected the defined key [minAvailable] in [podDisruptionBudget.my-poddisruptionbudget] to not be empty
- it: should fail with empty maxUnavailable
set:
podDisruptionBudget:
my-poddisruptionbudget:
enabled: true
targetSelector: my-pod
maxUnavailable:
asserts:
- failedTemplate:
errorMessage: Pod Disruption Budget - Expected the defined key [maxUnavailable] in [podDisruptionBudget.my-poddisruptionbudget] to not be empty
- it: should fail without at least one key defined
set:
podDisruptionBudget:
my-poddisruptionbudget:
enabled: true
targetSelector: my-pod
asserts:
- failedTemplate:
errorMessage: Pod Disruption Budget - Expected at least one of [minAvailable, maxUnavailable] to be defined in [podDisruptionBudget.my-poddisruptionbudget]
- it: should fail with empty enabled
set:
podDisruptionBudget:
my-poddisruptionbudget:
enabled:
targetSelector: my-pod
asserts:
- failedTemplate:
errorMessage: Pod Disruption Budget - Expected the defined key [enabled] in [podDisruptionBudget.my-poddisruptionbudget] to not be empty
- it: should fail with pod targetSelector not a string
set:
podDisruptionBudget:
my-poddisruptionbudget:
enabled: true
targetSelector:
pod: "not a string"
asserts:
- failedTemplate:
errorMessage: Pod Disruption Budget - Expected [targetSelector] to be [string], but got [map]
- it: should fail without either targetSelector or customLabels
set:
podDisruptionBudget:
my-poddisruptionbudget:
enabled: true
asserts:
- failedTemplate:
errorMessage: Pod Disruption Budget - Expected one of [targetSelector, customLabels] to be defined in [podDisruptionBudget.my-poddisruptionbudget]
- it: should fail with both targetSelector and customLabels
set:
podDisruptionBudget:
my-poddisruptionbudget:
enabled: true
targetSelector: my-pod
customLabels:
label1: label1
asserts:
- failedTemplate:
errorMessage: Pod Disruption Budget - Expected only one of [targetSelector, customLabels] to be defined in [podDisruptionBudget.my-poddisruptionbudget]
- it: should fail with selected pod that does not exist
set:
podDisruptionBudget:
my-poddisruptionbudget:
enabled: true
targetSelector: my-pod
minAvailable: 1
asserts:
- failedTemplate:
errorMessage: Pod Disruption Budget - Selected pod [my-pod] is not defined