test(charts): comprehensive test improvements and expansions
Phase 1: Improve and expand existing test coverage with edge cases, validations, and regression tests. Changes: - Rename cache_persistence_test → persistence_test with full coverage for config, media, and cache persistence (60+ tests) - Rename service_ipv6_test → service_test with full service coverage including types, ports, annotations, LoadBalancer settings (80+ tests) - Rename startup_probe_test → probes_test covering all three probe types: startup, liveness, readiness with all configurations (60+ tests) - Expand networkpolicy_test with IPv4/IPv6 CIDR validations, egress restrictions, and edge cases (+13 tests) - Expand init_containers_test with full container spec and merge order validation (+5 tests) - Expand envfrom_test with prefix, optional, and multiple source combinations (+9 tests) Test coverage improvements: - All edge cases for persistence types (pvc, hostPath, emptyDir) - Service type validation (ClusterIP, NodePort, LoadBalancer, ExternalName) - Probe types validation (httpGet, tcpSocket, exec) - NetworkPolicy CIDR format validation (IPv4/IPv6) - Comprehensive regression tests for default behavior Total: 6 improved test files, 230+ new test cases Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Aleksei Sviridkin <f@lex.la>
This commit is contained in:
1 parent
cf2e60ee63
commit
a08951aaa3
9 files changed
+2067
-380
No files matched your search
@@ -117,3 +117,134 @@ tests:
|
||||
content:
|
||||
name: new-way
|
||||
image: alpine:3.18
|
||||
|
||||
# =============================================================================
|
||||
# EDGE CASES AND FULL SPECIFICATION
|
||||
# =============================================================================
|
||||
|
||||
- it: should handle empty extraInitContainers array
|
||||
set:
|
||||
extraInitContainers: []
|
||||
asserts:
|
||||
- isNull:
|
||||
path: spec.template.spec.initContainers
|
||||
|
||||
- it: should preserve full container specification with all fields
|
||||
set:
|
||||
extraInitContainers:
|
||||
- name: full-spec-init
|
||||
image: busybox:1.35
|
||||
imagePullPolicy: IfNotPresent
|
||||
command: ['sh', '-c']
|
||||
args: ['echo complete']
|
||||
env:
|
||||
- name: ENV_VAR
|
||||
value: test
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: init-config
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /config
|
||||
- name: media
|
||||
mountPath: /media
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
limits:
|
||||
cpu: 200m
|
||||
memory: 256Mi
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
allowPrivilegeEscalation: false
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].imagePullPolicy
|
||||
value: IfNotPresent
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].env[0].name
|
||||
value: ENV_VAR
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].envFrom[0].configMapRef.name
|
||||
value: init-config
|
||||
- lengthEqual:
|
||||
path: spec.template.spec.initContainers[0].volumeMounts
|
||||
count: 2
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].resources.requests.cpu
|
||||
value: 100m
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].resources.limits.memory
|
||||
value: 256Mi
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].securityContext.allowPrivilegeEscalation
|
||||
value: false
|
||||
|
||||
- it: should verify merge order (deprecated first, then extra)
|
||||
set:
|
||||
initContainers:
|
||||
- name: first-deprecated
|
||||
image: busybox:1.35
|
||||
extraInitContainers:
|
||||
- name: second-extra
|
||||
image: alpine:3.18
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].name
|
||||
value: first-deprecated
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[1].name
|
||||
value: second-extra
|
||||
|
||||
- it: should support three or more init containers
|
||||
set:
|
||||
extraInitContainers:
|
||||
- name: init-1
|
||||
image: busybox:1.35
|
||||
- name: init-2
|
||||
image: alpine:3.18
|
||||
- name: init-3
|
||||
image: ubuntu:22.04
|
||||
- name: init-4
|
||||
image: debian:12
|
||||
asserts:
|
||||
- lengthEqual:
|
||||
path: spec.template.spec.initContainers
|
||||
count: 4
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[2].name
|
||||
value: init-3
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[3].name
|
||||
value: init-4
|
||||
|
||||
# Regression: verify initContainers comes first when merged
|
||||
- it: should always place deprecated initContainers before extraInitContainers
|
||||
set:
|
||||
initContainers:
|
||||
- name: deprecated-init
|
||||
image: busybox:1.35
|
||||
- name: deprecated-init-2
|
||||
image: busybox:1.36
|
||||
extraInitContainers:
|
||||
- name: extra-init
|
||||
image: alpine:3.18
|
||||
- name: extra-init-2
|
||||
image: alpine:3.19
|
||||
asserts:
|
||||
- lengthEqual:
|
||||
path: spec.template.spec.initContainers
|
||||
count: 4
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[0].name
|
||||
value: deprecated-init
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[1].name
|
||||
value: deprecated-init-2
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[2].name
|
||||
value: extra-init
|
||||
- equal:
|
||||
path: spec.template.spec.initContainers[3].name
|
||||
value: extra-init-2
|
||||
Reference in new issue
Block a user