Created
November 30, 2022 18:29
-
-
Save adnanrahic/2b4603b6f68d59e2977d8a69e388c8fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type: Test | |
spec: | |
id: 6T0F1LOVR | |
name: OSCAR - DEMO - Import | |
description: Import a Pokemon | |
trigger: | |
type: http | |
httpRequest: | |
url: ${env:HTTP_HOST}/pokemon/import | |
method: POST | |
headers: | |
- key: Content-Type | |
value: application/json | |
body: '{"id": ${env:IMPORTED_POKEMON_ID}}' | |
specs: | |
- selector: span[tracetest.span.type="http" name="HTTP GET pokeapi.pokemon" http.method="GET"] | |
assertions: | |
- attr:http.url contains env:POKESHOP_API | |
- attr:http.route = "/pokemon/${env:IMPORTED_POKEMON_ID}" | |
- attr:tracetest.span.duration < 1s | |
- attr:http.response.body | json_path '$.name' = env:IMPORTED_POKEMON_NAME | |
- selector: span[tracetest.span.type="database" name="create pokeshop.pokemon" db.system="postgres" | |
db.name="pokeshop" db.user="ashketchum" db.operation="create" db.sql.table="pokemon"] | |
assertions: | |
- attr:db.result | json_path '$.name' = env:IMPORTED_POKEMON_NAME | |
- selector: span[tracetest.span.type="database" name="pg.query:INSERT" db.system="postgresql" | |
db.name="pokeshop" db.user="ashketchum"] | |
assertions: | |
- attr:tracetest.selected_spans.count = 1 | |
outputs: | |
- name: POKEMON_DB_ID | |
selector: span[tracetest.span.type="database" name="create pokeshop.pokemon" db.system="postgres" | |
db.name="pokeshop" db.user="ashketchum" db.operation="create" db.sql.table="pokemon"] | |
value: attr:db.result | json_path '$.id' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment