BuildkiteTestCollector.Payload (buildkite_test_collector v0.3.1)

A structure that represents all data about a test suite run needed for analytics.

Summary

Functions

Convert the payload into a map ready for serialisation to JSON.

Initialise an empty payload with the given CI environment.

Push a test pesult into the payload.

Set the start time of the suite.

Types

serialised_environment()

@type serialised_environment() :: %{
  :CI => String.t(),
  :key => String.t(),
  optional(:number) => String.t(),
  optional(:job_id) => String.t(),
  optional(:branch) => String.t(),
  optional(:commit_sha) => String.t(),
  optional(:message) => String.t(),
  optional(:url) => String.t(),
  collector: String.t(),
  version: String.t()
}

t()

@type t() :: %BuildkiteTestCollector.Payload{
  data: [BuildkiteTestCollector.TestResult.t()],
  data_size: non_neg_integer(),
  run_env: serialised_environment(),
  started_at: nil | BuildkiteTestCollector.Instant.t()
}

Functions

as_json(payload)

@spec as_json(t()) :: map()

Convert the payload into a map ready for serialisation to JSON.

This is done as a separate step because all timings are relative to the payload start time, so must be calculated.

init(ci_env_mod)

@spec init(BuildkiteTestCollector.CiEnv.t()) :: t()

Initialise an empty payload with the given CI environment.

push_test_result(payload, test_result)

@spec push_test_result(t(), BuildkiteTestCollector.TestResult.t()) :: t()

Push a test pesult into the payload.

set_start_time(payload, started_at)

@spec set_start_time(t(), BuildkiteTestCollector.Instant.t()) :: t()

Set the start time of the suite.