Class: Datadog::CI::TestRetries::UniqueTestsClient::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/ci/test_retries/unique_tests_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(http_response) ⇒ Response

Returns a new instance of Response.



17
18
19
20
# File 'lib/datadog/ci/test_retries/unique_tests_client.rb', line 17

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

Instance Method Details

#ok?Boolean

Returns:

  • (Boolean)


22
23
24
25
# File 'lib/datadog/ci/test_retries/unique_tests_client.rb', line 22

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

#testsObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/datadog/ci/test_retries/unique_tests_client.rb', line 27

def tests
  res = Set.new

  payload
    .fetch("data", {})
    .fetch("attributes", {})
    .fetch("tests", {})
    .each do |_test_module, suites_hash|
      suites_hash.each do |test_suite, tests|
        tests.each do |test_name|
          res << Utils::TestRun.datadog_test_id(test_name, test_suite)
        end
      end
    end

  res
end