Sha256: 41c43f830af3d48453284c723110caac323f8864daeba5c4a8a7798f889a3f06

Contents?: true

Size: 1.08 KB

Versions: 9

Compression:

Stored size: 1.08 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.

# https://support.newrelic.com/tickets/2101
# https://github.com/newrelic/rpm/pull/42
# https://github.com/newrelic/rpm/pull/45
require 'test/unit'
require 'new_relic/agent/instrumentation/data_mapper'

class DatabaseAdapter
  # we patch in here
  def log(*args)
  end
  include ::NewRelic::Agent::Instrumentation::DataMapperInstrumentation
end

class EncodingTest < Test::Unit::TestCase
  # datamapper wants a msg object
  MSG = Object.new
  def MSG.query
    # Contains invalid UTF8 Byte
    q = "select ICS95095010000000000083320000BS01030000004100+\xFF00000000000000000"
    if RUBY_VERSION >= '1.9'
      # Force the query to an invalid encoding
      q.force_encoding 'UTF-8'
    end
    q
  end
  def MSG.duration; 1.0; end

  def test_should_not_bomb_out_if_a_query_is_in_an_invalid_encoding
    if RUBY_VERSION >= '1.9'
      assert_equal false, MSG.query.valid_encoding?
    end
    db = DatabaseAdapter.new
    db.send(:log, MSG)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
newrelic_rpm-3.6.2.96 test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.6.2.90.beta test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.6.1.88 test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.6.1.87 test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.6.1.86.beta test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.6.1.85.beta test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.6.0.83 test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.6.0.78 test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.6.0.74.beta test/multiverse/suites/datamapper/encoding_test.rb