Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce approvaltest module #4112

Merged
merged 3 commits into from
Aug 31, 2020
Merged

Introduce approvaltest module #4112

merged 3 commits into from
Aug 31, 2020

Commits on Aug 29, 2020

  1. Introduce new approvaltest module

    We move tests/approvals and tests/scripts/approvals.go intoa new module,
    github.com/elastic/apm-server/approvaltest. This new module will be used
    by both apm-server (integration tests) and the systemtest module.
    
    We also reduce the API surface area to two functions: ApproveJSON, and
    ApproveEventDocs. The ApproveJSON function can be used for approving
    arbitrary JSON-encoded values, while ApproveEventDocs is specifically
    intended for approving JSON-encoded Elasticsearch event documents.
    
    To enable the API reduction, we introduce beatertest.EncodeEventDoc(s),
    which encode events using the libbeat Elasticsearch output. In some
    tests we previously used the libbeat JSON codec directly, which led to
    @metadata being included in diffs. The output removes @metadata, hence
    it no longer features in our approval diffs.
    axw committed Aug 29, 2020
    Configuration menu
    Copy the full SHA
    f19ae66 View commit details
    Browse the repository at this point in the history
  2. Update approved files

    - Since we now use the Elasticsearch output, rather than directly
      using the libbeat JSON codec, `@metadata` is no longer part of the
      diff, and `@timestamp` is encoded slightly differently.
    
    - For dynamic fields like `profile.id`, we now replace the value
      with a known string ("dynamic") rather than ignoring the field.
    axw committed Aug 29, 2020
    Configuration menu
    Copy the full SHA
    17afbea View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4e80b8a View commit details
    Browse the repository at this point in the history