Templates

Response time budget

Fail the run when endpoints respond slower than an agreed budget.

contractperformance

What it does

Adds a responseTime check with a maximum in milliseconds to every CRM operation, next to a basic success check. Known slow operations are excluded from the budget with excludeForOperations instead of loosening it for everyone.

portman-config.json
{  "version": 1,  "tests": {    "contractTests": [      {        "openApiOperation": "*::/crm/*",        "statusSuccess": {          "enabled": true        }      },      {        "openApiOperation": "*::/crm/*",        "excludeForOperations": [          "leadsAdd",          "GET::/crm/leads/{id}"        ],        "responseTime": {          "enabled": true,          "maxMs": 300        }      }    ]  }}

Run it

terminal
$ npx @apideck/portman -l ./openapi.yaml -c ./portman-config.json -b http://localhost:3050 -n true

Notes

  • Run against an environment that resembles production, or the budget will be noisy.
  • Add a second responseTime entry with a higher maxMs for the excluded operations if they need their own budget.