Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tracetesting): Adding Serverless Synthetic Tests (#3658)
* feat(tracetesting): Adding Serverless Synthetic Tests * feat(tracetesting): Validating new RC * feat(tracetesting): Validating new RC * feat(tracetesting): Updating definitions * feat(tracetesting): Updaing token
- Loading branch information
Showing
6 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
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
23 changes: 23 additions & 0 deletions
23
testing/synthetic-monitoring/pokeshop-serverless/01-add-pokemon-with-api.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
type: Test | ||
spec: | ||
id: pokeshop-serverless-demo-add-pokemon | ||
name: Serverless - Pokeshop - Add | ||
description: Add a Pokemon | ||
trigger: | ||
type: http | ||
httpRequest: | ||
method: POST | ||
url: ${var:POKESHOP_API_URL}/pokemon | ||
body: "{\n \"name\": \"meowth\",\n \"type\":\"normal\",\n \"imageUrl\":\"https://assets.pokemon.com/assets/cms2/img/pokedex/full/052.png\",\n \"isFeatured\": true\n}\n" | ||
headers: | ||
- key: Content-Type | ||
value: application/json | ||
specs: | ||
- selector: span[tracetest.span.type="http" name="POST /pokemon"] | ||
name: The POST /pokemon was called correctly | ||
assertions: | ||
- attr:tracetest.selected_spans.count = 1 | ||
- selector: span[tracetest.span.type="database" name="create pokeshop.pokemon" db.operation="create" db.sql.table="pokemon"] | ||
name: A Pokemon was inserted on database | ||
assertions: | ||
- attr:db.result | json_path '$.imageUrl' = "https://assets.pokemon.com/assets/cms2/img/pokedex/full/052.png" |
31 changes: 31 additions & 0 deletions
31
testing/synthetic-monitoring/pokeshop-serverless/02-import-pokemon-with-queue.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
type: Test | ||
spec: | ||
id: pokeshop-serverless-demo-import-pokemon-queue | ||
name: Serverless - Import a Pokemon using API and Worker | ||
description: Import a Pokemon | ||
trigger: | ||
type: http | ||
httpRequest: | ||
method: POST | ||
url: ${var:POKESHOP_API_URL}/pokemon/import | ||
body: "{\n \"id\": 6\n}\n" | ||
headers: | ||
- key: Content-Type | ||
value: application/json | ||
specs: | ||
- selector: span[tracetest.span.type="http" name="POST /pokemon/import"] | ||
name: POST /pokemon/import was called successfuly | ||
assertions: | ||
- attr:http.request.body contains "6" | ||
- selector: span[tracetest.span.type="messaging" name="queue.synchronizePokemon publish" messaging.system="sqs" messaging.destination="queue.synchronizePokemon" messaging.operation="publish"] | ||
name: A message was enqueued to the worker | ||
assertions: | ||
- attr:messaging.payload | json_path '$.id' = "6" | ||
- selector: span[tracetest.span.type="messaging" name="queue.synchronizePokemon process" messaging.system="sqs" messaging.destination="queue.synchronizePokemon" messaging.operation="process"] | ||
name: A message was read by the worker | ||
assertions: | ||
- attr:messaging.payload | json_path '$.attributes.MessageGroupId' = "queue.synchronizePokemon" | ||
- selector: span[tracetest.span.type="general" name="import pokemon"] | ||
name: A "import pokemon" action was triggered | ||
assertions: | ||
- attr:tracetest.selected_spans.count >= 1 |
25 changes: 25 additions & 0 deletions
25
testing/synthetic-monitoring/pokeshop-serverless/04-list-pokemons.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
type: Test | ||
spec: | ||
id: pokeshop-serverless-demo-list-pokemon | ||
name: Serverless - List Pokemons | ||
trigger: | ||
type: http | ||
httpRequest: | ||
method: GET | ||
url: ${var:POKESHOP_API_URL}/pokemon?take=100&skip=0 | ||
headers: | ||
- key: Content-Type | ||
value: application/json | ||
specs: | ||
- selector: span[tracetest.span.type="http" name="GET /pokemon"] | ||
name: GET /pokemon endpoint was called and returned valid data | ||
assertions: | ||
- attr:tracetest.selected_spans.count = 1 | ||
- selector: span[tracetest.span.type="database" name="count pokeshop.pokemon" db.system="postgres" db.name="pokeshop" db.user="ashketchum" db.operation="count" db.sql.table="pokemon"] | ||
name: A count operation was triggered on database | ||
assertions: | ||
- attr:db.operation = "count" | ||
- selector: span[tracetest.span.type="database" name="findMany pokeshop.pokemon" db.system="postgres" db.name="pokeshop" db.user="ashketchum" db.operation="findMany" db.sql.table="pokemon"] | ||
name: A select operation was triggered on database | ||
assertions: | ||
- attr:db.operation = "findMany" |
9 changes: 9 additions & 0 deletions
9
testing/synthetic-monitoring/pokeshop-serverless/_testsuite.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
type: Transaction | ||
spec: | ||
id: pokeshop-serverless-demo-test-suite | ||
name: "Serverless - Pokeshop Synthetic tests" | ||
description: Simulate a user doing a series of imports on Pokeshop and listing its results | ||
steps: | ||
- ./01-add-pokemon-with-api.yaml | ||
- ./02-import-pokemon-with-queue.yaml | ||
- ./04-list-pokemons.yaml |
7 changes: 7 additions & 0 deletions
7
testing/synthetic-monitoring/pokeshop-serverless/_variableset.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
type: VariableSet | ||
spec: | ||
id: tracetesting-vars-serverless | ||
name: tracetesting-vars-serverless | ||
values: | ||
- key: POKESHOP_API_URL | ||
value: https://75yj353nn7.execute-api.us-east-1.amazonaws.com |