[DRE-commits] [SCM] ruby-mongo.git branch, master, updated. upstream/1.8.5-13-g784f8f9

Prach Pongpanich prachpub at gmail.com
Sun Apr 21 19:41:54 UTC 2013


The following commit has been merged in the master branch:
commit 784f8f9eec86e08f5547bd893728eb01c001e257
Author: Prach Pongpanich <prachpub at gmail.com>
Date:   Mon Apr 22 02:39:25 2013 +0700

    enable run tests at build time

diff --git a/debian/control b/debian/control
index 187e0c2..ada655b 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,9 @@ Build-Depends:
  debhelper (>= 7.0.50~),
  gem2deb (>= 0.3.0~),
  ruby-bson (>= 1.8.5),
- ruby-bson-ext (>=1.8.5)
+ ruby-bson-ext (>=1.8.5),
+ ruby-mocha (>= 0.13.3),
+ ruby-shoulda
 Standards-Version: 3.9.4
 Vcs-Git: git://anonscm.debian.org/pkg-ruby-extras/ruby-mongo.git
 Vcs-Browser: http://anonscm.debian.org/gitweb?p=pkg-ruby-extras/ruby-mongo.git;a=summary
diff --git a/debian/patches/enable_run_tests.patch b/debian/patches/enable_run_tests.patch
new file mode 100644
index 0000000..2d53110
--- /dev/null
+++ b/debian/patches/enable_run_tests.patch
@@ -0,0 +1,133 @@
+Description: for enable run tests at build time
+Author: Prach Pongpanich <prachpub at gmail.com>
+
+--- ruby-mongo-1.8.5.orig/test/test_helper.rb
++++ ruby-mongo-1.8.5/test/test_helper.rb
+@@ -1,114 +1,8 @@
+-require 'rubygems'
+-# SimpleCov must load before our code - A coverage report summary line will print after each test suite
+-if RUBY_VERSION >= '1.9.0' && RUBY_ENGINE == 'ruby'
+-  if ENV.key?('COVERAGE')
+-    require 'simplecov'
+-    SimpleCov.start do
+-      add_group "Mongo", 'lib/mongo'
+-      add_group "BSON", 'lib/bson'
+-      add_filter "/test/"
+-      merge_timeout 3600
+-      command_name ENV['SIMPLECOV_COMMAND_NAME'] if ENV.has_key?('SIMPLECOV_COMMAND_NAME')
+-    end
+-  end
+-end
+-gem 'test-unit' # Do NOT remove this line - gem version is needed for Test::Unit::TestCase.shutdown
+ require 'test/unit'
+ require 'tools/mongo_config'
++require 'shoulda'
++require 'mocha'
+ 
+-class Test::Unit::TestCase
+-
+-  TEST_DATA = File.join(File.dirname(__FILE__), 'data')
+-
+-  def ensure_cluster(kind=nil, opts={})
+-    @@cluster ||= nil
+-
+-    unless @@cluster
+-      if kind == :rs
+-        cluster_opts = Mongo::Config::DEFAULT_REPLICA_SET.dup
+-      else
+-        cluster_opts = Mongo::Config::DEFAULT_SHARDED_SIMPLE.dup
+-      end
+-
+-      cluster_opts.merge!(opts)
+-
+-      dbpath = ENV['DBPATH'] || 'data'
+-      cluster_opts.merge!(:dbpath => dbpath)
+-
+-      #debug 1, opts
+-      config = Mongo::Config.cluster(cluster_opts)
+-      #debug 1, config
+-      @@cluster = Mongo::Config::ClusterManager.new(config)
+-
+-      Test::Unit::TestCase.class_eval do
+-        @@force_shutdown = false
+-
+-        def self.shutdown
+-          if @@force_shutdown || /rake_test_loader/ !~ $0
+-            @@cluster.stop
+-            @@cluster.clobber
+-          end
+-        end
+-      end
+-    end
+-
+-    @@cluster.start
+-    instance_variable_set("@#{kind}", @@cluster)
+-  end
+-
+-  # Generic code for rescuing connection failures and retrying operations.
+-  # This could be combined with some timeout functionality.
+-  def rescue_connection_failure(max_retries=30)
+-    retries = 0
+-    begin
+-      yield
+-    rescue Mongo::ConnectionFailure => ex
+-      #puts "Rescue attempt #{retries}: from #{ex}"
+-      retries += 1
+-      raise ex if retries > max_retries
+-      sleep(2)
+-      retry
+-    end
+-  end
+-end
+-
+-def silently
+-  warn_level = $VERBOSE
+-  $VERBOSE = nil
+-  begin
+-    result = yield
+-  ensure
+-    $VERBOSE = warn_level
+-  end
+-  result
+-end
+-
+-begin
+-  silently { require 'shoulda' }
+-  silently { require 'mocha/setup' }
+-rescue LoadError
+-  puts <<MSG
+-
+-This test suite requires shoulda and mocha.
+-You can install them as follows:
+-  gem install shoulda
+-  gem install mocha
+-
+-MSG
+-  exit
+-end
+-
+-unless defined? MONGO_TEST_DB
+-  MONGO_TEST_DB = 'ruby-test-db'
+-end
+-
+-unless defined? TEST_PORT
+-  TEST_PORT = ENV['MONGO_RUBY_DRIVER_PORT'] ? ENV['MONGO_RUBY_DRIVER_PORT'].to_i : Mongo::MongoClient::DEFAULT_PORT
+-end
+-
+-unless defined? TEST_HOST
+-  TEST_HOST = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
+-end
+ 
+ class Test::Unit::TestCase
+   include Mongo
+--- ruby-mongo-1.8.5.orig/test/tools/mongo_config.rb
++++ ruby-mongo-1.8.5/test/tools/mongo_config.rb
+@@ -2,7 +2,7 @@
+ require 'socket'
+ require 'fileutils'
+ require 'mongo'
+-require 'sfl'
++#require 'sfl'
+ 
+ $debug_level = 2
+ STDOUT.sync = true
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..86c426c
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+enable_run_tests.patch

-- 
ruby-mongo.git



More information about the Pkg-ruby-extras-commits mailing list