-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgrpc.yml
More file actions
81 lines (76 loc) · 1.75 KB
/
grpc.yml
File metadata and controls
81 lines (76 loc) · 1.75 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: gRPC API Examples
description: Examples for using the grpc action with gRPC Server
vars:
addr: "{{GRPC_ADDR ?? 'localhost:50051'}}"
service: "{{GRPC_SERVICE ?? 'UserService'}}"
jobs:
- name: "gRPC requests to {{vars.addr}}"
defaults:
grpc:
addr: "{{vars.addr}}"
service: "{{vars.service}}"
tls: false
timeout: 30s
metadata:
user-agent: probe-grpc/1.0
steps:
- name: Get User
id: get_user
uses: grpc
with:
method: GetUser
body:
user_id: "123"
test: |
res.status_code == "OK"
echo: |
User ID: {{res.body.user.id}}
outputs:
user_id: res.body.user.id
user_name: res.body.user.name
- name: Create User
uses: grpc
with:
method: CreateUser
body:
user:
name: Liny Ows
email: linyows@example.com
profile:
age: 30
location: Fukuoka
preferences:
- email_notifications
- sms_notifications
metadata:
authorization: Bearer token123
test: |
res.status_code == "OK" &&
res.body.user.name == "Liny Ows"
- name: Update User
uses: grpc
with:
method: UpdateUser
body:
user_id: "{{outputs.get_user.user_id}}"
updates:
email: linyows@example.org
test: |
res.status_code == "OK"
- name: List Users with TLS
uses: grpc
with:
addr: localhost:50052
method: ListUsers
tls: true
insecure: true # Allow self-signed certificate for testing
body:
page_size: 10
filter:
active: "true"
metadata:
authorization: Bearer secure-token
test: |
res.status_code == "OK"
echo: |
Res: {{res.body}}