Internal Release 0.3.0
Add configurable exception reporter Avoid leaking tool exceptions by sending them to a configurable exception reporter Add optional context to pass to tools Add basic instrumentation data/labels
This commit is contained in:
parent
f5a3567494
commit
0645351585
1 changed files with 359 additions and 39 deletions
24
test/instrumentation_test_helper.rb
Normal file
24
test/instrumentation_test_helper.rb
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module InstrumentationTestHelper
|
||||
class Instrumentation
|
||||
attr_reader :callback
|
||||
attr_reader :data
|
||||
|
||||
def initialize
|
||||
@callback = ->(data) { @data = data }
|
||||
end
|
||||
end
|
||||
|
||||
def instrumentation_helper
|
||||
@instrumentation_helper ||= Instrumentation.new
|
||||
end
|
||||
|
||||
def assert_instrumentation_data(expected_data)
|
||||
data = instrumentation_helper.data.dup
|
||||
duration = data.delete(:duration)
|
||||
assert_not_nil(duration, "Duration is not set")
|
||||
assert_operator(duration, :>=, 0, "Duration is not positive or zero")
|
||||
assert_equal(expected_data, data, "Instrumentation data does not match expected data")
|
||||
end
|
||||
end
|
||||
Loading…
Reference in a new issue