Files
astro-stanandGitHub f15cd12039 feat(common): Add customCA and customCASecretRef support for CNPG (#40523)
**Description**

As a continuation of #40385 and #40000 I am now extending customCA and
customCASecretRef support to work with CNPG backup/restore

⚒️ Fixes  # <!--(issue)-->

**⚙️ Type of change**

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

**🧪 How Has This Been Tested?**

- Tested generation using `helm template` and inspecting the results
-  CI tests


**📃 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 changes to the documentation
- [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):`, `chore(chart-name):`, `docs(chart-name):` or
`fix(docs):`

** 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._
2025-10-11 21:30:56 +02:00

108 lines
3.1 KiB
YAML

suite: cnpg backup validation test
templates:
- common.yaml
release:
name: test-release-name
namespace: test-release-namespace
tests:
- it: should fail without name in manualBackups backup
set:
credentials:
test:
type: azure
connectionString: some-connection-string
cnpg:
my-pg:
enabled: true
backups:
enabled: true
credentials: test
manualBackups:
- name:
asserts:
- failedTemplate:
errorMessage: CNPG Backup - Expected non-empty [name] in [backups.manualBackups] entry
- it: should fail with invalid name in manualBackups backup
set:
credentials:
test:
type: azure
connectionString: some-connection-string
cnpg:
my-pg:
enabled: true
backups:
enabled: true
credentials: test
manualBackups:
- name: _invalid
asserts:
- failedTemplate:
errorMessage: Name [test-release-name-common-test-cnpg-my-pg-backup-_invalid] is not valid. Must start and end with an alphanumeric lowercase character. It can contain '-'. And must be at most 253 characters.
- it: should fail with invalid url in s3 credentials
set:
credentials:
test:
type: s3
url: some-url
bucket: some-bucket
encrKey: some-encr-key
accessKey: some-access-key
secretKey: some-secret-key
cnpg:
my-pg:
enabled: true
user: test-user
database: test-db
password: test-password
backups:
enabled: true
credentials: test
manualBackups:
- name: today
asserts:
- failedTemplate:
errorMessage: CNPG Backup - Expected [url] in [credentials.test] to start with [http://] or [https://]. It was observed that sometimes can cause issues if it does not. Got [some-url]
- it: should fail with both customCA and customCASecretRef specified in s3 credentials
set:
secret:
my-secret:
enabled: true
data:
my-key: |-
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
credentials:
test:
type: s3
url: https://valid-url.com
bucket: some-bucket
encrKey: some-encr-key
accessKey: some-access-key
secretKey: some-secret-key
customCA: |-
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
customCASecretRef:
name: my-secret
key: my-key
cnpg:
my-pg:
enabled: true
user: test-user
database: test-db
password: test-password
backups:
enabled: true
credentials: test
manualBackups:
- name: today
asserts:
- failedTemplate:
errorMessage: CNPG Backup - Both [customCA] and [customCASecretRef] defined in [credentials.test]. Choose one