This commit is contained in:
2026-10-19 16:40:42 -04:00
parent 321f7d8c00
commit d038fe3bab
10 changed files with 411 additions and 46 deletions
+33 -2
View File
@@ -36,6 +36,8 @@
- container.resources == wikideck_resources
- container.ports[0].containerPort == 3001
- container.startupProbe.httpGet.path == '/healthz'
- container.startupProbe.failureThreshold == wikideck_startup_probe_failure_threshold
- container.startupProbe.periodSeconds == 5
- container.readinessProbe.httpGet.path == '/healthz'
- container.livenessProbe.httpGet.path == '/healthz'
- pod.terminationGracePeriodSeconds >= 30
@@ -44,7 +46,12 @@
- container.volumeMounts[0].mountPath == '/app/data'
- env.HOST == '0.0.0.0' and env.PORT == '3001'
- env.WIKIDECK_DATA_DIR == '/app/data' and env.NODE_ENV == 'production'
- env.WIKIDECK_OFFLINE == ('1' if wikideck_offline else '0')
- env.WIKIDECK_PEERS == wikideck_peers | join(',')
- env.WIKIDECK_ALLOW_PRIVATE_PEERS == ('1' if wikideck_allow_private_peers else '0')
- env.WIKIDECK_OFFLINE is not defined
- env.RANDOMX_BINARY is not defined
- container.command is not defined and container.args is not defined
- pod.containers | length == 1
- (env.PUBLIC_ORIGIN | default('')) == wikideck_public_origin
- wikideck_test_manifests.pvc.spec.accessModes == wikideck_storage_access_modes
- wikideck_test_manifests.ingress.spec.tls[0].secretName == wikideck_tls_secret_name
@@ -56,6 +63,8 @@
- wikideck_test_manifests.networkpolicy.spec.policyTypes == ['Ingress', 'Egress']
- wikideck_test_manifests.networkpolicy.spec.ingress | length == (1 if wikideck_network_policy_ingress_from | length > 0 else 0)
- wikideck_test_manifests.networkpolicy.spec.egress | length == expected_egress_count | int
- wikideck_resources.requests.memory == '512Mi'
- wikideck_resources.limits.memory == '1Gi'
vars:
deployment: "{{ wikideck_test_manifests.deployment }}"
pod: "{{ deployment.spec.template.spec }}"
@@ -64,7 +73,29 @@
expected_claim: "{{ wikideck_existing_claim if wikideck_existing_claim | length > 0 else wikideck_name ~ '-data' }}"
expected_egress_count: >-
{{ (1 if wikideck_network_policy_dns_to | length > 0 else 0)
+ (1 if not wikideck_offline and wikideck_network_policy_https_to | length > 0 else 0) }}
+ (1 if wikideck_peers | length > 0 and wikideck_network_policy_https_to | length > 0
and wikideck_network_policy_https_ports | length > 0 else 0)
+ (wikideck_network_policy_peer_egress | length if wikideck_peers | length > 0 else 0) }}
- name: Check public peer egress destinations and ports
ansible.builtin.assert:
that:
- public_rule.to == wikideck_network_policy_https_to
- public_rule.ports | map(attribute='port') | list == wikideck_network_policy_https_ports
- public_rule.ports | map(attribute='protocol') | unique | list == ['TCP']
vars:
public_rule: "{{ wikideck_test_manifests.networkpolicy.spec.egress[1 if wikideck_network_policy_dns_to | length > 0 else 0] }}"
when:
- wikideck_peers | length > 0
- wikideck_network_policy_https_to | length > 0
- wikideck_network_policy_https_ports | length > 0
- name: Check explicit peer egress survives unchanged
ansible.builtin.assert:
that: wikideck_test_manifests.networkpolicy.spec.egress[-(wikideck_network_policy_peer_egress | length):] == wikideck_network_policy_peer_egress
when:
- wikideck_peers | length > 0
- wikideck_network_policy_peer_egress | length > 0
- name: Check omitted default StorageClass
ansible.builtin.assert: