Sha256: 2d4ed303dd8bd5be9a7d49dc4455dfb84274f423d2c891993a82ba2416933194

Contents?: true

Size: 995 Bytes

Versions: 57

Compression:

Stored size: 995 Bytes

Contents

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

require 'test_helper'

class ConfigTest < Minitest::Test
  def test_that_config_exists
    refute_nil ::Instana.config
    assert_instance_of(::Instana::Config, ::Instana.config)
  end

  def test_that_it_has_defaults
    assert_equal '127.0.0.1', ::Instana.config[:agent_host]
    assert_equal 42699, ::Instana.config[:agent_port]

    assert ::Instana.config[:tracing][:enabled]
    assert ::Instana.config[:metrics][:enabled]

    ::Instana.config[:metrics].each do |k, v|
      next unless v.is_a? Hash
      assert_equal true, ::Instana.config[:metrics][k].key?(:enabled)
    end
  end

  def test_custom_agent_host
    subject = Instana::Config.new(logger: Logger.new('/dev/null'), agent_host: 'abc')
    assert_equal 'abc', subject[:agent_host]
  end

  def test_custom_agent_port
    subject = Instana::Config.new(logger: Logger.new('/dev/null'), agent_port: 'abc')
    assert_equal 'abc', subject[:agent_port]
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
instana-1.217.1 test/config_test.rb
instana-1.217.0 test/config_test.rb
instana-1.216.0 test/config_test.rb
instana-1.215.1 test/config_test.rb
instana-1.215.0 test/config_test.rb
instana-1.214.4 test/config_test.rb
instana-1.214.3 test/config_test.rb
instana-1.214.2 test/config_test.rb
instana-1.214.1 test/config_test.rb
instana-1.214.0 test/config_test.rb
instana-1.213.3 test/config_test.rb
instana-1.213.2 test/config_test.rb
instana-1.213.1 test/config_test.rb
instana-1.213.0 test/config_test.rb
instana-1.212.0 test/config_test.rb
instana-1.211.0 test/config_test.rb
instana-1.210.1 test/config_test.rb
instana-1.210.0 test/config_test.rb
instana-1.209.8 test/config_test.rb
instana-1.209.7 test/config_test.rb