Sha256: 11177b36c9016b328a9b3502a957d4068ae56061139e734f8936daea5b8036e6

Contents?: true

Size: 1.81 KB

Versions: 14

Compression:

Stored size: 1.81 KB

Contents

# Copyright (c) 2015 AppNeta, Inc.
# All rights reserved.

require 'minitest_helper'

describe "Resque" do
  before do
    clear_all_traces

    # These are standard entry/exit KVs that are passed up with all moped operations
    @entry_kvs = {
      'Layer' => 'resque',
      'Label' => 'entry' }

    @exit_kvs = { 'Layer' => 'resque', 'Label' => 'exit' }
  end

  it 'Stock Resque should be loaded, defined and ready' do
    defined?(::Resque).wont_match nil
    defined?(::Resque::Worker).wont_match nil
    defined?(::Resque::Job).wont_match nil
  end

  it 'Resque should have traceview methods defined' do
    [ :enqueue, :enqueue_to, :dequeue ].each do |m|
      ::Resque.method_defined?("#{m}_with_traceview").must_equal true
    end

    ::Resque::Worker.method_defined?("perform_with_traceview").must_equal true
    ::Resque::Job.method_defined?("fail_with_traceview").must_equal true
  end

  it "should trace enqueue" do
    skip
    TraceView::API.start_trace('resque-client_test', '', {}) do
      Resque.enqueue(TraceViewResqueJob, { :generate => :activerecord, :delay => rand(5..30).to_f })
      Resque.enqueue(TraceViewResqueJobThatFails)
      Resque.dequeue(TraceViewResqueJob, { :generate => :moped })
    end

    traces = get_all_traces

    traces.count.must_equal 4
    validate_outer_layers(traces, 'resque-client_test')

    validate_event_keys(traces[1], @entry_kvs)
    validate_event_keys(traces[2], @exit_kvs)
  end

  it "should trace dequeue" do
    skip
    TraceView::API.start_trace('resque-client_test', '', {}) do
      Resque.dequeue(TraceViewResqueJob, { :generate => :moped })
    end

    traces = get_all_traces

    traces.count.must_equal 4
    validate_outer_layers(traces, 'resque-client_test')

    validate_event_keys(traces[1], @entry_kvs)
    validate_event_keys(traces[2], @exit_kvs)
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
traceview-3.3.1-java test/instrumentation/resque_test.rb
traceview-3.3.1 test/instrumentation/resque_test.rb
traceview-3.3.0-java test/instrumentation/resque_test.rb
traceview-3.3.0 test/instrumentation/resque_test.rb
traceview-3.2.1-java test/instrumentation/resque_test.rb
traceview-3.2.1 test/instrumentation/resque_test.rb
traceview-3.1.0-java test/instrumentation/resque_test.rb
traceview-3.1.0 test/instrumentation/resque_test.rb
traceview-3.0.5-java test/instrumentation/resque_test.rb
traceview-3.0.5 test/instrumentation/resque_test.rb
traceview-3.0.4-java test/instrumentation/resque_test.rb
traceview-3.0.4 test/instrumentation/resque_test.rb
traceview-3.0.3-java test/instrumentation/resque_test.rb
traceview-3.0.3 test/instrumentation/resque_test.rb