Defining gRPC Tests as Text Files
When defining a gRPC trigger, you are required to define a protobufFile
object containing the request Tracetest will send to your system. You also define: address
, method
, and request
.
trigger:
type: grpc
grpc:
protobufFile: ./path/to/file.proto
address: payment.opentelemetry.demo
method: oteldemo.PaymentService.Charge
request: |-
{
"amount": {
"currencyCode": "USD",
"units": 43,
"nanos": 130000000
},
"creditCard": {
"creditCardNumber": "0000-0000-0000-0000",
"creditCardCvv": 672,
"creditCardExpirationYear": 2039,
"creditCardExpirationMonth": 1
}
}
Authentication​
Currently, we support the same authentication methods for gRPC requests as for HTTP requests.
Basic Authentication
trigger:
type: grpc
grpc:
protobufFile: ./path/to/file.proto
address: payment.opentelemetry.demo
method: oteldemo.PaymentService.Charge
auth:
type: basic
basic:
user: my-username
password: mypassword
request: |-
{
"amount": {
"currencyCode": "USD",
"units": 43,
"nanos": 130000000
},
"creditCard": {
"creditCardNumber": "0000-0000-0000-0000",
"creditCardCvv": 672,
"creditCardExpirationYear": 2039,
"creditCardExpirationMonth": 1
}
}
API Key Authentication
trigger:
type: grpc
grpc:
protobufFile: ./path/to/file.proto
address: payment.opentelemetry.demo
method: oteldemo.PaymentService.Charge
auth:
type: apiKey
apiKey:
key: X-Key
value: my-key
in: header # Either "header" or "query"
request: |-
{
"amount": {
"currencyCode": "USD",
"units": 43,
"nanos": 130000000
},
"creditCard": {
"creditCardNumber": "0000-0000-0000-0000",
"creditCardCvv": 672,
"creditCardExpirationYear": 2039,
"creditCardExpirationMonth": 1
}
}
Bearer Token Authentication
trigger:
type: grpc
grpc:
protobufFile: ./path/to/file.proto
address: payment.opentelemetry.demo
method: oteldemo.PaymentService.Charge
auth:
type: bearer
bearer:
token: my-token
request: |-
{
"amount": {
"currencyCode": "USD",
"units": 43,
"nanos": 130000000
},
"creditCard": {
"creditCardNumber": "0000-0000-0000-0000",
"creditCardCvv": 672,
"creditCardExpirationYear": 2039,
"creditCardExpirationMonth": 1
}
}