Class: Datadog::CI::TestManagement::TestsProperties
- Inherits:
-
Object
- Object
- Datadog::CI::TestManagement::TestsProperties
- Defined in:
- lib/datadog/ci/test_management/tests_properties.rb
Overview
fetches and stores a map of tests to their test management properties from the backend
Defined Under Namespace
Classes: Response
Instance Method Summary collapse
- #fetch(test_session) ⇒ Object
-
#initialize(api: nil) ⇒ TestsProperties
constructor
A new instance of TestsProperties.
Constructor Details
#initialize(api: nil) ⇒ TestsProperties
Returns a new instance of TestsProperties.
72 73 74 |
# File 'lib/datadog/ci/test_management/tests_properties.rb', line 72 def initialize(api: nil) @api = api end |
Instance Method Details
#fetch(test_session) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/datadog/ci/test_management/tests_properties.rb', line 76 def fetch(test_session) api = @api return {} unless api request_payload = payload(test_session) Datadog.logger.debug("Fetching test management tests with request: #{request_payload}") http_response = api.api_request( path: Ext::Transport::DD_API_TEST_MANAGEMENT_TESTS_PATH, payload: request_payload ) CI::Transport::Telemetry.api_requests( Ext::Telemetry::METRIC_TEST_MANAGEMENT_TESTS_REQUEST, 1, compressed: http_response.request_compressed ) Utils::Telemetry.distribution(Ext::Telemetry::METRIC_TEST_MANAGEMENT_TESTS_REQUEST_MS, http_response.duration_ms) Utils::Telemetry.distribution( Ext::Telemetry::METRIC_TEST_MANAGEMENT_TESTS_RESPONSE_BYTES, http_response.response_size.to_f, {Ext::Telemetry::TAG_RESPONSE_COMPRESSED => http_response.gzipped_content?.to_s} ) unless http_response.ok? CI::Transport::Telemetry.api_requests_errors( Ext::Telemetry::METRIC_TEST_MANAGEMENT_TESTS_REQUEST_ERRORS, 1, error_type: http_response.telemetry_error_type, status_code: http_response.code ) end Response.new(http_response).tests end |