The tests are built on top of the Beats Test Framework, where you can find a detailed description on how to run the test suite.
Run the full test suite of APM Server, which needs all dependencies to run locally or in a Docker environment:
make testsuite
Only run unit tests without external dependencies:
make unit
For insights about test-coverage, run make coverage-report
. The test coverage is reported in the folder ./build/coverage/
Some tests make use of the concept of snapshot or approvals testing. If running tests leads to changed snapshots, you can use the approvals
tool to update the snapshots.
Following workflow is intended:
- Run
make update
to create theapprovals
binary that supports reviewing changes. - Run
make unit
to create a*.received.json
file for every newly created or changed snapshot. - Run
./approvals
to review and interactively accept the changes.
For manual testing with the elastic stack there is a test environment based on docker. To get this running execute the following commands.
- Run
STACK_VERSION=6.1.2 make start-env
to start docker containers for the elastic stack. Set the version you want to test with via the environment variableSTACK_VERSION
. - Run
make import-dashboards
to import the Elasticsearch template and the Kibana dashboards - Check instructions at the
Elastic APM agents docs
to setup an agent of your choice and create test data.
Alternatively you can send a
curl
request to the transaction or the error endpoint - Open
localhost:5601
in your browser - In Kibana go to the Dashboards to see APM Data
- In Kibana go to the Discovery tab to query for APM Data
To run simple benchmark tests, run:
make bench
A good way to present your results is by using benchcmp
.
With your changes in the current working tree, do:
$ go get -u golang.org/x/tools/cmd/benchcmp
$ make bench > new.txt
$ git checkout master
$ make bench > old.txt
$ benchcmp old.txt new.txt