Files
library-charts/library/common-test/tests/container_in_deployment/volumeMounts_test.yaml
Kjeld Schouten-Lebbing 303df87c51 feat(common): readd TrueCharts specific features to refactor (#292)
**Description**
This PR re-adds TrueCharts specific portions back into the refactor done
by iX-Systems to the common-chart

**⚙️ 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._

Co-authored-by: Stavros kois <s.kois@outlook.com>
Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
2023-01-23 00:37:30 +01:00

266 lines
6.9 KiB
YAML

suite: container in deployment volumeMount test
templates:
- common.yaml
tests:
- it: should pass with default values
documentIndex: &deploymentDoc 0
asserts:
- hasDocuments:
count: 3
- isKind:
of: Deployment
- equal:
path: spec.template.spec.containers[0].volumeMounts
value:
- mountPath: /shared
name: shared
- mountPath: /dev/shm
name: shm
- mountPath: /tmp
name: tmp
- mountPath: /var/logs
name: varlogs
- it: should fail with no mountPath set
set:
persistence:
vol1:
enabled: true
asserts:
- failedTemplate:
errorMessage: <mountPath> must be defined, alternatively use the <noMount> flag.
- it: should fail when mountPath does not start with /
set:
persistence:
vol1:
enabled: true
mountPath: relative/path/to/dir
asserts:
- failedTemplate:
errorMessage: Mount path (relative/path/to/dir), must start with a forward slash -> / <-
- it: should fail with empty readOnly
set:
persistence:
vol1:
enabled: true
mountPath: /some/path
readOnly:
asserts:
- failedTemplate:
errorMessage: <readOnly> cannot be empty on item (vol1)
- it: should fail with empty mountPath
set:
persistence:
vol1:
enabled: true
mountPath:
asserts:
- failedTemplate:
errorMessage: <mountPath> must be defined, alternatively use the <noMount> flag.
- it: should pass with enabled false
documentIndex: *deploymentDoc
set:
persistence:
vol1:
enabled: false
asserts:
- notContains:
path: spec.template.spec.containers[0].volumeMounts
content:
name: vol1
- it: should pass with noMount true
documentIndex: *deploymentDoc
set:
persistence:
vol1:
noMount: true
asserts:
- notContains:
path: spec.template.spec.containers[0].volumeMounts
content:
name: vol1
- it: should pass with mountPath set
documentIndex: *deploymentDoc
set:
persistence:
vol1:
enabled: true
mountPath: /some_path
asserts:
- contains:
path: spec.template.spec.containers[0].volumeMounts
content:
mountPath: /some_path
name: vol1
- it: should pass with mountPath set (multiple entries)
documentIndex: *deploymentDoc
set:
persistence:
vol1:
enabled: true
mountPath: /some_path
vol2:
enabled: true
mountPath: /some_path2
asserts:
- contains:
path: spec.template.spec.containers[0].volumeMounts
content:
mountPath: /some_path
name: vol1
- contains:
path: spec.template.spec.containers[0].volumeMounts
content:
mountPath: /some_path2
name: vol2
- it: should pass with mountPath and readOnly(true) set
documentIndex: *deploymentDoc
set:
persistence:
vol1:
enabled: true
mountPath: /some_path
readOnly: true
asserts:
- contains:
path: spec.template.spec.containers[0].volumeMounts
content:
mountPath: /some_path
name: vol1
readOnly: true
- it: should pass with mountPath and readOnly(false) set
documentIndex: *deploymentDoc
set:
persistence:
vol1:
enabled: true
mountPath: /some_path
readOnly: false
asserts:
- contains:
path: spec.template.spec.containers[0].volumeMounts
content:
mountPath: /some_path
name: vol1
readOnly: false
- it: should pass with mountPath and subPath set
documentIndex: *deploymentDoc
set:
persistence:
vol1:
enabled: true
mountPath: /some_path
subPath: config.yaml
asserts:
- contains:
path: spec.template.spec.containers[0].volumeMounts
content:
mountPath: /some_path
name: vol1
subPath: config.yaml
- it: should pass with mountPath and mountPropagation set
documentIndex: *deploymentDoc
set:
persistence:
vol1:
enabled: true
mountPath: /some_path
mountPropagation: HostToContainer
asserts:
- contains:
path: spec.template.spec.containers[0].volumeMounts
content:
mountPath: /some_path
name: vol1
mountPropagation: HostToContainer
- it: should pass with all set set
documentIndex: *deploymentDoc
set:
persistence:
vol1:
enabled: true
mountPath: /some_path
mountPropagation: HostToContainer
asserts:
- contains:
path: spec.template.spec.containers[0].volumeMounts
content:
mountPath: /some_path
name: vol1
mountPropagation: HostToContainer
- it: should pass with all set (readonly false)
documentIndex: *deploymentDoc
set:
persistence:
vol1:
enabled: true
mountPath: /some_path
subPath: config.yaml
readOnly: false
mountPropagation: HostToContainer
asserts:
- contains:
path: spec.template.spec.containers[0].volumeMounts
content:
mountPath: /some_path
name: vol1
subPath: config.yaml
readOnly: false
mountPropagation: HostToContainer
- it: should pass with all set (readonly true)
documentIndex: *deploymentDoc
set:
persistence:
vol1:
enabled: true
mountPath: /some_path
subPath: config.yaml
readOnly: true
mountPropagation: HostToContainer
asserts:
- contains:
path: spec.template.spec.containers[0].volumeMounts
content:
mountPath: /some_path
name: vol1
subPath: config.yaml
readOnly: true
mountPropagation: HostToContainer
- it: should pass with all set (readonly true) from tpl
documentIndex: *deploymentDoc
set:
some_mount: /some_path
sub_path: config.yaml
mount_propagation: HostToContainer
persistence:
vol1:
enabled: true
mountPath: "{{ .Values.some_mount }}"
subPath: "{{ .Values.sub_path }}"
readOnly: true
mountPropagation: "{{ .Values.mount_propagation }}"
asserts:
- contains:
path: spec.template.spec.containers[0].volumeMounts
content:
mountPath: /some_path
name: vol1
subPath: config.yaml
readOnly: true
mountPropagation: HostToContainer