newrelic_rpm 3.6.6.147 → 3.6.7.152
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/.gitignore +0 -1
- data/CHANGELOG +55 -17
- data/Guardfile +7 -0
- data/Rakefile +6 -0
- data/bin/mongrel_rpm +33 -0
- data/bin/newrelic +13 -0
- data/bin/newrelic_cmd +5 -0
- data/bin/nrdebug +273 -0
- data/install.rb +3 -3
- data/lib/new_relic/agent.rb +4 -6
- data/lib/new_relic/agent/agent.rb +76 -72
- data/lib/new_relic/agent/autostart.rb +18 -5
- data/lib/new_relic/agent/browser_monitoring.rb +41 -35
- data/lib/new_relic/agent/browser_token.rb +38 -0
- data/lib/new_relic/agent/busy_calculator.rb +7 -5
- data/lib/new_relic/agent/commands/agent_command.rb +19 -0
- data/lib/new_relic/agent/commands/agent_command_router.rb +88 -0
- data/lib/new_relic/agent/commands/thread_profiler.rb +80 -0
- data/lib/new_relic/agent/configuration/default_source.rb +700 -0
- data/lib/new_relic/agent/configuration/environment_source.rb +83 -30
- data/lib/new_relic/agent/configuration/manager.rb +8 -8
- data/lib/new_relic/agent/configuration/mask_defaults.rb +2 -2
- data/lib/new_relic/agent/cross_app_monitor.rb +10 -21
- data/lib/new_relic/agent/cross_app_tracing.rb +3 -3
- data/lib/new_relic/agent/error_collector.rb +7 -10
- data/lib/new_relic/agent/http_clients/curb_wrappers.rb +1 -1
- data/lib/new_relic/agent/http_clients/excon_wrappers.rb +5 -1
- data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +5 -1
- data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +5 -1
- data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +1 -1
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +5 -12
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +4 -0
- data/lib/new_relic/agent/instrumentation/{rails4/active_record.rb → active_record_4.rb} +1 -1
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +11 -11
- data/lib/new_relic/agent/instrumentation/authlogic.rb +8 -6
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +12 -6
- data/lib/new_relic/agent/instrumentation/curb.rb +11 -2
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +1 -3
- data/lib/new_relic/agent/instrumentation/evented_subscriber.rb +11 -2
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +13 -4
- data/lib/new_relic/agent/instrumentation/puma.rb +2 -1
- data/lib/new_relic/agent/instrumentation/rack.rb +15 -17
- data/lib/new_relic/agent/method_tracer.rb +181 -191
- data/lib/new_relic/agent/new_relic_service.rb +16 -14
- data/lib/new_relic/agent/pipe_channel_manager.rb +1 -1
- data/lib/new_relic/agent/request_sampler.rb +32 -165
- data/lib/new_relic/agent/sampled_buffer.rb +79 -0
- data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +1 -8
- data/lib/new_relic/agent/sql_sampler.rb +3 -3
- data/lib/new_relic/agent/stats_engine.rb +1 -1
- data/lib/new_relic/agent/stats_engine/gc_profiler.rb +1 -1
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +2 -3
- data/lib/new_relic/agent/stats_engine/transactions.rb +2 -22
- data/lib/new_relic/agent/threading/agent_thread.rb +41 -0
- data/lib/new_relic/agent/threading/backtrace_node.rb +71 -0
- data/lib/new_relic/agent/threading/thread_profile.rb +172 -0
- data/lib/new_relic/agent/transaction.rb +16 -4
- data/lib/new_relic/agent/transaction_sample_builder.rb +13 -3
- data/lib/new_relic/agent/transaction_sampler.rb +5 -8
- data/lib/new_relic/agent/transaction_state.rb +166 -0
- data/lib/new_relic/agent/transaction_timings.rb +53 -0
- data/lib/new_relic/cli/command.rb +91 -0
- data/lib/new_relic/{commands → cli}/deployments.rb +13 -9
- data/lib/new_relic/{commands → cli}/install.rb +2 -2
- data/lib/new_relic/control/frameworks/rails.rb +1 -8
- data/lib/new_relic/control/instance_methods.rb +1 -2
- data/lib/new_relic/helper.rb +9 -0
- data/lib/new_relic/local_environment.rb +16 -63
- data/lib/new_relic/rack/browser_monitoring.rb +8 -5
- data/lib/new_relic/recipes.rb +44 -31
- data/lib/new_relic/transaction_sample.rb +6 -2
- data/lib/new_relic/version.rb +1 -1
- data/lib/tasks/install.rake +21 -1
- data/newrelic_rpm.gemspec +5 -1
- data/test/agent_helper.rb +4 -9
- data/test/environments/.gitignore +16 -0
- data/test/environments/lib/environments/runner.rb +104 -0
- data/test/environments/norails/Gemfile +11 -0
- data/test/environments/norails/Rakefile +9 -0
- data/test/environments/rails21/Gemfile +24 -0
- data/test/environments/rails21/Rakefile +12 -0
- data/test/environments/rails21/app/controllers/application.rb +20 -0
- data/test/environments/rails21/config/boot.rb +113 -0
- data/test/environments/rails21/config/database.yml +31 -0
- data/test/environments/rails21/config/environment.rb +28 -0
- data/test/environments/rails21/config/environments/development.rb +16 -0
- data/test/environments/rails21/config/environments/production.rb +8 -0
- data/test/environments/rails21/config/environments/test.rb +10 -0
- data/test/environments/rails21/config/routes.rb +5 -0
- data/test/environments/rails21/db/schema.rb +5 -0
- data/test/environments/rails22/Gemfile +29 -0
- data/test/environments/rails22/Rakefile +12 -0
- data/test/environments/rails22/app/controllers/application.rb +20 -0
- data/test/environments/rails22/config/boot.rb +113 -0
- data/test/environments/rails22/config/database.yml +31 -0
- data/test/environments/rails22/config/environment.rb +27 -0
- data/test/environments/rails22/config/environments/development.rb +16 -0
- data/test/environments/rails22/config/environments/production.rb +8 -0
- data/test/environments/rails22/config/environments/test.rb +10 -0
- data/test/environments/rails22/config/routes.rb +5 -0
- data/test/environments/rails22/db/schema.rb +5 -0
- data/test/environments/rails23/Gemfile +22 -0
- data/test/environments/rails23/Rakefile +12 -0
- data/test/environments/rails23/app/controllers/application.rb +20 -0
- data/test/environments/rails23/config/boot.rb +127 -0
- data/test/environments/rails23/config/database.yml +31 -0
- data/test/environments/rails23/config/environment.rb +25 -0
- data/test/environments/rails23/config/environments/development.rb +16 -0
- data/test/environments/rails23/config/environments/production.rb +8 -0
- data/test/environments/rails23/config/environments/test.rb +10 -0
- data/test/environments/rails23/config/preinitializer.rb +25 -0
- data/test/environments/rails23/config/routes.rb +5 -0
- data/test/environments/rails23/db/schema.rb +5 -0
- data/test/environments/rails30/Gemfile +19 -0
- data/test/environments/rails30/Rakefile +9 -0
- data/test/environments/rails30/config/application.rb +17 -0
- data/test/environments/rails30/config/boot.rb +10 -0
- data/test/environments/rails30/config/database.yml +31 -0
- data/test/environments/rails30/config/environment.rb +6 -0
- data/test/environments/rails30/config/initializers/new_rails_defaults.rb +11 -0
- data/test/environments/rails30/db/schema.rb +5 -0
- data/test/environments/rails31/Gemfile +19 -0
- data/test/environments/rails31/Rakefile +9 -0
- data/test/environments/rails31/config/application.rb +18 -0
- data/test/environments/rails31/config/boot.rb +10 -0
- data/test/environments/rails31/config/database.yml +31 -0
- data/test/environments/rails31/config/environment.rb +6 -0
- data/test/environments/rails31/config/initializers/new_rails_defaults.rb +21 -0
- data/test/environments/rails31/db/schema.rb +5 -0
- data/test/environments/rails32/Gemfile +25 -0
- data/test/environments/rails32/Rakefile +9 -0
- data/test/environments/rails32/config/application.rb +19 -0
- data/test/environments/rails32/config/boot.rb +10 -0
- data/test/environments/rails32/config/database.yml +31 -0
- data/test/environments/rails32/config/environment.rb +6 -0
- data/test/environments/rails32/db/schema.rb +5 -0
- data/test/environments/rails40/Gemfile +25 -0
- data/test/environments/rails40/Rakefile +9 -0
- data/test/environments/rails40/config/application.rb +18 -0
- data/test/environments/rails40/config/boot.rb +10 -0
- data/test/environments/rails40/config/database.yml +31 -0
- data/test/environments/rails40/config/environment.rb +6 -0
- data/test/environments/rails40/db/schema.rb +5 -0
- data/test/multiverse/lib/multiverse/suite.rb +24 -12
- data/test/multiverse/suites/agent_only/logging_test.rb +18 -1
- data/test/multiverse/suites/agent_only/rum_instrumentation_test.rb +1 -8
- data/test/multiverse/suites/agent_only/thread_profiling_test.rb +10 -7
- data/test/multiverse/suites/curb/curb_test.rb +17 -3
- data/test/multiverse/suites/excon/Envfile +1 -1
- data/test/multiverse/suites/excon/excon_test.rb +18 -2
- data/test/multiverse/suites/httpclient/httpclient_test.rb +2 -2
- data/test/multiverse/suites/net_http/net_http_test.rb +2 -2
- data/test/multiverse/suites/rails/error_tracing_test.rb +35 -8
- data/test/multiverse/suites/rails/ignore_test.rb +48 -0
- data/test/multiverse/suites/rails/mongrel_queue_depth_test.rb +44 -0
- data/test/multiverse/suites/sequel/sequel_test.rb +11 -0
- data/test/multiverse/suites/sinatra/ignoring_test.rb +2 -2
- data/test/multiverse/suites/typhoeus/Envfile +9 -2
- data/test/multiverse/suites/typhoeus/typhoeus_test.rb +3 -2
- data/test/new_relic/agent/agent/start_test.rb +3 -22
- data/test/new_relic/agent/agent_test.rb +6 -5
- data/test/new_relic/agent/autostart_test.rb +39 -1
- data/test/new_relic/agent/browser_monitoring_test.rb +43 -88
- data/test/new_relic/agent/browser_token_test.rb +52 -0
- data/test/new_relic/agent/busy_calculator_test.rb +1 -1
- data/test/new_relic/agent/commands/agent_command_router_test.rb +98 -0
- data/test/new_relic/agent/commands/agent_command_test.rb +37 -0
- data/test/new_relic/agent/commands/thread_profiler_test.rb +177 -0
- data/test/new_relic/agent/configuration/default_source_test.rb +81 -0
- data/test/new_relic/agent/configuration/environment_source_test.rb +81 -7
- data/test/new_relic/agent/configuration/manager_test.rb +16 -1
- data/test/new_relic/agent/cross_app_monitor_test.rb +3 -5
- data/test/new_relic/agent/error_collector_test.rb +14 -0
- data/test/new_relic/agent/instrumentation/action_controller_subscriber_test.rb +1 -1
- data/test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb +2 -3
- data/test/new_relic/agent/instrumentation/active_record_subscriber_test.rb +29 -31
- data/test/new_relic/agent/instrumentation/controller_instrumentation_test.rb +22 -0
- data/test/new_relic/agent/method_tracer/instance_methods/trace_execution_scoped_test.rb +2 -2
- data/test/new_relic/agent/method_tracer_test.rb +2 -2
- data/test/new_relic/agent/new_relic_service_test.rb +5 -49
- data/test/new_relic/agent/pipe_channel_manager_test.rb +1 -0
- data/test/new_relic/agent/request_sampler_test.rb +32 -95
- data/test/new_relic/agent/rpm_agent_test.rb +7 -5
- data/test/new_relic/agent/sampled_buffer_test.rb +178 -0
- data/test/new_relic/agent/stats_engine/metric_stats_test.rb +0 -1
- data/test/new_relic/agent/stats_engine_test.rb +10 -17
- data/test/new_relic/agent/threading/agent_thread_test.rb +107 -0
- data/test/new_relic/agent/threading/backtrace_node_test.rb +96 -0
- data/test/new_relic/agent/{threaded_test.rb → threading/fake_thread.rb} +0 -25
- data/test/new_relic/agent/threading/thread_profile_test.rb +308 -0
- data/test/new_relic/agent/threading/threaded_test_case.rb +33 -0
- data/test/new_relic/agent/transaction/pop_test.rb +0 -16
- data/test/new_relic/agent/transaction_sample_builder_test.rb +23 -4
- data/test/new_relic/agent/transaction_sampler_test.rb +14 -15
- data/test/new_relic/agent/transaction_state_test.rb +75 -0
- data/test/new_relic/agent/transaction_test.rb +15 -0
- data/test/new_relic/agent/transaction_timings_test.rb +81 -0
- data/test/new_relic/agent_test.rb +12 -14
- data/test/new_relic/{command → cli}/deployments_test.rb +41 -13
- data/test/new_relic/control/frameworks/rails_test.rb +1 -2
- data/test/new_relic/control_test.rb +1 -2
- data/test/new_relic/dependency_detection_test.rb +14 -0
- data/test/new_relic/fake_collector.rb +1 -0
- data/test/new_relic/helper_test.rb +7 -2
- data/test/new_relic/http_client_test_cases.rb +33 -1
- data/test/new_relic/local_environment_test.rb +0 -23
- data/test/new_relic/metric_data_test.rb +4 -0
- data/test/new_relic/rack/browser_monitoring_test.rb +31 -30
- data/test/performance/lib/performance/result.rb +15 -4
- data/test/performance/lib/performance/timer.rb +7 -1
- data/test/performance/script/baselines +102 -0
- data/test/performance/suites/rum_autoinsertion.rb +57 -0
- data/test/rum/basic.result.html +10 -0
- data/test/rum/basic.source.html +10 -0
- data/test/rum/comments1.result.html +24 -0
- data/test/rum/comments1.source.html +24 -0
- data/test/rum/comments2.result.html +24 -0
- data/test/rum/comments2.source.html +24 -0
- data/test/rum/gt_in_quotes1.result.html +27 -0
- data/test/rum/gt_in_quotes1.source.html +27 -0
- data/test/rum/gt_in_quotes2.result.html +24 -0
- data/test/rum/gt_in_quotes2.source.html +24 -0
- data/test/rum/gt_in_quotes_mismatch.result.html +24 -0
- data/test/rum/gt_in_quotes_mismatch.source.html +24 -0
- data/test/rum/gt_in_single_quotes1.result.html +25 -0
- data/test/rum/gt_in_single_quotes1.source.html +25 -0
- data/test/rum/gt_in_single_quotes_mismatch.result.html +25 -0
- data/test/rum/gt_in_single_quotes_mismatch.source.html +25 -0
- data/test/rum/incomplete_non_meta_tags.result.html +10 -0
- data/test/rum/incomplete_non_meta_tags.source.html +10 -0
- data/test/rum/no_body.result.html +21 -0
- data/test/rum/no_body.source.html +21 -0
- data/test/rum/no_header.result.html +7 -0
- data/test/rum/no_header.source.html +7 -0
- data/test/rum/no_start_header.result.html +9 -0
- data/test/rum/no_start_header.source.html +9 -0
- data/test/rum/script1.result.html +19 -0
- data/test/rum/script1.source.html +19 -0
- data/test/rum/script2.result.html +17 -0
- data/test/rum/script2.source.html +17 -0
- data/test/rum/x_ua_meta_tag.result.html +10 -0
- data/test/rum/x_ua_meta_tag.source.html +10 -0
- data/test/rum/x_ua_meta_tag_multiline.result.html +11 -0
- data/test/rum/x_ua_meta_tag_multiline.source.html +11 -0
- data/test/rum/x_ua_meta_tag_with_others.result.html +11 -0
- data/test/rum/x_ua_meta_tag_with_others.source.html +11 -0
- data/test/rum/x_ua_meta_tag_with_spaces.result.html +10 -0
- data/test/rum/x_ua_meta_tag_with_spaces.source.html +10 -0
- data/test/script/ci.sh +1 -12
- data/test/test_helper.rb +1 -0
- data/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb +11 -0
- metadata +225 -32
- metadata.gz.sig +0 -0
- data/lib/new_relic/agent/configuration/defaults.rb +0 -157
- data/lib/new_relic/agent/instrumentation/browser_monitoring_timings.rb +0 -56
- data/lib/new_relic/agent/thread.rb +0 -37
- data/lib/new_relic/agent/thread_profiler.rb +0 -323
- data/lib/new_relic/agent/transaction_info.rb +0 -114
- data/lib/new_relic/command.rb +0 -89
- data/test/new_relic/agent/agent_test_controller_test.rb +0 -348
- data/test/new_relic/agent/instrumentation/browser_monitoring_timings_test.rb +0 -70
- data/test/new_relic/agent/thread_profiler_test.rb +0 -586
- data/test/new_relic/agent/thread_test.rb +0 -93
- data/test/new_relic/agent/transaction_info_test.rb +0 -99
@@ -1,70 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
|
-
|
5
|
-
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_helper'))
|
6
|
-
|
7
|
-
module NewRelic::Agent::Instrumentation
|
8
|
-
class BrowserMonitoringTimingsTest < Test::Unit::TestCase
|
9
|
-
|
10
|
-
def setup
|
11
|
-
Time.stubs(:now).returns(Time.at(2000))
|
12
|
-
@transaction = stub(
|
13
|
-
:transaction => stub(:name => "Name"),
|
14
|
-
:start_time => 0
|
15
|
-
)
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_queue_time_in_millis
|
19
|
-
t = BrowserMonitoringTimings.new(1000.1234, @transaction)
|
20
|
-
assert_equal 1_000_123, t.queue_time_in_millis
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_queue_time_in_seconds
|
24
|
-
t = BrowserMonitoringTimings.new(1000.1234, @transaction)
|
25
|
-
assert_equal 1_000.1234, t.queue_time_in_seconds
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_queue_time_clamps_to_positive
|
29
|
-
t = BrowserMonitoringTimings.new(-1000, @transaction)
|
30
|
-
assert_equal 0, t.queue_time_in_millis
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_queue_time_clamps_to_positive_in_seconds
|
34
|
-
t = BrowserMonitoringTimings.new(-1000, @transaction)
|
35
|
-
assert_equal 0, t.queue_time_in_seconds
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_app_time_in_millis
|
39
|
-
t = BrowserMonitoringTimings.new(nil, @transaction)
|
40
|
-
assert_equal 2_000_000, t.app_time_in_millis
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_app_time_in_seconds
|
44
|
-
t = BrowserMonitoringTimings.new(nil, @transaction)
|
45
|
-
assert_equal 2_000, t.app_time_in_seconds
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_locks_time_at_instantiation
|
49
|
-
t = BrowserMonitoringTimings.new(1000, @transaction)
|
50
|
-
original = t.app_time_in_seconds
|
51
|
-
|
52
|
-
Time.stubs(:now).returns(Time.at(3000))
|
53
|
-
later = t.app_time_in_seconds
|
54
|
-
|
55
|
-
assert_equal original, later
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_transaction_name
|
59
|
-
t = BrowserMonitoringTimings.new(nil, @transaction)
|
60
|
-
assert_equal "Name", t.transaction_name
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_defaults_to_transaction_info
|
64
|
-
t = BrowserMonitoringTimings.new(1000, nil)
|
65
|
-
assert_equal nil, t.transaction_name
|
66
|
-
assert_equal 0.0, t.start_time_in_millis
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
end
|
@@ -1,586 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
|
-
|
5
|
-
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
|
6
|
-
require 'base64'
|
7
|
-
require 'thread'
|
8
|
-
require 'timeout'
|
9
|
-
require 'zlib'
|
10
|
-
require 'new_relic/agent/threaded_test'
|
11
|
-
require 'new_relic/agent/thread_profiler'
|
12
|
-
|
13
|
-
START_COMMAND = [[666,{
|
14
|
-
"name" => "start_profiler",
|
15
|
-
"arguments" => {
|
16
|
-
"profile_id" => 42,
|
17
|
-
"sample_period" => 0.02,
|
18
|
-
"duration" => 0.025,
|
19
|
-
"only_runnable_threads" => false,
|
20
|
-
"only_request_threads" => false,
|
21
|
-
"profile_agent_code" => false,
|
22
|
-
}
|
23
|
-
}]]
|
24
|
-
|
25
|
-
STOP_COMMAND = [[666,{
|
26
|
-
"name" => "stop_profiler",
|
27
|
-
"arguments" => {
|
28
|
-
"profile_id" => 42,
|
29
|
-
"report_data" => true,
|
30
|
-
}
|
31
|
-
}]]
|
32
|
-
|
33
|
-
STOP_AND_DISCARD_COMMAND = [[666,{
|
34
|
-
"name" => "stop_profiler",
|
35
|
-
"arguments" => {
|
36
|
-
"profile_id" => 42,
|
37
|
-
"report_data" => false,
|
38
|
-
}
|
39
|
-
}]]
|
40
|
-
|
41
|
-
NO_COMMAND = []
|
42
|
-
|
43
|
-
if !NewRelic::Agent::ThreadProfiler.is_supported?
|
44
|
-
|
45
|
-
class ThreadProfilerUnsupportedTest < Test::Unit::TestCase
|
46
|
-
def setup
|
47
|
-
@profiler = NewRelic::Agent::ThreadProfiler.new
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_thread_profiling_isnt_supported
|
51
|
-
assert_equal false, NewRelic::Agent::ThreadProfiler.is_supported?
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_wont_start_when_not_supported
|
55
|
-
@profiler.start(0, 0, 0, true)
|
56
|
-
assert_equal false, @profiler.running?
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_stop_is_safe_when_not_supported
|
60
|
-
@profiler.start(0, 0, 0, true)
|
61
|
-
@profiler.stop(true)
|
62
|
-
end
|
63
|
-
|
64
|
-
def test_wont_start_and_reports_error
|
65
|
-
errors = nil
|
66
|
-
@profiler.respond_to_commands(START_COMMAND) { |_, err| errors = err }
|
67
|
-
assert_equal false, errors.nil?
|
68
|
-
assert_equal false, @profiler.running?
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
else
|
74
|
-
|
75
|
-
require 'json'
|
76
|
-
|
77
|
-
class ThreadProfilerTest < ThreadedTest
|
78
|
-
def setup
|
79
|
-
super
|
80
|
-
@profiler = NewRelic::Agent::ThreadProfiler.new
|
81
|
-
end
|
82
|
-
|
83
|
-
def test_is_supported
|
84
|
-
assert NewRelic::Agent::ThreadProfiler.is_supported?
|
85
|
-
end
|
86
|
-
|
87
|
-
def test_is_not_running
|
88
|
-
assert !@profiler.running?
|
89
|
-
end
|
90
|
-
|
91
|
-
def test_is_running
|
92
|
-
@profiler.start(0, 0, 0, true)
|
93
|
-
assert @profiler.running?
|
94
|
-
end
|
95
|
-
|
96
|
-
def test_is_not_finished_if_no_profile_started
|
97
|
-
assert !@profiler.finished?
|
98
|
-
end
|
99
|
-
|
100
|
-
def test_can_stop_a_running_profile
|
101
|
-
@profiler.start(0, 0, 0, true)
|
102
|
-
assert @profiler.running?
|
103
|
-
|
104
|
-
@profiler.stop(true)
|
105
|
-
|
106
|
-
assert @profiler.finished?
|
107
|
-
assert_not_nil @profiler.profile
|
108
|
-
end
|
109
|
-
|
110
|
-
def test_can_stop_a_running_profile_and_discard
|
111
|
-
@profiler.start(0, 0, 0, true)
|
112
|
-
assert @profiler.running?
|
113
|
-
|
114
|
-
@profiler.stop(false)
|
115
|
-
|
116
|
-
assert_nil @profiler.profile
|
117
|
-
end
|
118
|
-
|
119
|
-
def test_wont_crash_if_stopping_when_not_started
|
120
|
-
@profiler.stop(true)
|
121
|
-
assert_equal false, @profiler.running?
|
122
|
-
end
|
123
|
-
|
124
|
-
def test_respond_to_commands_with_no_commands_doesnt_run
|
125
|
-
@profiler.respond_to_commands(NO_COMMAND)
|
126
|
-
assert_equal false, @profiler.running?
|
127
|
-
end
|
128
|
-
|
129
|
-
def test_respond_to_commands_starts_running
|
130
|
-
@profiler.respond_to_commands(START_COMMAND) {|_, err| start_error = err}
|
131
|
-
assert_equal true, @profiler.running?
|
132
|
-
end
|
133
|
-
|
134
|
-
def test_respond_to_commands_stops
|
135
|
-
@profiler.start(0, 0, 0, true)
|
136
|
-
assert @profiler.running?
|
137
|
-
|
138
|
-
@profiler.respond_to_commands(STOP_COMMAND)
|
139
|
-
assert_equal true, @profiler.profile.finished?
|
140
|
-
end
|
141
|
-
|
142
|
-
def test_respond_to_commands_stops_and_discards
|
143
|
-
@profiler.start(0, 0, 0, true)
|
144
|
-
assert @profiler.running?
|
145
|
-
|
146
|
-
@profiler.respond_to_commands(STOP_AND_DISCARD_COMMAND)
|
147
|
-
assert_nil @profiler.profile
|
148
|
-
end
|
149
|
-
|
150
|
-
def test_respond_to_commands_wont_start_second_profile
|
151
|
-
@profiler.start(0, 0, 0, true)
|
152
|
-
original_profile = @profiler.profile
|
153
|
-
|
154
|
-
@profiler.respond_to_commands(START_COMMAND)
|
155
|
-
|
156
|
-
assert_equal original_profile, @profiler.profile
|
157
|
-
end
|
158
|
-
|
159
|
-
def test_response_to_commands_start_notifies_of_result
|
160
|
-
saw_command_id = nil
|
161
|
-
@profiler.respond_to_commands(START_COMMAND) { |id, err| saw_command_id = id }
|
162
|
-
assert_equal 666, saw_command_id
|
163
|
-
end
|
164
|
-
|
165
|
-
def test_response_to_commands_start_notifies_of_error
|
166
|
-
saw_command_id = nil
|
167
|
-
error = nil
|
168
|
-
|
169
|
-
@profiler.respond_to_commands(START_COMMAND)
|
170
|
-
@profiler.respond_to_commands(START_COMMAND) { |id, err| saw_command_id = id; error = err }
|
171
|
-
|
172
|
-
assert_equal 666, saw_command_id
|
173
|
-
assert_not_nil error
|
174
|
-
end
|
175
|
-
|
176
|
-
def test_response_to_commands_stop_notifies_of_result
|
177
|
-
saw_command_id = nil
|
178
|
-
@profiler.start(0,0, 0, true)
|
179
|
-
@profiler.respond_to_commands(STOP_COMMAND) { |id, err| saw_command_id = id }
|
180
|
-
assert_equal 666, saw_command_id
|
181
|
-
end
|
182
|
-
|
183
|
-
def test_command_attributes_passed_along
|
184
|
-
@profiler.respond_to_commands(START_COMMAND)
|
185
|
-
assert_equal 42, @profiler.profile.profile_id
|
186
|
-
assert_equal 0.02, @profiler.profile.interval
|
187
|
-
assert_equal false, @profiler.profile.profile_agent_code
|
188
|
-
end
|
189
|
-
|
190
|
-
def test_missing_name_in_command
|
191
|
-
command = [[666,{ "arguments" => {} } ]]
|
192
|
-
@profiler.respond_to_commands(command)
|
193
|
-
|
194
|
-
assert_equal false, @profiler.running?
|
195
|
-
end
|
196
|
-
|
197
|
-
def test_malformed_agent_command
|
198
|
-
command = [[666]]
|
199
|
-
@profiler.respond_to_commands(command)
|
200
|
-
|
201
|
-
assert_equal false, @profiler.running?
|
202
|
-
end
|
203
|
-
|
204
|
-
end
|
205
|
-
|
206
|
-
class ThreadProfileTest < ThreadedTest
|
207
|
-
|
208
|
-
def setup
|
209
|
-
super
|
210
|
-
|
211
|
-
@single_trace = [
|
212
|
-
"irb.rb:69:in `catch'",
|
213
|
-
"irb.rb:69:in `start'",
|
214
|
-
"irb:12:in `<main>'"
|
215
|
-
]
|
216
|
-
|
217
|
-
# Run the worker_loop for the thread profile based on two iterations
|
218
|
-
# This takes time fussiness out of the equation and keeps the tests stable
|
219
|
-
ignored_duration = 666
|
220
|
-
@profile = NewRelic::Agent::ThreadProfile.new(-1, ignored_duration, 0.01, true)
|
221
|
-
@profile.instance_variable_set(:@worker_loop, NewRelic::Agent::WorkerLoop.new(:limit => 2))
|
222
|
-
end
|
223
|
-
|
224
|
-
# Running Tests
|
225
|
-
def test_profiler_collects_backtrace_from_every_thread
|
226
|
-
FakeThread.list << FakeThread.new
|
227
|
-
FakeThread.list << FakeThread.new
|
228
|
-
|
229
|
-
@profile.run
|
230
|
-
|
231
|
-
assert_equal 2, @profile.poll_count
|
232
|
-
assert_equal 4, @profile.sample_count
|
233
|
-
end
|
234
|
-
|
235
|
-
def test_profiler_collects_into_request_bucket
|
236
|
-
FakeThread.list << FakeThread.new(
|
237
|
-
:bucket => :request,
|
238
|
-
:backtrace => @single_trace)
|
239
|
-
|
240
|
-
@profile.run
|
241
|
-
|
242
|
-
assert_equal 1, @profile.traces[:request].size
|
243
|
-
end
|
244
|
-
|
245
|
-
def test_profiler_collects_into_background_bucket
|
246
|
-
FakeThread.list << FakeThread.new(
|
247
|
-
:bucket => :background,
|
248
|
-
:backtrace => @single_trace)
|
249
|
-
|
250
|
-
@profile.run
|
251
|
-
|
252
|
-
assert_equal 1, @profile.traces[:background].size
|
253
|
-
end
|
254
|
-
|
255
|
-
def test_profiler_collects_into_other_bucket
|
256
|
-
FakeThread.list << FakeThread.new(
|
257
|
-
:bucket => :other,
|
258
|
-
:backtrace => @single_trace)
|
259
|
-
|
260
|
-
@profile.run
|
261
|
-
|
262
|
-
assert_equal 1, @profile.traces[:other].size
|
263
|
-
end
|
264
|
-
|
265
|
-
def test_profiler_collects_into_agent_bucket
|
266
|
-
FakeThread.list << FakeThread.new(
|
267
|
-
:bucket => :agent,
|
268
|
-
:backtrace => @single_trace)
|
269
|
-
|
270
|
-
@profile.run
|
271
|
-
|
272
|
-
assert_equal 1, @profile.traces[:agent].size
|
273
|
-
end
|
274
|
-
|
275
|
-
def test_profiler_ignores_agent_threads_when_told_to
|
276
|
-
FakeThread.list << FakeThread.new(
|
277
|
-
:bucket => :ignore,
|
278
|
-
:backtrace => @single_trace)
|
279
|
-
|
280
|
-
@profile.run
|
281
|
-
|
282
|
-
@profile.traces.each do |key, trace|
|
283
|
-
assert trace.empty?, "Trace :#{key} should have been empty"
|
284
|
-
end
|
285
|
-
end
|
286
|
-
|
287
|
-
def test_profiler_tries_to_scrub_backtraces
|
288
|
-
FakeThread.list << FakeThread.new(
|
289
|
-
:bucket => :agent,
|
290
|
-
:backtrace => @single_trace,
|
291
|
-
:scrubbed_backtrace => @single_trace[0..0])
|
292
|
-
|
293
|
-
@profile.run
|
294
|
-
|
295
|
-
assert_equal [], @profile.traces[:agent].first.children
|
296
|
-
end
|
297
|
-
|
298
|
-
def test_profile_can_be_stopped
|
299
|
-
# Can't easily stop in middle of processing since FakeThread's synchronous
|
300
|
-
# Mark to bail immediately, then see we didn't record anything
|
301
|
-
@profile.stop
|
302
|
-
|
303
|
-
@profile.run
|
304
|
-
|
305
|
-
assert_not_nil @profile.stop_time
|
306
|
-
assert_equal true, @profile.finished?
|
307
|
-
|
308
|
-
assert_equal 0, @profile.poll_count
|
309
|
-
@profile.traces.each do |key, trace|
|
310
|
-
assert_equal [], trace, "Trace for :#{key} should have been empty"
|
311
|
-
end
|
312
|
-
end
|
313
|
-
|
314
|
-
def test_profiler_tracks_time
|
315
|
-
@profile.run
|
316
|
-
|
317
|
-
assert_not_nil @profile.start_time
|
318
|
-
assert_not_nil @profile.stop_time
|
319
|
-
end
|
320
|
-
|
321
|
-
def test_finished
|
322
|
-
assert !@profile.finished?
|
323
|
-
|
324
|
-
@profile.run.join
|
325
|
-
|
326
|
-
assert @profile.finished?
|
327
|
-
end
|
328
|
-
|
329
|
-
# Parsing and Aggregation Tests
|
330
|
-
def test_parse_backtrace
|
331
|
-
trace = [
|
332
|
-
"/Users/jclark/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/irb.rb:69:in `catch'",
|
333
|
-
"/Users/jclark/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/irb.rb:69:in `start'",
|
334
|
-
"/Users/jclark/.rbenv/versions/1.9.3/bin/irb:12:in `<main>'"
|
335
|
-
]
|
336
|
-
|
337
|
-
result = NewRelic::Agent::ThreadProfile.parse_backtrace(trace)
|
338
|
-
assert_equal({ :method => 'catch',
|
339
|
-
:file => '/Users/jclark/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/irb.rb',
|
340
|
-
:line_no => 69 }, result[0])
|
341
|
-
assert_equal({ :method => 'start',
|
342
|
-
:file => '/Users/jclark/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/irb.rb',
|
343
|
-
:line_no => 69 }, result[1])
|
344
|
-
assert_equal({ :method => '<main>',
|
345
|
-
:file => '/Users/jclark/.rbenv/versions/1.9.3/bin/irb',
|
346
|
-
:line_no => 12 }, result[2])
|
347
|
-
end
|
348
|
-
|
349
|
-
def test_aggregate_empty_trace
|
350
|
-
result = @profile.aggregate([])
|
351
|
-
assert_nil result
|
352
|
-
end
|
353
|
-
|
354
|
-
def test_aggregate_nil_trace
|
355
|
-
result = @profile.aggregate(nil)
|
356
|
-
assert_nil result
|
357
|
-
end
|
358
|
-
|
359
|
-
def test_aggregate_builds_tree_from_first_trace
|
360
|
-
result = @profile.aggregate(@single_trace)
|
361
|
-
|
362
|
-
tree = NewRelic::Agent::ThreadProfile::Node.new(@single_trace[-1])
|
363
|
-
child = NewRelic::Agent::ThreadProfile::Node.new(@single_trace[-2], tree)
|
364
|
-
NewRelic::Agent::ThreadProfile::Node.new(@single_trace[-3], child)
|
365
|
-
|
366
|
-
assert_equal tree, result
|
367
|
-
end
|
368
|
-
|
369
|
-
def test_aggregate_builds_tree_from_overlapping_traces
|
370
|
-
result = @profile.aggregate(@single_trace)
|
371
|
-
result = @profile.aggregate(@single_trace, [result])
|
372
|
-
|
373
|
-
tree = NewRelic::Agent::ThreadProfile::Node.new(@single_trace[-1])
|
374
|
-
tree.runnable_count += 1
|
375
|
-
child = NewRelic::Agent::ThreadProfile::Node.new(@single_trace[-2], tree)
|
376
|
-
child.runnable_count += 1
|
377
|
-
grand = NewRelic::Agent::ThreadProfile::Node.new(@single_trace[-3], child)
|
378
|
-
grand.runnable_count += 1
|
379
|
-
|
380
|
-
assert_equal tree, result
|
381
|
-
end
|
382
|
-
|
383
|
-
def test_aggregate_builds_tree_from_diverging_traces
|
384
|
-
other_trace = [
|
385
|
-
"irb.rb:69:in `catch'",
|
386
|
-
"chunky_bacon.rb:42:in `start'",
|
387
|
-
"irb:12:in `<main>'"
|
388
|
-
]
|
389
|
-
|
390
|
-
result = @profile.aggregate(@single_trace)
|
391
|
-
result = @profile.aggregate(@single_trace, [result])
|
392
|
-
|
393
|
-
tree = NewRelic::Agent::ThreadProfile::Node.new(@single_trace[-1])
|
394
|
-
tree.runnable_count += 1
|
395
|
-
|
396
|
-
child = NewRelic::Agent::ThreadProfile::Node.new(@single_trace[-2], tree)
|
397
|
-
grand = NewRelic::Agent::ThreadProfile::Node.new(@single_trace[-3], child)
|
398
|
-
|
399
|
-
other_child = NewRelic::Agent::ThreadProfile::Node.new(other_trace[-2], tree)
|
400
|
-
other_grand = NewRelic::Agent::ThreadProfile::Node.new(other_trace[-3], other_child)
|
401
|
-
|
402
|
-
assert_equal tree, result
|
403
|
-
end
|
404
|
-
|
405
|
-
def test_prune_tree
|
406
|
-
@profile.aggregate(@single_trace)
|
407
|
-
|
408
|
-
t = @profile.prune!(1)
|
409
|
-
|
410
|
-
assert_equal 0, @profile.traces[:request].first.children.size
|
411
|
-
end
|
412
|
-
|
413
|
-
def test_prune_keeps_highest_counts
|
414
|
-
@profile.aggregate(@single_trace, @profile.traces[:request])
|
415
|
-
@profile.aggregate(@single_trace, @profile.traces[:other])
|
416
|
-
@profile.aggregate(@single_trace, @profile.traces[:other])
|
417
|
-
|
418
|
-
@profile.prune!(1)
|
419
|
-
|
420
|
-
assert_equal [], @profile.traces[:request]
|
421
|
-
assert_equal 1, @profile.traces[:other].size
|
422
|
-
assert_equal [], @profile.traces[:other][0].children
|
423
|
-
end
|
424
|
-
|
425
|
-
def test_prune_keeps_highest_count_then_depths
|
426
|
-
@profile.aggregate(@single_trace, @profile.traces[:request])
|
427
|
-
@profile.aggregate(@single_trace, @profile.traces[:other])
|
428
|
-
|
429
|
-
@profile.prune!(2)
|
430
|
-
|
431
|
-
assert_equal 1, @profile.traces[:request].size
|
432
|
-
assert_equal 1, @profile.traces[:other].size
|
433
|
-
assert_equal [], @profile.traces[:request][0].children
|
434
|
-
assert_equal [], @profile.traces[:other][0].children
|
435
|
-
end
|
436
|
-
|
437
|
-
def build_well_known_trace
|
438
|
-
trace = ["thread_profiler.py:1:in `<module>'"]
|
439
|
-
10.times { @profile.aggregate(trace, @profile.traces[:other]) }
|
440
|
-
|
441
|
-
trace = [
|
442
|
-
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py:489:in `__bootstrap'",
|
443
|
-
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py:512:in `__bootstrap_inner'",
|
444
|
-
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py:480:in `run'",
|
445
|
-
"thread_profiler.py:76:in `_profiler_loop'",
|
446
|
-
"thread_profiler.py:103:in `_run_profiler'",
|
447
|
-
"thread_profiler.py:165:in `collect_thread_stacks'"]
|
448
|
-
10.times { @profile.aggregate(trace, @profile.traces[:agent]) }
|
449
|
-
end
|
450
|
-
|
451
|
-
WELL_KNOWN_TRACE_ENCODED = "eJy9klFPwjAUhf/LfW7WDQTUGBPUiYkGdAxelqXZRpGGrm1uS8xi/O924JQX\n9Un7dm77ndN7c19hlt7FCZxnWQZug7xYMYN6LSTHwDRA4KLWq53kl0CinEQh\nCUmW5zmBJH5axPPUk16MJ/E0/cGk0lLyyrGPS+uKamu943DQeX5HMtypz5In\nwv6vRCeZ1NoAGQ2PCDpvrOM1fRAlFtjQWyxq/qJxa+lj4zZaBeuuQpccrdDK\n0l4wolKU1OxftOoQLNTzIdL/EcjJafjnQYyVWjvrsDBMKNVOZBD1/jO27fPs\naBG+DoGr8fX9JJktpjftVry9A9unzGo=\n"
|
452
|
-
|
453
|
-
def test_to_collector_array
|
454
|
-
@profile.instance_variable_set(:@start_time, 1350403938892.524)
|
455
|
-
@profile.instance_variable_set(:@stop_time, 1350403939904.375)
|
456
|
-
@profile.instance_variable_set(:@poll_count, 10)
|
457
|
-
@profile.instance_variable_set(:@sample_count, 2)
|
458
|
-
|
459
|
-
build_well_known_trace
|
460
|
-
|
461
|
-
expected = [[
|
462
|
-
-1,
|
463
|
-
1350403938892.524,
|
464
|
-
1350403939904.375,
|
465
|
-
10,
|
466
|
-
WELL_KNOWN_TRACE_ENCODED,
|
467
|
-
2,
|
468
|
-
0
|
469
|
-
]]
|
470
|
-
|
471
|
-
marshaller = NewRelic::Agent::NewRelicService::JsonMarshaller.new
|
472
|
-
assert_equal expected, @profile.to_collector_array(marshaller.default_encoder)
|
473
|
-
end
|
474
|
-
|
475
|
-
def test_to_collector_array_with_bad_values
|
476
|
-
@profile.instance_variable_set(:@profile_id, "-1")
|
477
|
-
@profile.instance_variable_set(:@start_time, "")
|
478
|
-
@profile.instance_variable_set(:@stop_time, nil)
|
479
|
-
@profile.instance_variable_set(:@poll_count, Rational(10, 1))
|
480
|
-
@profile.instance_variable_set(:@sample_count, nil)
|
481
|
-
|
482
|
-
build_well_known_trace
|
483
|
-
|
484
|
-
expected = [[
|
485
|
-
-1,
|
486
|
-
0.0,
|
487
|
-
0.0,
|
488
|
-
10,
|
489
|
-
WELL_KNOWN_TRACE_ENCODED,
|
490
|
-
0,
|
491
|
-
0
|
492
|
-
]]
|
493
|
-
|
494
|
-
marshaller = NewRelic::Agent::NewRelicService::JsonMarshaller.new
|
495
|
-
assert_equal expected, @profile.to_collector_array(marshaller.default_encoder)
|
496
|
-
end
|
497
|
-
end
|
498
|
-
|
499
|
-
class ThreadProfileNodeTest < Test::Unit::TestCase
|
500
|
-
SINGLE_LINE = "irb.rb:69:in `catch'"
|
501
|
-
|
502
|
-
def test_single_node_converts_to_array
|
503
|
-
line = "irb.rb:69:in `catch'"
|
504
|
-
node = NewRelic::Agent::ThreadProfile::Node.new(line)
|
505
|
-
|
506
|
-
assert_equal([
|
507
|
-
["irb.rb", "catch", 69],
|
508
|
-
0, 0,
|
509
|
-
[]],
|
510
|
-
node.to_array)
|
511
|
-
end
|
512
|
-
|
513
|
-
def test_multiple_nodes_converts_to_array
|
514
|
-
line = "irb.rb:69:in `catch'"
|
515
|
-
child_line = "bacon.rb:42:in `yum'"
|
516
|
-
node = NewRelic::Agent::ThreadProfile::Node.new(line)
|
517
|
-
child = NewRelic::Agent::ThreadProfile::Node.new(child_line, node)
|
518
|
-
|
519
|
-
assert_equal([
|
520
|
-
["irb.rb", "catch", 69],
|
521
|
-
0, 0,
|
522
|
-
[
|
523
|
-
[
|
524
|
-
['bacon.rb', 'yum', 42],
|
525
|
-
0,0,
|
526
|
-
[]
|
527
|
-
]
|
528
|
-
]],
|
529
|
-
node.to_array)
|
530
|
-
end
|
531
|
-
|
532
|
-
def test_gracefully_handle_bad_values_in_to_array
|
533
|
-
node = NewRelic::Agent::ThreadProfile::Node.new(SINGLE_LINE)
|
534
|
-
node.instance_variable_set(:@line_no, "blarg")
|
535
|
-
node.runnable_count = Rational(10, 1)
|
536
|
-
|
537
|
-
assert_equal([
|
538
|
-
["irb.rb", "catch", 0],
|
539
|
-
10, 0,
|
540
|
-
[]],
|
541
|
-
node.to_array)
|
542
|
-
end
|
543
|
-
|
544
|
-
def test_add_child_twice
|
545
|
-
parent = NewRelic::Agent::ThreadProfile::Node.new(SINGLE_LINE)
|
546
|
-
child = NewRelic::Agent::ThreadProfile::Node.new(SINGLE_LINE)
|
547
|
-
|
548
|
-
parent.add_child(child)
|
549
|
-
parent.add_child(child)
|
550
|
-
|
551
|
-
assert_equal 1, parent.children.size
|
552
|
-
end
|
553
|
-
|
554
|
-
def test_prune_keeps_children
|
555
|
-
parent = NewRelic::Agent::ThreadProfile::Node.new(SINGLE_LINE)
|
556
|
-
child = NewRelic::Agent::ThreadProfile::Node.new(SINGLE_LINE, parent)
|
557
|
-
|
558
|
-
parent.prune!
|
559
|
-
|
560
|
-
assert_equal [child], parent.children
|
561
|
-
end
|
562
|
-
|
563
|
-
def test_prune_removes_children
|
564
|
-
parent = NewRelic::Agent::ThreadProfile::Node.new(SINGLE_LINE)
|
565
|
-
child = NewRelic::Agent::ThreadProfile::Node.new(SINGLE_LINE, parent)
|
566
|
-
|
567
|
-
child.to_prune = true
|
568
|
-
parent.prune!
|
569
|
-
|
570
|
-
assert_equal [], parent.children
|
571
|
-
end
|
572
|
-
|
573
|
-
def test_prune_removes_grandchildren
|
574
|
-
parent = NewRelic::Agent::ThreadProfile::Node.new(SINGLE_LINE)
|
575
|
-
child = NewRelic::Agent::ThreadProfile::Node.new(SINGLE_LINE, parent)
|
576
|
-
grandchild = NewRelic::Agent::ThreadProfile::Node.new(SINGLE_LINE, child)
|
577
|
-
|
578
|
-
grandchild.to_prune = true
|
579
|
-
parent.prune!
|
580
|
-
|
581
|
-
assert_equal [child], parent.children
|
582
|
-
assert_equal [], child.children
|
583
|
-
end
|
584
|
-
|
585
|
-
end
|
586
|
-
end
|