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
wd_newrelic_rpm-3.5.8 test/multiverse/suites/datamapper/encoding_test.rb
sundawg_newrelic_rpm-3.5.8.2 test/multiverse/suites/datamapper/encoding_test.rb
sundawg_newrelic_rpm-3.5.8.1 test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.5.8.72 test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.5.8.70 test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.5.8.64.beta test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.5.7.59 test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.5.7.59.beta test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.5.7.58.beta test/multiverse/suites/datamapper/encoding_test.rb
wd_newrelic_rpm-3.5.6 test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.5.7.57.beta test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.5.6.55 test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.5.6.48.beta test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.5.6.46.beta test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.5.6.42.beta test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.5.5.39.beta test/multiverse/suites/datamapper/encoding_test.rb
wd_newrelic_rpm-3.5.5 test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.5.5.38 test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.5.5.540.dev test/multiverse/suites/datamapper/encoding_test.rb
newrelic_rpm-3.5.4.35.beta test/multiverse/suites/datamapper/encoding_test.rb