Example plan

sqlite.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.

An HTTP 201 is followed by a read-only SQL check that the order was persisted for the right tenant. In Terminal 1, start bin/vero-testserver --sqlite examples/orders.db in the foreground; then run bin/vero run examples/sqlite.yaml in Terminal 2. The plan reads the same file relative to itself; no SQLite server or CLI is needed.

apiVersion: vero.plan/v1
kind: Plan
metadata: { name: order-is-persisted-sqlite }
env:
  baseUrl: http://127.0.0.1:18080
  tenantId: tenant-42
lifecycle:
  strategy: unique
connections:
  orders: { driver: sqlite, dsn: orders.db }
resources:
  - name: db/orders
tasks:
  - name: login
    steps:
      - http: { method: POST, url: "{{ env.baseUrl }}/auth/token", json: { key: "sqlite-{{ run.id }}" } }
        assert: [status == 200]
        results: { token: body.token }
  - name: create-order
    steps:
      - http:
          method: POST
          url: "{{ env.baseUrl }}/orders"
          headers: { Authorization: "Bearer {{ tasks.login.results.token }}", X-Tenant-Id: "{{ env.tenantId }}" }
          json: { sku: ABC-1, qty: 2 }
        assert: [status == 201]
        results: { orderId: body.order.id }
  - name: order-is-persisted
    needs: [create-order]
    holds: [db/orders]
    steps:
      - sql:
          connection: orders
          query: |
            select status, total_cents, tenant_id
            from orders where id = $1
          args: ["{{ tasks.create-order.results.orderId }}"]
        assert:
          - rows count 1
          - rows[0].status == "pending"
          - rows[0].total_cents == 2000
          - rows[0].tenant_id == env.tenantId

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

verodocs