Skip to content

Latest commit

History

History
67 lines (42 loc) 路 2.11 KB

File metadata and controls

67 lines (42 loc) 路 2.11 KB

Integration Testing Vercel Functions with Tracetest and OpenTelemetry

This example is from the article [Integration Testing Vercel Serverless Functions](add link) showing how to run integration tests against Vercel Functions using OpenTelemetry and Tracetest.

This is a Next.js project bootstrapped with create-next-app.

It's using Vercel Functions via /pages/api, with OpenTelemetry configured as explained in the Vercel docs.

Prerequisites

Getting Started with Docker

  1. Set Tracetest Agent API Key in docker-compose.yaml, and set Tracetest Environment Token in test/run.bash. Set the Vercel Postgres credentials in the .env* files.

  2. Run Docker Compose

    docker compose up -d --build
  3. Run Integration Tests

    docker compose run integration-tests

(Optional. Trigger Tracetest Tests via app.tracetest.io against http://next-app:3000)

Getting Started Locally

  1. Set the Vercel Postgres credentials in the .env* files.

  2. Install Node Packages

    npm i
  3. Run Development Server

    npm run dev
  4. Start Tracetest Agent

    tracetest start --api-key ttagent_<apikey>
  5. Trigger Tracetest Tests via CLI

    tracetest run test -f ./test-api.development.yaml

(Optional. Trigger Tracetest Tests via app.tracetest.io against http://localhost:3000)

Learn more

Feel free to check out the docs, and join our Slack Community for more info!