Example plan

grpc.yaml

New here? Get started. See Running the examplesfor this plan's fixture, runtime, database or browser requirements. The exec example needs no fixture; Postgres and Playwright need their optional dependencies.

One unary gRPC call and one server stream against the Orders service that examples/grpc/*.proto describe. The protos are compiled when the plan loads; vero never asks a server for its schema. No shipped fixture serves gRPC: the repository test runs this plan against a server it starts itself, and the real-servers evidence page runs the step against grpcbin. To run it by hand, point it at a server of yours that implements vero.test.Orders:

$ VERO_GRPC_TARGET=127.0.0.1:50051 bin/vero run examples/grpc.yaml
apiVersion: vero.plan/v1
kind: Plan
metadata: { name: orders-grpc }
env:
  grpc: ${VERO_GRPC_TARGET:-127.0.0.1:50051}
lifecycle: { strategy: isolated }
tasks:
  - name: get-order
    steps:
      - grpc:
          target: "{{ env.grpc }}"
          plaintext: true
          method: vero.test.Orders/GetOrder
          protos: [grpc/orders.proto]
          importPaths: [grpc]
          message: { id: 7 }
        assert:
          - code == "OK"
          - body.id == 7
          - body.status == "pending"
          - body.items[0].sku == "ABC-1"
          - body.total.cents == 1010
          - body.qty == 0
          - headers["x-served-by"] == "fixture"
        results: { status: body.status }
  - name: watch-order
    steps:
      - grpc:
          target: "{{ env.grpc }}"
          plaintext: true
          method: vero.test.Orders/WatchOrder
          protos: [grpc/orders.proto]
          importPaths: [grpc]
          message: { id: 3 }
        assert:
          - messages count 3
          - messages[0].body.status == "pending"
          - messages[2].body.id == 3
          - messages[2].body.status == "shipped"
          - duration.first <= duration.total
          - code == "OK"
          - body == nil

This page is examples/grpc.yaml in the repository.

verodocs