Class: Datadog::CI::TestOptimisation::Skippable::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/ci/test_optimisation/skippable.rb

Instance Method Summary collapse

Constructor Details

#initialize(http_response) ⇒ Response

Returns a new instance of Response.



14
15
16
17
# File 'lib/datadog/ci/test_optimisation/skippable.rb', line 14

def initialize(http_response)
  @http_response = http_response
  @json = nil
end

Instance Method Details

#correlation_idObject



24
25
26
# File 'lib/datadog/ci/test_optimisation/skippable.rb', line 24

def correlation_id
  payload.dig("meta", "correlation_id")
end

#ok?Boolean

Returns:

  • (Boolean)


19
20
21
22
# File 'lib/datadog/ci/test_optimisation/skippable.rb', line 19

def ok?
  resp = @http_response
  !resp.nil? && resp.ok?
end

#testsObject



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/datadog/ci/test_optimisation/skippable.rb', line 28

def tests
  res = Set.new

  payload.fetch("data", [])
    .each do |test_data|
      next unless test_data["type"] == Ext::Test::ITR_TEST_SKIPPING_MODE

      attrs = test_data["attributes"] || {}
      res << Utils::TestRun.skippable_test_id(attrs["name"], attrs["suite"], attrs["parameters"])
    end

  res
end