Skip to content

Commit

Permalink
RUBY-721 tests passing for 1.8.6
Browse files Browse the repository at this point in the history
  • Loading branch information
gnarg committed Nov 11, 2011
1 parent 1fd2a85 commit 5a6bd93
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 19 deletions.
2 changes: 1 addition & 1 deletion lib/new_relic/agent/agent.rb
Expand Up @@ -1048,7 +1048,7 @@ def harvest_and_send_slowest_sql
# FIXME add the code to try to resend if our connection is down
sql_traces = @sql_sampler.harvest
unless sql_traces.empty?
log.debug "Sending (#{sql_traces.count}) sql traces"
log.debug "Sending (#{sql_traces.size}) sql traces"
begin
response = invoke_remote :sql_trace_data, sql_traces
# log.debug "Sql trace response: #{response}"
Expand Down
4 changes: 2 additions & 2 deletions lib/new_relic/agent/sql_sampler.rb
Expand Up @@ -95,9 +95,9 @@ def notice_scope_empty(time=Time.now)
data = transaction_data
clear_transaction_data

if data.sql_data.count > 0
if data.sql_data.size > 0
@samples_lock.synchronize do
NewRelic::Agent.instance.log.debug "Harvesting #{data.sql_data.count} slow transaction sql statement(s)"
NewRelic::Agent.instance.log.debug "Harvesting #{data.sql_data.size} slow transaction sql statement(s)"
#FIXME get tx name and uri
harvest_slow_sql data
end
Expand Down
3 changes: 2 additions & 1 deletion lib/new_relic/data_serialization.rb
Expand Up @@ -14,7 +14,8 @@ module ClassMethods
# (handled elsewhere)
def should_send_data?
NewRelic::Control.instance.disable_serialization? || store_too_large? ||
store_too_old? || pid_too_old?
store_too_old? || pid_too_old? ||
NewRelic::LanguageSupport.using_version?('1.8.6')
rescue Exception => e
NewRelic::Control.instance.disable_serialization = true
NewRelic::Control.instance.log.warn("Disabling serialization: #{e.message}")
Expand Down
13 changes: 4 additions & 9 deletions test/new_relic/agent/instrumentation/queue_time_test.rb
Expand Up @@ -270,20 +270,15 @@ def test_record_rollup_queue_stat_no_data
check_metric_time('WebFrontend/QueueTime', 0.0, 0.001)
end


# check all the combinations to make sure that ordering doesn't
# affect the return value
def test_find_oldest_time
test_arrays = [
test_array = [
['c', Time.at(1002)],
['a', Time.at(1000)],
['b', Time.at(1001)],
['c', Time.at(1002)],
['d', Time.at(1000)],
]
test_arrays = test_arrays.permutation
test_arrays.each do |test_array|
assert_equal find_oldest_time(test_array), Time.at(1000), "Should be the oldest time in the array"
end
assert_equal(find_oldest_time(test_array), Time.at(1000),
"Should be the oldest time in the array")
end

# trivial test but the method doesn't do much
Expand Down
Expand Up @@ -104,7 +104,7 @@ def test_check_for_illegal_keys_positive
end

def test_check_for_illegal_keys_negative
test_keys = Hash[ALLOWED_KEYS.map {|x| [x, nil]}]
test_keys = Hash[*ALLOWED_KEYS.map {|x| [x, nil]}.flatten]
check_for_illegal_keys!(test_keys)
end

Expand Down
2 changes: 1 addition & 1 deletion test/new_relic/agent/rpm_agent_test.rb
Expand Up @@ -82,7 +82,7 @@ class NewRelic::Agent::RpmAgentTest < Test::Unit::TestCase # ActiveSupport::Test

should "send_timeslice_data" do
# this test fails due to a rubinius bug
return if (RUBY_DESCRIPTION =~ /rubinius/i)
return if NewRelic::LanguageSupport.using_engine?('rbx')
@agent.expects(:invoke_remote).returns({NewRelic::MetricSpec.new("/A/b/c") => 1, NewRelic::MetricSpec.new("/A/b/c", "/X") => 2, NewRelic::MetricSpec.new("/A/b/d") => 3 }.to_a)
@agent.send :harvest_and_send_timeslice_data
assert_equal 3, @agent.metric_ids.size
Expand Down
8 changes: 4 additions & 4 deletions test/new_relic/agent/sql_sampler_test.rb
Expand Up @@ -31,7 +31,7 @@ def test_notice_sql
# this sql will not be captured
@sampler.notice_sql "select * from test", "Database/test/select", nil, 0
assert_not_nil @sampler.transaction_data
assert_equal 2, @sampler.transaction_data.sql_data.count
assert_equal 2, @sampler.transaction_data.sql_data.size
end

def test_harvest_slow_sql
Expand All @@ -45,7 +45,7 @@ def test_harvest_slow_sql
]
@sampler.harvest_slow_sql data

assert_equal 2, @sampler.sql_traces.count
assert_equal 2, @sampler.sql_traces.size
end

def test_sql_aggregation
Expand Down Expand Up @@ -73,7 +73,7 @@ def test_harvest
@sampler.harvest_slow_sql data

sql_traces = @sampler.harvest
assert_equal 2, sql_traces.count
assert_equal 2, sql_traces.size
end

def test_harvest_should_not_take_more_than_10
Expand Down Expand Up @@ -104,7 +104,7 @@ def test_harvest_should_aggregate_similar_queries
@sampler.harvest_slow_sql data

sql_traces = @sampler.harvest
assert_equal 2, sql_traces.count
assert_equal 2, sql_traces.size
end

def test_harvest_should_collect_explain_plans
Expand Down
1 change: 1 addition & 0 deletions test/new_relic/data_serialization_test.rb
Expand Up @@ -151,6 +151,7 @@ def test_pid_age_creates_pid_file_if_none_exists
end

def test_loading_does_not_seg_fault_if_gc_triggers
return if NewRelic::LanguageSupport.using_version?('1.8.6')
require 'timeout'

Thread.abort_on_exception = true
Expand Down

0 comments on commit 5a6bd93

Please sign in to comment.