Commit Graph
4 Commits
  • fix(tests): fix all helm-unittest test failures
    Fixed comprehensive test suite to achieve 100% pass rate (603/603 tests).
    
    Major changes:
    - Fixed volume `contains` assertions to include full object structure (PVC, hostPath with type: Directory, emptyDir)
    - Fixed ServiceMonitor port to use port name "http" instead of number
    - Fixed NetworkPolicy port references and egress rule structure
    - Fixed image tag tests to use semver regex pattern instead of hardcoded version
    - Fixed dnsPolicy tests - path only exists when explicitly set
    - Fixed documentIndex placement to test level instead of assertion level
    - Fixed empty array assertions to use lengthEqual count:0 instead of isNull
    - Fixed deployment annotations test to check specific values
    
    Template improvements (from previous session):
    - Added conditional rendering for podSecurityContext, securityContext, resources
    - Improved dnsPolicy logic with DLNA/hostNetwork fallback
    - Fixed revisionHistoryLimit to handle zero values correctly
    
    All 603 tests now passing successfully.
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    Signed-off-by: Aleksei Sviridkin <f@lex.la>
  • fix(tests): fix label/annotation paths and add missing templates
    - Replace escaped dot notation (app\.kubernetes\.io/name) with bracket notation (["app.kubernetes.io/name"])
    - Add missing templates to test suites (service.yaml, ingress.yaml, httpRoute.yaml, serviceaccount.yaml, persistentVolumeClaim.yaml)
    - This fixes 40+ test failures related to unknown paths in labels and annotations
    
    Test progress: 535/603 passing (89%), up from 495/603 (82%)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    Signed-off-by: Aleksei Sviridkin <f@lex.la>
  • 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>
  • 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>