Skip to content

Latest commit

 

History

History
65 lines (49 loc) · 2.41 KB

TESTING.md

File metadata and controls

65 lines (49 loc) · 2.41 KB

APM Server-Testing

Automated Testing

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.

Quick Overview

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

Coverage Report

For insights about test-coverage, run make coverage-report. The test coverage is reported in the folder ./build/coverage/

Snapshot-Testing

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 the approvals 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.

Manual Testing

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 variable STACK_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

Benchmarking

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