kubeshop / tracetest

🔭 Tracetest - Build integration and end-to-end tests in minutes, instead of days, using OpenTelemetry and trace-based testing.
https://docs.tracetest.io/
Other
1.06k stars 69 forks source link

document local environment variables injection in CLI #2994

Open mathnogueira opened 1 year ago

mathnogueira commented 1 year ago

Describe the enhancement you'd like to see Our CLI is able to replace values into the definition file when you run tracetest run test. For example:

type: Test
spec:
  name: POST import pokemon
  description: Import a pokemon using its ID
  trigger:
    type: http
    httpRequest:
      url: http://pokemon-demo.tracetest.io/pokemon/import
      method: POST
      headers:
      - key: Content-Type
        value: application/json
      authentication:
        type: apiKey
        apiKey:
          key: X-Key
          # This is a reference to a local environment variable
          # This is different than when we reference environments 
          # (soon-to-be variablesets), which we prefix with `env:`
          value: ${POKEMON_APP_API_KEY}
          in: header
      body: '{ "id": 52 }'

Our CLI will detect the placeholder ${VAR_NAME} and replace the string ${VAR_NAME} with the content of the environment variable with the same name.

This is useful if you have to set the value of a variable based on your local machine or create variable sets using local env variables.

xoscar commented 9 months ago

@mathnogueira could you take a look at this to see if this is needed?

CC: @schoren