Files
library-charts/library/common-test/tests/volsync/validation_test.yaml
Stavros Kois 6799df67c4 fix(tests): fix flaky tests from updates (#816)
**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  # <!--(issue)-->

**⚙️ 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
- [ ] 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-05-19 15:39:42 +02:00

227 lines
5.9 KiB
YAML

suite: volsync validation test
templates:
- common.yaml
release:
name: test-release-name
namespace: test-release-namespace
tests:
- it: should fail with empty name
set:
persistence:
src-backup:
enabled: true
type: pvc
mountPath: /backed-up
volsync:
- name: ""
type: restic
credentials: my-secret
src:
enabled: true
dest:
enabled: false
credentials: {}
asserts:
- failedTemplate:
errorMessage: VolSync - Expected non-empty [name]
- it: should fail with empty credentials
set:
persistence:
src-backup:
enabled: true
type: pvc
mountPath: /backedup
volsync:
- name: my-backup
type: restic
credentials: ""
src:
enabled: true
dest:
enabled: false
asserts:
- failedTemplate:
errorMessage: VolSync - Expected non-empty [credentials]
- it: should fail if referenced credentials does not exist
set:
persistence: &persistence
src-backup:
enabled: true
type: pvc
mountPath: /backedup
volsync:
- name: my-backup
type: restic
credentials: my-secret
src:
enabled: true
dest:
enabled: false
credentials:
my-other-secret:
type: s3
url: some-url
bucket: some-bucket
encrKey: some-key
accessKey: some-access-key
secretKey: some-secret-key
asserts:
- failedTemplate:
errorMessage: VolSync - Expected credentials [my-secret] to be defined in [credentials] which currently contains [my-other-secret] keys
- it: should fail if credentials.url is empty
set:
persistence: *persistence
credentials:
my-secret:
type: s3
url: ""
asserts:
- failedTemplate:
errorMessage: VolSync - Expected non-empty [url] in [credentials.my-secret]
- it: should fail if credentials.bucket is empty
set:
persistence: *persistence
credentials:
my-secret:
type: s3
url: some-url
bucket: ""
asserts:
- failedTemplate:
errorMessage: VolSync - Expected non-empty [bucket] in [credentials.my-secret]
- it: should fail if credentials.encrKey is empty
set:
persistence: *persistence
credentials:
my-secret:
type: s3
url: some-url
bucket: some-bucket
encrKey: ""
asserts:
- failedTemplate:
errorMessage: VolSync - Expected non-empty [encrKey] in [credentials.my-secret]
- it: should fail if credentials.accessKey is empty
set:
persistence: *persistence
credentials:
my-secret:
type: s3
url: some-url
bucket: some-bucket
encrKey: some-key
accessKey: ""
asserts:
- failedTemplate:
errorMessage: VolSync - Expected non-empty [accessKey] in [credentials.my-secret]
- it: should fail if credentials.secretKey is empty
set:
persistence: *persistence
credentials:
my-secret:
type: s3
url: some-url
bucket: some-bucket
encrKey: some-key
accessKey: some-access-key
secretKey: ""
asserts:
- failedTemplate:
errorMessage: VolSync - Expected non-empty [secretKey] in [credentials.my-secret]
- it: should fail with invalid copy method
set:
persistence:
src-backup:
enabled: true
type: pvc
mountPath: /backedup
volsync:
- name: my-backup
type: restic
credentials: my-secret
copyMethod: invalid
src:
enabled: true
dest:
enabled: false
credentials: &credentials
my-secret:
type: s3
url: some-url
bucket: some-bucket
encrKey: some-key
accessKey: some-access-key
secretKey: some-secret-key
asserts:
- failedTemplate:
errorMessage: VolSync - Expected [copyMethod] to be one of [Clone, Direct, Snapshot], but got [invalid]
- it: should fail with empty type
set:
persistence:
src-backup:
enabled: true
type: pvc
mountPath: /backedup
volsync:
- name: my-backup
type: ""
credentials: my-secret
src:
enabled: true
dest:
enabled: false
asserts:
- failedTemplate:
errorMessage: VolSync - Expected non-empty [type]
- it: should fail with invalid type
set:
persistence:
src-backup:
enabled: true
type: pvc
mountPath: /backedup
volsync:
- name: my-backup
type: invalid
credentials: my-secret
src:
enabled: true
dest:
enabled: false
credentials: *credentials
asserts:
- failedTemplate:
errorMessage: VolSync - Expected [type] to be one of [restic], but got [invalid]
- it: should fail with invalid credentials type
set:
persistence:
src-backup:
enabled: true
type: pvc
mountPath: /backedup
volsync:
- name: my-backup
type: restic
credentials: my-creds
src:
enabled: true
dest:
enabled: false
credentials:
my-creds:
type: invalid
asserts:
- failedTemplate:
errorMessage: VolSync - Expected [type] in [credentials.my-creds] to be one of [s3], but got [invalid]