Sha256: d63408a737bb5981a7ef07caf77ff65bc4b8e6f803c895840c4df141181e8cad

Contents?: true

Size: 1.76 KB

Versions: 18

Compression:

Stored size: 1.76 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_helper'))
require 'new_relic/agent/configuration/yaml_source'

module NewRelic::Agent::Configuration
  class YamlSourceTest < Test::Unit::TestCase
    def setup
      test_yml_path = File.expand_path(File.join(File.dirname(__FILE__),
                                                 '..','..','..',
                                                 'config','newrelic.yml'))
      @source = YamlSource.new(test_yml_path, 'test')
    end

    def test_should_load_given_yaml_file
      assert_equal '127.0.0.1', @source[:api_host]
    end

    def test_should_apply_erb_transformations
      assert_equal 'heyheyhey', @source[:erb_value]
      assert_equal '', @source[:message]
      assert_equal '', @source[:license_key]
    end

    def test_config_booleans
      assert_equal true, @source[:tval]
      assert_equal false, @source[:fval]
      assert_nil @source[:not_in_yaml_val]
      assert_equal true, @source[:yval]
      assert_equal 'sure', @source[:sval]
    end

    def test_appnames
      assert_equal %w[a b c], @source[:app_name]
    end

    def test_should_load_the_config_for_the_correct_env
      assert_not_equal 'the.wrong.host', @source[:host]
    end

    def test_should_convert_to_dot_notation
      assert_equal 'raw', @source[:'transaction_tracer.record_sql']
    end

    def test_should_ignore_apdex_f_setting_for_transaction_threshold
      assert_equal nil, @source[:'transaction_tracer.transaction_threshold']
    end

    def test_should_correctly_handle_floats
      assert_equal 1.1, @source[:apdex_t]
    end

    def test_should_log_if_no_file_is_found
      NewRelic::Control.instance.log.expects(:error)
      source = YamlSource.new('no_such_file.yml', 'test')
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
newrelic_rpm-3.5.4.35.beta test/new_relic/agent/configuration/yaml_source_test.rb
newrelic_rpm-3.5.4.34 test/new_relic/agent/configuration/yaml_source_test.rb
newrelic_rpm-3.5.4.33 test/new_relic/agent/configuration/yaml_source_test.rb
newrelic_rpm-3.5.4.31.beta test/new_relic/agent/configuration/yaml_source_test.rb
newrelic_rpm-3.5.4.29.beta test/new_relic/agent/configuration/yaml_source_test.rb
ghazel-newrelic_rpm-3.5.4 test/new_relic/agent/configuration/yaml_source_test.rb
newrelic_rpm-3.5.3.25 test/new_relic/agent/configuration/yaml_source_test.rb
newrelic_rpm-3.5.3.24 test/new_relic/agent/configuration/yaml_source_test.rb
newrelic_rpm-3.5.2.17 test/new_relic/agent/configuration/yaml_source_test.rb
newrelic_rpm-3.5.1.14 test/new_relic/agent/configuration/yaml_source_test.rb
newrelic_rpm-3.5.1.14.beta test/new_relic/agent/configuration/yaml_source_test.rb
newrelic_rpm-3.5.1.beta1 test/new_relic/agent/configuration/yaml_source_test.rb
newrelic_rpm-3.5.0.1 test/new_relic/agent/configuration/yaml_source_test.rb
newrelic_rpm-3.5.1.alpha test/new_relic/agent/configuration/yaml_source_test.rb
newrelic_rpm-3.5.0 test/new_relic/agent/configuration/yaml_source_test.rb
newrelic_rpm-3.4.2.1 test/new_relic/agent/configuration/yaml_source_test.rb
newrelic_rpm-3.4.2 test/new_relic/agent/configuration/yaml_source_test.rb
newrelic_rpm-3.4.2.beta1 test/new_relic/agent/configuration/yaml_source_test.rb