fix(tests): fix document position on cnpg after pgversion cm removal (#777)

**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:**

- [x] ⚖️ My code follows the style guidelines of this project
- [x] 👀 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
- [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
- [ ] ⬆️ 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):` 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._
This commit is contained in:
Stavros Kois
2024-04-07 16:13:32 +03:00
committed by GitHub
parent 868725da5d
commit 2ff0e92645
10 changed files with 32 additions and 132 deletions

View File

@@ -23,7 +23,7 @@ tests:
manualBackups:
- name: today
asserts:
- documentIndex: &secretDoc 3
- documentIndex: &secretDoc 2
isKind:
of: Secret
- documentIndex: *secretDoc

View File

@@ -21,7 +21,7 @@ tests:
azure:
connectionString: some-connection-string
asserts:
- documentIndex: &secretDoc 2
- documentIndex: &secretDoc 1
isKind:
of: Secret
- documentIndex: *secretDoc
@@ -97,7 +97,7 @@ tests:
google:
applicationCredentials: some-credentials
asserts:
- documentIndex: &secretDoc 2
- documentIndex: *secretDoc
isKind:
of: Secret
- documentIndex: *secretDoc
@@ -164,7 +164,7 @@ tests:
accessKey: some-access-key
secretKey: some-secret-key
asserts:
- documentIndex: &secretDoc 2
- documentIndex: *secretDoc
isKind:
of: Secret
- documentIndex: *secretDoc
@@ -235,7 +235,7 @@ tests:
accessKey: some-access-key
secretKey: some-secret-key
asserts:
- documentIndex: &secretDoc 2
- documentIndex: *secretDoc
isKind:
of: Secret
- documentIndex: *secretDoc
@@ -306,7 +306,7 @@ tests:
accessKey: some-access-key
secretKey: some-secret-key
asserts:
- documentIndex: &secretDoc 2
- documentIndex: *secretDoc
isKind:
of: Secret
- documentIndex: *secretDoc
@@ -378,7 +378,7 @@ tests:
accessKey: some-access-key
secretKey: some-secret-key
asserts:
- documentIndex: &secretDoc 2
- documentIndex: *secretDoc
isKind:
of: Secret
- documentIndex: *secretDoc
@@ -456,5 +456,5 @@ tests:
path: metadata.name
value: test-release-name-common-test-cnpg-my-pg
- documentIndex: *clusterDoc
isNull:
notExists:
path: spec.backup.target

View File

@@ -88,7 +88,7 @@ tests:
pitrTarget:
time: "2021-01-01T00:00:00Z"
asserts:
- documentIndex: &secretDoc 2
- documentIndex: &secretDoc 1
isKind:
of: Secret
- documentIndex: *secretDoc

View File

@@ -72,7 +72,7 @@ tests:
tag: "15.6"
global:
fallbackDefaults:
pgVersion: "15"
pgVersion: 15
vctAccessModes:
- ReadWriteMany
- ReadWriteOnce
@@ -124,7 +124,7 @@ tests:
enabled: true
user: test-user
database: test-db
pgVersion: "15"
pgVersion: 15
type: vectors
asserts:
- documentIndex: *clusterDoc
@@ -152,7 +152,7 @@ tests:
enabled: true
user: test-user
database: test-db
pgVersion: "15"
pgVersion: 15
asserts:
- documentIndex: *clusterDoc
isKind:

View File

@@ -13,7 +13,7 @@ tests:
user: test-user
database: test-db
asserts:
- documentIndex: &secretDoc 3
- documentIndex: &secretDoc 2
isKind:
of: Secret
- documentIndex: *secretDoc
@@ -36,7 +36,7 @@ tests:
path: stringData.password
pattern: ^[a-zA-Z0-9]{62}$
- documentIndex: &secretDoc 2
- documentIndex: &secretDoc 1
isKind:
of: Secret
- documentIndex: *secretDoc
@@ -73,7 +73,7 @@ tests:
enabled: true
createRO: false
asserts:
- documentIndex: &secretDoc 3
- documentIndex: &secretDoc 2
isKind:
of: Secret
- documentIndex: *secretDoc
@@ -110,7 +110,7 @@ tests:
enabled: true
createRO: true
asserts:
- documentIndex: &secretDoc 4
- documentIndex: &secretDoc 3
isKind:
of: Secret
- documentIndex: *secretDoc
@@ -156,7 +156,7 @@ tests:
database: test-db
password: test-password
asserts:
- documentIndex: &secretDoc 3
- documentIndex: &secretDoc 2
isKind:
of: Secret
- documentIndex: *secretDoc

View File

@@ -22,7 +22,7 @@ tests:
user: test-user
database: test-db
asserts:
- documentIndex: &deployDoc 4
- documentIndex: &deployDoc 3
isKind:
of: Deployment
- documentIndex: *deployDoc
@@ -63,7 +63,7 @@ tests:
enabled: true
createRO: false
asserts:
- documentIndex: &deployDoc 5
- documentIndex: &deployDoc 4
isKind:
of: Deployment
- documentIndex: *deployDoc
@@ -111,7 +111,7 @@ tests:
enabled: true
createRO: true
asserts:
- documentIndex: &deployDoc 6
- documentIndex: &deployDoc 5
isKind:
of: Deployment
- documentIndex: *deployDoc

View File

@@ -1,105 +0,0 @@
suite: cnpg pgVersion configmap test
templates:
- common.yaml
release:
name: test-release-name
namespace: test-release-namespace
tests:
- it: should generate correct configmap
set:
cnpg:
my-pg:
enabled: true
user: test-user
database: test-db
asserts:
- documentIndex: &cmDoc 1
isKind:
of: ConfigMap
- documentIndex: *cmDoc
isAPIVersion:
of: v1
- documentIndex: *cmDoc
equal:
path: metadata.name
value: test-release-name-common-test-cnpg-my-pg-pgversion
- documentIndex: *cmDoc
equal:
path: data.version
value: "16"
- it: should generate correct configmap with changed defaults
set:
global:
fallbackDefaults:
pgVersion: "15"
cnpg:
my-pg:
enabled: true
user: test-user
database: test-db
asserts:
- documentIndex: *cmDoc
isKind:
of: ConfigMap
- documentIndex: *cmDoc
isAPIVersion:
of: v1
- documentIndex: *cmDoc
equal:
path: metadata.name
value: test-release-name-common-test-cnpg-my-pg-pgversion
- documentIndex: *cmDoc
equal:
path: data.version
value: "15"
- it: should generate correct configmap with defaults being a number instead of string
set:
global:
fallbackDefaults:
pgVersion: 15
cnpg:
my-pg:
enabled: true
user: test-user
database: test-db
asserts:
- documentIndex: *cmDoc
isKind:
of: ConfigMap
- documentIndex: *cmDoc
isAPIVersion:
of: v1
- documentIndex: *cmDoc
equal:
path: metadata.name
value: test-release-name-common-test-cnpg-my-pg-pgversion
- documentIndex: *cmDoc
equal:
path: data.version
value: "15"
- it: should generate correct configmap with changed at cnpg level
set:
cnpg:
my-pg:
enabled: true
user: test-user
database: test-db
pgVersion: "15"
asserts:
- documentIndex: *cmDoc
isKind:
of: ConfigMap
- documentIndex: *cmDoc
isAPIVersion:
of: v1
- documentIndex: *cmDoc
equal:
path: metadata.name
value: test-release-name-common-test-cnpg-my-pg-pgversion
- documentIndex: *cmDoc
equal:
path: data.version
value: "15"

View File

@@ -455,7 +455,7 @@ tests:
requests:
cpu: 10m
memory: 50Mi
- documentIndex: &deploymentDoc 9
- documentIndex: &deploymentDoc 8
isKind:
of: Deployment
- documentIndex: *deploymentDoc

View File

@@ -37,16 +37,21 @@ env:
DNS_KEEP_NAMESERVER: "on"
DOT: "off"
{{- if $.Values.addons.vpn.killSwitch }}
{{- $excludednetworks := ( printf "%v,%v" $.Values.chartContext.podCIDR $.Values.chartContext.svcCIDR ) -}}
{{- $excludednetworks := (printf "%v,%v" $.Values.chartContext.podCIDR $.Values.chartContext.svcCIDR) -}}
{{- range $.Values.addons.vpn.excludedNetworks_IPv4 -}}
{{- $excludednetworks = ( printf "%v,%v" $excludednetworks . ) -}}
{{- $excludednetworks = (printf "%v,%v" $excludednetworks .) -}}
{{- end }}
{{- range $.Values.addons.vpn.excludedNetworks_IPv6 -}}
{{- $excludednetworksv6 = ( printf "%v,%v" $excludednetworks . ) -}}
{{- $excludednetworksv6 = (printf "%v,%v" $excludednetworks .) -}}
{{- end }}
FIREWALL: "on"
FIREWALL_OUTBOUND_SUBNETS: {{ $excludednetworks | quote }}
{{- $inputPorts := (list $.Values.service.main.ports.main.port) -}}
{{- $inputPorts := list -}}
{{- if and
$.Values.service $.Values.service.main $.Values.service.main.ports
$.Values.service.main.ports.main $.Values.service.main.ports.main.port -}}
{{- $inputPorts = list $.Values.service.main.ports.main.port -}}
{{- end -}}
{{- $inputPorts = concat $inputPorts $.Values.addons.vpn.inputPorts | mustUniq }}
FIREWALL_INPUT_PORTS: {{ join "," $inputPorts }}
{{- else }}

View File

@@ -24,10 +24,10 @@
{{- if eq $enabled "true" -}}
{{/* Handle version string */}}
{{- $pgVersion := $objectData.pgVersion | default (toString $.Values.global.fallbackDefaults.pgVersion) -}}
{{- $pgVersion := ($objectData.pgVersion | default $.Values.global.fallbackDefaults.pgVersion) | toString -}}
{{/* Set the updated pgVersion version to objectData */}}
{{- $_ := set $objectData "pgVersion" ($pgVersion | toString) -}}
{{- $_ := set $objectData "pgVersion" $pgVersion -}}
{{/* allow for injecting major upgrade code */}}
{{- if $objectData.upgradeMajor -}}