Sha256: c8b4c8baf50d3f94d16656d57c0194cb9f1df322281cba535f678b5ac6f524f9

Contents?: true

Size: 1.09 KB

Versions: 13

Compression:

Stored size: 1.09 KB

Contents

# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2021

require 'test_helper'

class ActivatorTest < Minitest::Test
  def test_start
    refute_nil Instana::Activator.trace_point
    assert Instana::Activator.trace_point.enabled?
  end

  def test_klass_call
    assert_equal [], Instana::Activator.call
  end

  def test_instance_call
    subject = Class.new(Instana::Activator) do
      def can_instrument?
        true
      end

      def instrument
        true
      end
    end

    assert_equal 1, Instana::Activator.call.length
    assert subject.call
  end

  def test_limited_activated_set
    ENV['INSTANA_ACTIVATE_SET'] = 'rack,rails'
    subject = activated_set
    assert_instance_of Set, subject
    assert_equal 2, subject.length
    assert_includes subject, 'rack'
    assert_includes subject, 'rails'
  ensure
    ENV.delete('INSTANA_ACTIVATE_SET')
  end

  def test_unlimited_activated_set
    ENV.delete('INSTANA_ACTIVATE_SET')
    subject = activated_set
    assert_instance_of Set, subject
    assert_equal 31, subject.length
  ensure
    ENV.delete('INSTANA_ACTIVATE_SET')
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
instana-1.215.1 test/activator_test.rb
instana-1.215.0 test/activator_test.rb
instana-1.214.4 test/activator_test.rb
instana-1.214.3 test/activator_test.rb
instana-1.214.2 test/activator_test.rb
instana-1.214.1 test/activator_test.rb
instana-1.214.0 test/activator_test.rb
instana-1.213.3 test/activator_test.rb
instana-1.213.2 test/activator_test.rb
instana-1.213.1 test/activator_test.rb
instana-1.213.0 test/activator_test.rb
instana-1.212.0 test/activator_test.rb
instana-1.211.0 test/activator_test.rb