# Integration Test

This folder contains a setup for integration test with o11y node sdk.

## Workflow

- Docker must be in running state
- Run the sh script `sh ./packages/sdk-node/test/integration/run.sh 1 .` from project root with following params
  1. pipeline build number, for local development, any number or string is fine
  2. root folder for docker context
- Change dir to `packages/sdk-node/`
- Run full test suite with `pnpm test`

## Script

The `run.sh` script performs the following steps:

- build a docker image of a fastify app `/examples/fastify`
- setup an temporary test docker network
- run grafana alloy inside a docker container with a test configuration `/alloy/integration-test.alloy`
- ensure is running otherwise exit process
- run fastify app in a docker container
- ensure is running otherwise exit process
- execute some curl to the fastify microservice
- persist alloy log to a file and save to following path `/packages/sdk-node/test/integration/`
- docker turn down process (containers/network/image)
