test(installer): tie each platform source flag to its own value

Both secrets were only ever set together, so a cert flag keyed on
platformSourceSecret stayed green. A pull-through cache behind a private
CA usually needs the CA without credentials, which is exactly the case
such a slip breaks. The absence checks match the flag by prefix, since
a whole-element comparison misses the flag rendered with any value.

Assisted-by: LLM
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
This commit is contained in:
Kirill Ilin committed 2026-11-06 18:29:18 +05:00
1 parent dfd7cbed36
commit fbfc270c71
1 file changed
+39 -5
@@ -1,12 +1,47 @@
suite: cozystack-operator platform source arguments
# Each flag must follow its own value: a pull-through cache behind a private CA
# often needs the CA without credentials, so a cert flag keyed on the wrong
# value would bring back the TLS failure while every other case stays green.
templates:
- templates/cozystack-operator.yaml
tests:
- it: passes platformSourceCertSecret to the operator
- it: passes platformSourceCertSecret alone, without credentials
set:
cozystackOperator.platformSourceCertSecret: registry-ca
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: --platform-source-cert-secret=registry-ca
documentSelector:
path: kind
value: Deployment
- notExists:
path: spec.template.spec.containers[0].args[?(@ =~ /^--platform-source-secret=/)]
documentSelector:
path: kind
value: Deployment
- it: passes platformSourceSecret alone, without the cert flag
set:
cozystackOperator.platformSourceSecret: registry-creds
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: --platform-source-secret=registry-creds
documentSelector:
path: kind
value: Deployment
- notExists:
path: spec.template.spec.containers[0].args[?(@ =~ /^--platform-source-cert-secret=/)]
documentSelector:
path: kind
value: Deployment
- it: passes both secrets together
set:
cozystackOperator.platformSourceUrl: oci://registry.internal:8083/cozystack/cozystack/cozystack-packages
cozystackOperator.platformSourceSecret: registry-creds
cozystackOperator.platformSourceCertSecret: registry-ca
asserts:
@@ -25,9 +60,8 @@ tests:
- it: omits the cert secret flag by default
asserts:
- notContains:
path: spec.template.spec.containers[0].args
content: --platform-source-cert-secret=
- notExists:
path: spec.template.spec.containers[0].args[?(@ =~ /^--platform-source-cert-secret=/)]
documentSelector:
path: kind
value: Deployment