-
Notifications
You must be signed in to change notification settings - Fork 67
/
01_create_grpc_test.yml
52 lines (52 loc) 路 2.41 KB
/
01_create_grpc_test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
type: Test
spec:
id: ojzHeDQ4gF
name: Create gRPC Test
description: Test step of 'gRPC Test Feature - Test Suite'
trigger:
type: http
httpRequest:
url: ${env:TARGET_URL}/api/tests
method: POST
headers:
- key: Content-Type
value: application/json
body: |
{
"name": "gRPC pokemon list",
"serviceUnderTest": {
"triggerType": "grpc",
"grpc": {
"protobufFile": "syntax = \"proto3\";\n\noption java_multiple_files = true;\noption java_outer_classname = \"PokeshopProto\";\noption objc_class_prefix = \"PKS\";\n\npackage pokeshop;\n\nservice Pokeshop {\n rpc getPokemonList (GetPokemonRequest) returns (GetPokemonListResponse) {}\n rpc createPokemon (Pokemon) returns (Pokemon) {}\n rpc importPokemon (ImportPokemonRequest) returns (ImportPokemonRequest) {}\n}\n\nmessage ImportPokemonRequest {\n int32 id = 1;\n optional bool isFixed = 2;\n}\n\nmessage GetPokemonRequest {\n optional int32 skip = 1;\n optional int32 take = 2;\n optional bool isFixed = 3;\n}\n\nmessage GetPokemonListResponse {\n repeated Pokemon items = 1;\n int32 totalCount = 2;\n}\n\nmessage Pokemon {\n optional int32 id = 1;\n string name = 2;\n string type = 3;\n bool isFeatured = 4;\n optional string imageUrl = 5;\n}",
"address": "${env:DEMO_APP_GRPC_URL}",
"method": "pokeshop.Pokeshop.importPokemon",
"request": "{\"id\": 52}"
}
},
"specs": [
{
"selectorParsed": {
"query": "span[name = \"queue.synchronizePokemon publish\"]"
},
"assertions": ["attr:tracetest.selected_spans.count > 0"]
}
]
}
specs:
- selector: span[name = "Tracetest trigger"]
assertions:
- attr:tracetest.selected_spans.count = 1
- attr:tracetest.response.status = 200
- selector: span[name="POST /api/tests" tracetest.span.type="http"]
assertions:
- attr:tracetest.selected_spans.count = 1
- selector: span[name = "exec INSERT"]
assertions:
- attr:tracetest.selected_spans.count = 1
- selector: span[name = "exec INSERT"]:first
assertions:
- attr:sql.query contains "INSERT INTO tests"
outputs:
- name: GRPC_TEST_ID
selector: span[name = "Tracetest trigger"]
value: attr:tracetest.response.body | json_path '$.id'