Class: Datadog::CI::TestTracing::KnownTests::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/ci/test_tracing/known_tests.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#http_responseObject (readonly)

Returns the value of attribute http_response.



19
20
21
# File 'lib/datadog/ci/test_tracing/known_tests.rb', line 19

def http_response
  @http_response
end

Class Method Details

.from_http_response(http_response) ⇒ Object



21
22
23
# File 'lib/datadog/ci/test_tracing/known_tests.rb', line 21

def self.from_http_response(http_response)
  new(http_response, nil)
end

.from_json(json) ⇒ Object



25
26
27
# File 'lib/datadog/ci/test_tracing/known_tests.rb', line 25

def self.from_json(json)
  new(nil, json)
end

Instance Method Details

#cursorObject



52
53
54
# File 'lib/datadog/ci/test_tracing/known_tests.rb', line 52

def cursor
  page_info.fetch("cursor", nil)
end

#has_next?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/datadog/ci/test_tracing/known_tests.rb', line 56

def has_next?
  page_info.fetch("has_next", false)
end

#ok?Boolean

Returns:

  • (Boolean)


29
30
31
32
# File 'lib/datadog/ci/test_tracing/known_tests.rb', line 29

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

#testsObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/datadog/ci/test_tracing/known_tests.rb', line 34

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