Sha256: ec8a6acf263d6e7c8b6c9255ecad7fcf7a5b33f6d34879c125546801643a11af

Contents?: true

Size: 1.35 KB

Versions: 22

Compression:

Stored size: 1.35 KB

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

require File.join(File.dirname(__FILE__), '..', '..', '..', 'new_relic', 'marshalling_test_cases')

if NewRelic::LanguageSupport.can_fork?

class ResqueMarshallingTest < Minitest::Test

  include MultiverseHelpers
  include MarshallingTestCases

  setup_and_teardown_agent

  def before_teardown
    puts
    p $collector.agent_data.map { |post| [post.class, post.action] }
    super
  end

  class DummyJob
    extend Resque::Plugins::NewRelicInstrumentation
  end

  def invoke_hook(name, *args)
    hooks = Array(Resque.send(name))
    hooks.each { |h| h.call(*args) }
  end

  def around_each
    invoke_hook(:before_first_fork)

    # We just need something that responds to object_id here, because our
    # Resque instrumentation uses that to assign a unique identifier to the pipe
    # that will be used to send data about this job.
    job = Object.new

    invoke_hook(:before_fork, job)

    child_pid = Process.fork

    if child_pid
      Process.wait(child_pid)
    else
      invoke_hook(:after_fork, job)
      DummyJob.around_perform_with_monitoring do
        yield
      end

      run_harvest
      exit
    end
  end

  def after_each
    NewRelic::Agent::PipeChannelManager.listener.stop
  end
end

end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
newrelic_rpm-4.1.0.333 test/multiverse/suites/resque/resque_marshalling_test.rb
newrelic_rpm-4.0.0.332 test/multiverse/suites/resque/resque_marshalling_test.rb
newrelic_rpm-3.18.1.330 test/multiverse/suites/resque/resque_marshalling_test.rb
newrelic_rpm-3.18.0.329 test/multiverse/suites/resque/resque_marshalling_test.rb
newrelic_rpm-3.17.2.327 test/multiverse/suites/resque/resque_marshalling_test.rb
newrelic_rpm-3.17.1.326 test/multiverse/suites/resque/resque_marshalling_test.rb
newrelic_rpm-3.17.0.325 test/multiverse/suites/resque/resque_marshalling_test.rb
newrelic_rpm-3.16.3.323 test/multiverse/suites/resque/resque_marshalling_test.rb
newrelic_rpm-3.16.2.321 test/multiverse/suites/resque/resque_marshalling_test.rb
newrelic_rpm-3.16.1.320 test/multiverse/suites/resque/resque_marshalling_test.rb
newrelic_rpm-3.16.0.318 test/multiverse/suites/resque/resque_marshalling_test.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-3.15.2.317/test/multiverse/suites/resque/resque_marshalling_test.rb
newrelic_rpm-3.15.2.317 test/multiverse/suites/resque/resque_marshalling_test.rb
newrelic_rpm-3.15.1.316 test/multiverse/suites/resque/resque_marshalling_test.rb
newrelic_rpm-3.15.0.314 test/multiverse/suites/resque/resque_marshalling_test.rb
newrelic_rpm-3.14.3.313 test/multiverse/suites/resque/resque_marshalling_test.rb
newrelic_rpm-3.14.2.312 test/multiverse/suites/resque/resque_marshalling_test.rb
newrelic_rpm-3.14.1.311 test/multiverse/suites/resque/resque_marshalling_test.rb
newrelic_rpm-3.14.0.305 test/multiverse/suites/resque/resque_marshalling_test.rb
newrelic_rpm-3.13.2.302 test/multiverse/suites/resque/resque_marshalling_test.rb