quintush / helm-unittest

BDD styled unit test framework for Kubernetes Helm charts as a Helm plugin.
MIT License
345 stars 69 forks source link

Feature request: assert length #190

Closed x0ddf closed 1 year ago

x0ddf commented 1 year ago

There's part of the specs that required testing the count of objects inside a particular spec: For example: For ingress, there's a spec.tls section, and the count of defined hosts should match with spec.rules

It would be great to have something like the following:

- it: length matches
  set:
    global.ingress.hosts:
       - prod.example.com
       - stage.example.com
  asserts:
     - lengthEqual:
         path: spec.tls # optional, conflicts with paths |
         paths: # optional, conflicts with path
           - spec.tls
           - spec.rules
         count: 2 # optional field if paths defined, but required if the path is used