quintush / helm-unittest

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

Regression: matchRegex path name with dot not parsed correctly #207

Open krithika369 opened 1 year ago

krithika369 commented 1 year ago

Hello,

I have a secret resource as follows:

apiVersion: v1
kind: Secret
metadata:
...
stringData:
  config.yaml: |
   ...

Until the official version v0.2.11 of this plugin, I am able to write a test for it like so:

      - matchRegex: # check database address
          path: stringData.[config.yaml]
          pattern: "Host: my-release-abc-postgresql.my-namespace.svc.cluster.local"

But, as of the latest commit, I get the following error:

child name missing at position 11, following "stringData."

No issues if config.yaml is name config-yaml, for example.

It's not a problem for us as we can pin our plugin version to the official release version. But seeing that the test CI job is passing for the recent commits, I wanted to flag this.

Do let me know if you need any other info. Thanks!

Tarasovych commented 1 year ago

Same issue, I have path: metadata.labels.[app.kubernetes.io/component]

                        Error:
                                child name missing at position 16, following ".labels."
helm plugin list
NAME            VERSION DESCRIPTION                                                                         
unittest        0.3.1   Unit test for helm chart in YAML with ease to keep your chart functional and robust.
mocdaniel commented 1 year ago

I can confirm this, we are trying to match the contents of data.[somefile.conf] to a given expression.

Ceddaerrix commented 11 months ago

I think the discussion under issue https://github.com/helm-unittest/helm-unittest/issues/196 somewhat relates to what is mentioned here