Коммит
ccb853d4e4
|
@ -77,10 +77,10 @@ module ApplicationInsights
|
|||
def format_request_duration(duration_seconds)
|
||||
if duration_seconds >= 86400
|
||||
# just return 1 day when it takes more than 1 day which should not happen for requests.
|
||||
return "%d.%02d:%02d:%02d.%07d" % [1, 0, 0, 0, 0]
|
||||
return "%02d.%02d:%02d:%02d.%07d" % [1, 0, 0, 0, 0]
|
||||
end
|
||||
|
||||
Time.at(duration_seconds).gmtime.strftime("0.%H:%M:%S.%7N")
|
||||
Time.at(duration_seconds).gmtime.strftime("00.%H:%M:%S.%7N")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -58,7 +58,7 @@ class TestExceptionDetails < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_has_full_stack_works_as_expected
|
||||
expected = TRUE
|
||||
expected = true
|
||||
item = Contracts::ExceptionDetails.new
|
||||
item.has_full_stack = expected
|
||||
actual = item.has_full_stack
|
||||
|
@ -93,7 +93,7 @@ class TestExceptionDetails < Test::Unit::TestCase
|
|||
item.outer_id = 42
|
||||
item.type_name = 'Test string'
|
||||
item.message = 'Test string'
|
||||
item.has_full_stack = TRUE
|
||||
item.has_full_stack = true
|
||||
item.stack = 'Test string'
|
||||
[ { 'key' => 'value' } ].each do |value|
|
||||
item.parsed_stack.push value
|
||||
|
|
|
@ -118,7 +118,7 @@ class TestRemoteDependencyData < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_success_works_as_expected
|
||||
expected = TRUE
|
||||
expected = true
|
||||
item = Contracts::RemoteDependencyData.new
|
||||
item.success = expected
|
||||
actual = item.success
|
||||
|
@ -130,7 +130,7 @@ class TestRemoteDependencyData < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_async_works_as_expected
|
||||
expected = TRUE
|
||||
expected = true
|
||||
item = Contracts::RemoteDependencyData.new
|
||||
item.async = expected
|
||||
actual = item.async
|
||||
|
@ -194,8 +194,8 @@ class TestRemoteDependencyData < Test::Unit::TestCase
|
|||
item.max = 1.5
|
||||
item.std_dev = 1.5
|
||||
item.dependency_kind = 5
|
||||
item.success = TRUE
|
||||
item.async = TRUE
|
||||
item.success = true
|
||||
item.async = true
|
||||
item.dependency_source = 5
|
||||
item.command_name = 'Test string'
|
||||
item.dependency_type_name = 'Test string'
|
||||
|
|
|
@ -82,7 +82,7 @@ class TestRequestData < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_success_works_as_expected
|
||||
expected = TRUE
|
||||
expected = true
|
||||
item = Contracts::RequestData.new
|
||||
item.success = expected
|
||||
actual = item.success
|
||||
|
@ -137,7 +137,7 @@ class TestRequestData < Test::Unit::TestCase
|
|||
item.start_time = 'Test string'
|
||||
item.duration = 'Test string'
|
||||
item.response_code = 'Test string'
|
||||
item.success = TRUE
|
||||
item.success = true
|
||||
item.http_method = 'Test string'
|
||||
item.url = 'Test string'
|
||||
{ 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
|
||||
|
|
|
@ -61,7 +61,7 @@ class TestSenderBase < Test::Unit::TestCase
|
|||
client = server.accept
|
||||
request = ''
|
||||
read_buffer_size = 64
|
||||
while TRUE
|
||||
while true
|
||||
temp = client.recv(read_buffer_size)
|
||||
request += temp
|
||||
break if temp.length < read_buffer_size
|
||||
|
|
|
@ -7,7 +7,7 @@ include ApplicationInsights::Rack
|
|||
|
||||
class TestTrackRequest < Test::Unit::TestCase
|
||||
|
||||
TIME_SPAN_FORMAT = /^(?<day>\d{1})\.(?<hour>\d{2}):(?<minute>\d{2}):(?<second>\d{2}).(?<fraction>\d{7})$/
|
||||
TIME_SPAN_FORMAT = /^(?<day>\d{2})\.(?<hour>\d{2}):(?<minute>\d{2}):(?<second>\d{2}).(?<fraction>\d{7})$/
|
||||
|
||||
def test_call_works_as_expected
|
||||
response_code = rand(200..204)
|
||||
|
@ -34,7 +34,7 @@ class TestTrackRequest < Test::Unit::TestCase
|
|||
assert_equal true, request_data.success
|
||||
assert_equal http_method, request_data.http_method
|
||||
assert_equal url, request_data.url
|
||||
assert_equal true, request_data.duration.start_with?("0.00:00:02")
|
||||
assert_equal true, request_data.duration.start_with?("00.00:00:02")
|
||||
assert Time.parse(request_data.start_time) - start_time < 0.01
|
||||
end
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче