Integration tests
This document provides an outline of how to run and add new integration tests to the project.
The purpose of these tests is to verify simple, happy-path pipelines to catch issues between Alloy and external dependencies.
The external dependencies are launched as Docker containers.
Running tests
Execute the integration tests using the following command:
go run .
NOTE: The tests don't run on Windows. If you want to run the tests on Linux, you need to set the environment variable OTEL_EXPORTER_ENDPOINT=172.17.0.1:4318.
Flags
--skip-build
: Run the integration tests without building Alloy (default: false
)
--test
: Specifies a particular directory within the tests directory to run (default: runs all tests)
Adding new tests
Follow these steps to add a new integration test to the project:
- If the test requires external resources, define them as Docker images within the
docker-compose.yaml
file.
- Create a new directory under the tests directory to house the files for the new test.
- Within the new test directory, create a file named
config.alloy
to hold the pipeline configuration you want to test.
- Create a
_test.go
file within the new test directory. This file should contain the Go code necessary to run the test and verify the data processing through the pipeline.
NOTE: The tests run concurrently. Each Alloy instance must tag its data with a label that corresponds to its specific configuration. This ensures the correct data verification during the Go testing process.