Sha256: 997d8cd8755353b8d12c03be31dd22cda2fea873f01b5a41edc6bed3c97b3ef4

Contents?: true

Size: 952 Bytes

Versions: 27

Compression:

Stored size: 952 Bytes

Contents

# 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

27 entries across 27 versions & 4 rubygems

Version Path
newrelic_rpm-3.5.4.34 test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.5.4.33 test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.5.4.31.beta test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.5.4.29.beta test/multiverse/suites/datamapper/encoding_test.rb
ghazel-newrelic_rpm-3.5.4 test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.5.3.25 test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.5.3.24 test/multiverse/suites/datamapper/encoding_test.rb