goss icon indicating copy to clipboard operation
goss copied to clipboard

Dinamic variables and envs

Open legolego621 opened this issue 2 years ago • 3 comments

Hello, can I use dinamic variables and envs like this?

command:
  kubectl get nodes:
    exit-status: 0
    stdout:
      not:
        match-regexp: 'NotReady'
  export test="a":
    exit-status: 0



http:
  '{{.Env.test}}':
    status: 200
    timeout: 5000

legolego621 avatar Jan 17 '24 16:01 legolego621

Using a command output as a variable isn't supported currently. You would have to generate the vars.yaml file prior to running Goss.

This isn't a bad feature request, it's somewhat related to #784

If the vars.yaml supported a simple interface that ran a command to set the car to its stdout.. would that sufficiently solve #784 or does it add too much complexity?

aelsabbahy avatar Jan 21 '24 18:01 aelsabbahy

Cc: @uk-bolly (meant to tag you on last comment)

aelsabbahy avatar Jan 21 '24 19:01 aelsabbahy

thanks @aelsabbahy @legolego621

I like the idea and does cover off some of the idea of #784

However i would be using some some discovered variables multiple times, so it would require a running order, alternatively a wrapper script to set all the variables that could be inherited, if that would work? The simplicity of goss and modules would be lost somewhat with a wrapper script at that level.

uk-bolly avatar Mar 01 '24 13:03 uk-bolly