Class: Datadog::CI::ITR::Coverage::Event
- Inherits:
-
Object
- Object
- Datadog::CI::ITR::Coverage::Event
- Defined in:
- lib/datadog/ci/itr/coverage/event.rb
Instance Attribute Summary collapse
-
#coverage ⇒ Object
readonly
Returns the value of attribute coverage.
-
#test_id ⇒ Object
readonly
Returns the value of attribute test_id.
-
#test_session_id ⇒ Object
readonly
Returns the value of attribute test_session_id.
-
#test_suite_id ⇒ Object
readonly
Returns the value of attribute test_suite_id.
Instance Method Summary collapse
-
#initialize(test_id:, test_suite_id:, test_session_id:, coverage:) ⇒ Event
constructor
A new instance of Event.
- #to_msgpack(packer = nil) ⇒ Object
- #to_s ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(test_id:, test_suite_id:, test_session_id:, coverage:) ⇒ Event
Returns a new instance of Event.
12 13 14 15 16 17 |
# File 'lib/datadog/ci/itr/coverage/event.rb', line 12 def initialize(test_id:, test_suite_id:, test_session_id:, coverage:) @test_id = test_id @test_suite_id = test_suite_id @test_session_id = test_session_id @coverage = coverage end |
Instance Attribute Details
#coverage ⇒ Object (readonly)
Returns the value of attribute coverage.
10 11 12 |
# File 'lib/datadog/ci/itr/coverage/event.rb', line 10 def coverage @coverage end |
#test_id ⇒ Object (readonly)
Returns the value of attribute test_id.
10 11 12 |
# File 'lib/datadog/ci/itr/coverage/event.rb', line 10 def test_id @test_id end |
#test_session_id ⇒ Object (readonly)
Returns the value of attribute test_session_id.
10 11 12 |
# File 'lib/datadog/ci/itr/coverage/event.rb', line 10 def test_session_id @test_session_id end |
#test_suite_id ⇒ Object (readonly)
Returns the value of attribute test_suite_id.
10 11 12 |
# File 'lib/datadog/ci/itr/coverage/event.rb', line 10 def test_suite_id @test_suite_id end |
Instance Method Details
#to_msgpack(packer = nil) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/datadog/ci/itr/coverage/event.rb', line 32 def to_msgpack(packer = nil) packer ||= MessagePack::Packer.new packer.write_map_header(4) packer.write("test_session_id") packer.write(test_session_id.to_i) packer.write("test_suite_id") packer.write(test_suite_id.to_i) packer.write("span_id") packer.write(test_id.to_i) files = coverage.keys packer.write("files") packer.write_array_header(files.size) files.each do |filename| packer.write_map_header(1) packer.write("filename") packer.write(filename) end end |
#to_s ⇒ Object
57 58 59 |
# File 'lib/datadog/ci/itr/coverage/event.rb', line 57 def to_s "Coverage::Event[test_id=#{test_id}, test_suite_id=#{test_suite_id}, test_session_id=#{test_session_id}, coverage=#{coverage}]" end |
#valid? ⇒ Boolean
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/datadog/ci/itr/coverage/event.rb', line 19 def valid? valid = true [:test_id, :test_suite_id, :test_session_id, :coverage].each do |key| next unless send(key).nil? Datadog.logger.warn("citestcov event is invalid: [#{key}] is nil. Event: #{self}") valid = false end valid end |