1 Commits
  • test(networkpolicy): add comprehensive helm-unittest test suite
    Add 20+ unit tests for NetworkPolicy template covering:
    
    Creation conditions:
    - Not created by default (enabled: false)
    - Created when enabled: true
    - Fails with clear error when hostNetwork + NetworkPolicy enabled
    - Fails when DLNA + NetworkPolicy enabled
    
    Ingress rules:
    - Default allowExternal behavior (no 'from' restriction)
    - Restricted access with podSelector/namespaceSelector
    - Custom ingress rules application
    - Automatic Prometheus ingress when metrics enabled
    - Prometheus namespace selector when specified
    
    Egress rules:
    - DNS egress with default kube-system/kube-dns
    - Custom DNS namespace and pod selector
    - AllowAllEgress default behavior
    - Restricted egress modes (metadata, in-cluster)
    - Custom CIDR blocks
    - Custom egress rules application
    - DNS disabled scenario
    
    Policy configuration:
    - Correct policyTypes (Ingress, Egress)
    - Pod selector labels matching chart labels
    
    Tests ensure NetworkPolicy works correctly across all supported
    configurations and fails safely when misconfigured.
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    Signed-off-by: Aleksei Sviridkin <f@lex.la>