Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable selectors to utilize variables #3624

Open
kdhamric opened this issue Feb 11, 2024 · 0 comments
Open

Enable selectors to utilize variables #3624

kdhamric opened this issue Feb 11, 2024 · 0 comments
Assignees
Labels

Comments

@kdhamric
Copy link
Collaborator

kdhamric commented Feb 11, 2024

As a user,
I may have selector names
that include data based on ids or other dynamic data
and want to be able to have a selector that incorporates variables,
interprets them, and utilizes the final string as the selector.

A good way to see / reproduce this issue is to use the following test in our tracetest-demo org in the pokeshop-demo environment (join here). It takes the pokeshop_id as a parameter. In the selector, I need to be able to use the pokemon_id as a variable and not have it hardcoded (ie this needs to be dynamic based on the pokemon_id: name="del pokemon-9693")

Priority: low to medium - do as we have cycles as this came from an internal use case.

type: Test
spec:
 id: delete-pokemon
 name: Delete Pokemon
 trigger:
   type: http
   httpRequest:
     method: DELETE
     url: https://demo-pokeshop.tracetest.io/pokemon/${env:pokemon_id}
     headers:
     - key: Content-Type
       value: application/json
 specs:
 - selector: span[tracetest.span.type="general" name="Tracetest trigger"]
   name: Delete returns a 200 status code
   assertions:
   - attr:tracetest.response.status = 200
 - selector: span[tracetest.span.type="database" name="del pokemon-9693" db.system="redis" db.operation="del" db.redis.database_index="0"]
   name: Ensure we are deleting from the redis cache also
   assertions:
   - attr:tracetest.selected_spans.count = 1

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants