Skip to content

Commit

Permalink
[jruby] removing flaky tests for JRuby test suite; the span duration …
Browse files Browse the repository at this point in the history
…is properly checked in the span_test.rb
  • Loading branch information
Emanuele Palazzetti committed Nov 9, 2016
1 parent 0630c31 commit a75ac88
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 21 deletions.
3 changes: 0 additions & 3 deletions test/contrib/rails/cache_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class CacheTracingTest < ActionController::TestCase
assert_equal(span.service, 'rails-cache')
assert_equal(span.get_tag('rails.cache.backend').to_s, '[:file_store, "/tmp/ddtrace-rb/cache/"]')
assert_equal(span.get_tag('rails.cache.key'), 'custom-key')
assert span.to_hash[:duration] > 0
end

test 'cache.write() is properly traced' do
Expand All @@ -42,7 +41,6 @@ class CacheTracingTest < ActionController::TestCase
assert_equal(span.service, 'rails-cache')
assert_equal(span.get_tag('rails.cache.backend').to_s, '[:file_store, "/tmp/ddtrace-rb/cache/"]')
assert_equal(span.get_tag('rails.cache.key'), 'custom-key')
assert span.to_hash[:duration] > 0
end

test 'cache.delete() is properly traced' do
Expand All @@ -57,7 +55,6 @@ class CacheTracingTest < ActionController::TestCase
assert_equal(span.service, 'rails-cache')
assert_equal(span.get_tag('rails.cache.backend').to_s, '[:file_store, "/tmp/ddtrace-rb/cache/"]')
assert_equal(span.get_tag('rails.cache.key'), 'custom-key')
assert span.to_hash[:duration] > 0
end

test 'doing a cache call uses the proper service name if it is changed' do
Expand Down
11 changes: 0 additions & 11 deletions test/contrib/rails/controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class TracingControllerTest < ActionController::TestCase
assert_equal(span.get_tag('http.status_code'), '200')
assert_equal(span.get_tag('rails.route.action'), 'index')
assert_equal(span.get_tag('rails.route.controller'), 'TracingController')
assert span.to_hash[:duration] > 0
end

test 'template rendering is properly traced' do
Expand All @@ -44,7 +43,6 @@ class TracingControllerTest < ActionController::TestCase
assert_equal(span.resource, 'rails.render_template')
assert_equal(span.get_tag('rails.template_name'), 'tracing/index.html.erb')
assert_equal(span.get_tag('rails.layout'), 'layouts/application')
assert span.to_hash[:duration] > 0
end

test 'template partial rendering is properly traced' do
Expand All @@ -61,9 +59,6 @@ class TracingControllerTest < ActionController::TestCase
assert_equal(span_partial.resource, 'rails.render_partial')
assert_equal(span_partial.get_tag('rails.template_name'), 'tracing/_body.html.erb')
assert_equal(span_partial.parent, span_template)

assert span_template.to_hash[:duration] > 0
assert span_partial.to_hash[:duration] > 0
end

test 'a full request with database access on the template' do
Expand All @@ -89,12 +84,6 @@ class TracingControllerTest < ActionController::TestCase
assert_equal(span_template.parent, span_request)
assert_equal(span_database.parent, span_template)
assert_equal(span_cache.parent, span_request)

# assert they're finished
assert span_request.to_hash[:duration] > 0
assert span_template.to_hash[:duration] > 0
assert span_database.to_hash[:duration] > 0
assert span_cache.to_hash[:duration] > 0
end

test 'multiple calls should not leave an unfinished span in the local thread buffer' do
Expand Down
1 change: 0 additions & 1 deletion test/contrib/rails/database_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class DatabaseTracingTest < ActiveSupport::TestCase
assert_includes(span.resource, 'SELECT COUNT(*) FROM')
# ensure that the sql.query tag is not set
assert_equal(span.get_tag('sql.query'), nil)
assert span.to_hash[:duration] > 0
end

test 'doing a database call uses the proper service name if it is changed' do
Expand Down
6 changes: 0 additions & 6 deletions test/contrib/rails/errors_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class TracingControllerTest < ActionController::TestCase
assert_equal(span.get_tag('rails.route.controller'), 'TracingController')
assert_equal(span.get_tag('error.type'), 'ZeroDivisionError')
assert_equal(span.get_tag('error.msg'), 'divided by 0')
assert span.to_hash[:duration] > 0
end

test 'error in the template must be traced' do
Expand All @@ -51,7 +50,6 @@ class TracingControllerTest < ActionController::TestCase
assert_equal(span_template.get_tag('rails.layout'), 'layouts/application')
assert_equal(span_template.get_tag('error.type'), 'ActionView::Template::Error')
assert_equal(span_template.get_tag('error.msg'), 'divided by 0')
assert span_template.to_hash[:duration] > 0

span_request = spans[1]
assert_equal(span_request.name, 'rails.request')
Expand All @@ -65,7 +63,6 @@ class TracingControllerTest < ActionController::TestCase
assert_equal(span_request.get_tag('rails.route.controller'), 'TracingController')
assert_equal(span_request.get_tag('error.type'), 'ActionView::Template::Error')
assert_equal(span_request.get_tag('error.msg'), 'divided by 0')
assert span_request.to_hash[:duration] > 0
end

test 'error in the template partials must be traced' do
Expand All @@ -83,7 +80,6 @@ class TracingControllerTest < ActionController::TestCase
assert_equal(span_partial.get_tag('rails.template_name'), 'tracing/_inner_error.html.erb')
assert_equal(span_partial.get_tag('error.type'), 'ActionView::Template::Error')
assert_equal(span_partial.get_tag('error.msg'), 'divided by 0')
assert span_partial.to_hash[:duration] > 0

span_template = spans[1]
assert_equal(span_template.name, 'rails.render_template')
Expand All @@ -94,7 +90,6 @@ class TracingControllerTest < ActionController::TestCase
assert_equal(span_template.get_tag('rails.layout'), 'layouts/application')
assert_equal(span_template.get_tag('error.type'), 'ActionView::Template::Error')
assert_equal(span_template.get_tag('error.msg'), 'divided by 0')
assert span_template.to_hash[:duration] > 0

span_request = spans[2]
assert_equal(span_request.name, 'rails.request')
Expand All @@ -108,6 +103,5 @@ class TracingControllerTest < ActionController::TestCase
assert_equal(span_request.get_tag('rails.route.controller'), 'TracingController')
assert_equal(span_request.get_tag('error.type'), 'ActionView::Template::Error')
assert_equal(span_request.get_tag('error.msg'), 'divided by 0')
assert span_request.to_hash[:duration] > 0
end
end
1 change: 1 addition & 0 deletions test/span_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def test_span_finish
# the end_time must be set
sleep(0.001)
assert span.end_time < Time.now.utc
assert span.to_hash[:duration] > 0
end

def test_span_ids
Expand Down

0 comments on commit a75ac88

Please sign in to comment.