Class: Datadog::CI::TestImpactAnalysis::Skippable
- Inherits:
-
Object
- Object
- Datadog::CI::TestImpactAnalysis::Skippable
- Defined in:
- lib/datadog/ci/test_impact_analysis/skippable.rb
Defined Under Namespace
Classes: Response
Instance Method Summary collapse
- #fetch_skippables(test_session) ⇒ Object
-
#initialize(dd_env:, api: nil, config_tags: {}, test_skipping_mode: Ext::Test::TIATestSkippingMode::TEST) ⇒ Skippable
constructor
A new instance of Skippable.
Constructor Details
#initialize(dd_env:, api: nil, config_tags: {}, test_skipping_mode: Ext::Test::TIATestSkippingMode::TEST) ⇒ Skippable
Returns a new instance of Skippable.
91 92 93 94 95 96 |
# File 'lib/datadog/ci/test_impact_analysis/skippable.rb', line 91 def initialize(dd_env:, api: nil, config_tags: {}, test_skipping_mode: Ext::Test::TIATestSkippingMode::TEST) @api = api @dd_env = dd_env @config_tags = @test_skipping_mode = test_skipping_mode end |
Instance Method Details
#fetch_skippables(test_session) ⇒ Object
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/datadog/ci/test_impact_analysis/skippable.rb', line 98 def fetch_skippables(test_session) api = @api return Response.from_http_response(nil) unless api request_payload = payload(test_session) Datadog.logger.debug("Fetching skippable #{@test_skipping_mode}s with request: #{request_payload}") http_response = api.api_request( path: Ext::Transport::DD_API_SKIPPABLE_TESTS_PATH, payload: request_payload ) Transport::Telemetry.api_requests( Ext::Telemetry::METRIC_ITR_SKIPPABLE_TESTS_REQUEST, 1, compressed: http_response.request_compressed ) Utils::Telemetry.distribution(Ext::Telemetry::METRIC_ITR_SKIPPABLE_TESTS_REQUEST_MS, http_response.duration_ms) Utils::Telemetry.distribution( Ext::Telemetry::METRIC_ITR_SKIPPABLE_TESTS_RESPONSE_BYTES, http_response.response_size.to_f, {Ext::Telemetry::TAG_RESPONSE_COMPRESSED => http_response.gzipped_content?.to_s} ) unless http_response.ok? Transport::Telemetry.api_requests_errors( Ext::Telemetry::METRIC_ITR_SKIPPABLE_TESTS_REQUEST_ERRORS, 1, error_type: http_response.telemetry_error_type, status_code: http_response.code ) # mark the test session so that all events emitted in this session are tagged # with the hidden _dd.ci.library_configuration_error.skippable_tests tag test_session.set_tag(Ext::Test::LibraryConfigurationError::TAG_SKIPPABLE_TESTS, "true") end Response.from_http_response(http_response) end |