[DRE-commits] [ruby-mongo] 02/05: Refresh patch enable_run_tests.patch

Prach Pongpanich prach-guest at moszumanska.debian.org
Thu May 15 06:36:04 UTC 2014


This is an automated email from the git hooks/post-receive script.

prach-guest pushed a commit to branch master
in repository ruby-mongo.

commit 08be234ebdce26a43b8f094a800158d568bb212c
Author: Prach Pongpanich <prachpub at gmail.com>
Date:   Thu May 15 13:09:24 2014 +0700

    Refresh patch enable_run_tests.patch
---
 debian/patches/enable_run_tests.patch | 191 +++++++++++++++++-----------------
 1 file changed, 96 insertions(+), 95 deletions(-)

diff --git a/debian/patches/enable_run_tests.patch b/debian/patches/enable_run_tests.patch
index 953fd42..d42f2df 100644
--- a/debian/patches/enable_run_tests.patch
+++ b/debian/patches/enable_run_tests.patch
@@ -1,134 +1,135 @@
 Description: for enable run tests at build time
 Author: Prach Pongpanich <prachpub at gmail.com>
-
---- a/test/test_helper.rb
-+++ b/test/test_helper.rb
-@@ -19,116 +19,10 @@ rescue LoadError
-   # failed to load, skipping pry
- end
+Forwarded: no
+Last-Updated: 2014-05-15
+--- a/test/helpers/test_unit.rb
++++ b/test/helpers/test_unit.rb
+@@ -29,54 +29,6 @@ class Test::Unit::TestCase
+   include Mongo
+   include BSON
  
--# 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'
--
--class Test::Unit::TestCase
--
--  TEST_DATA = File.join(File.dirname(__FILE__), 'fixtures/data')
--
+-  # Handles creating a pre-defined MongoDB cluster for integration testing.
+-  #
+-  # @param  kind=nil [Symbol] Type of cluster (:rs or :sc).
+-  # @param  opts={} [Hash] Options to be passed through to the cluster manager.
+-  #
+-  # @return [ClusterManager] The cluster manager instance being used.
 -  def ensure_cluster(kind=nil, opts={})
--    @@cluster ||= nil
+-    cluster_instance = nil
+-    class_vars = TEST_BASE.class_eval { class_variables }
+-    if class_vars.include?("@@cluster_#{kind}") || class_vars.include?("@@cluster_#{kind}".to_sym)
+-      cluster_instance = TEST_BASE.class_eval { class_variable_get("@@cluster_#{kind}") }
+-    end
 -
--    unless @@cluster
+-    unless cluster_instance
 -      if kind == :rs
--        cluster_opts = Mongo::Config::DEFAULT_REPLICA_SET.dup
+-        cluster_opts = Config::DEFAULT_REPLICA_SET.dup
 -      else
--        cluster_opts = Mongo::Config::DEFAULT_SHARDED_SIMPLE.dup
+-        cluster_opts = Config::DEFAULT_SHARDED_SIMPLE.dup
 -      end
 -
 -      cluster_opts.merge!(opts)
+-      cluster_opts.merge!(:dbpath => ENV['MONGO_DBPATH'] || 'data')
+-      config = Config.cluster(cluster_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
+-      cluster_instance = Config::ClusterManager.new(config)
+-      TEST_BASE.class_eval { class_variable_set("@@cluster_#{kind}", cluster_instance) }
 -    end
 -
--    @@cluster.start
--    instance_variable_set("@#{kind}", @@cluster)
+-    cluster_instance.start
+-    instance_variable_set("@#{kind}", cluster_instance)
 -  end
 -
--  # Generic code for rescuing connection failures and retrying operations.
--  # This could be combined with some timeout functionality.
+-  # Generic helper to rescue and retry from a connection failure.
+-  #
+-  # @param max_retries=30 [Integer] The number of times to attempt a retry.
+-  #
+-  # @return [Object] The block result.
 -  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
+ 
+   # Creates and connects a standard, pre-defined MongoClient instance.
+   #
+@@ -310,8 +262,8 @@ end
+ 
+ # Before and after hooks for the entire test run
+ # handles mop up after the cluster manager is done.
+-Test::Unit.at_exit do
+-  TEST_BASE.class_eval { class_variables }.select { |v| v =~ /@@cluster_/ }.each do |cluster|
+-    TEST_BASE.class_eval { class_variable_get(cluster) }.stop
 -  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'
++#Test::Unit.at_exit do
++#  TEST_BASE.class_eval { class_variables }.select { |v| v =~ /@@cluster_/ }.each do |cluster|
++#    TEST_BASE.class_eval { class_variable_get(cluster) }.stop
++#  end
++#end
+--- a/test/test_helper.rb
++++ b/test/test_helper.rb
+@@ -14,27 +14,27 @@
+ 
+ # NOTE: on ruby <1.9 you need to run individual tests with 'bundle exec'
+ 
+-unless RUBY_VERSION < '1.9' || ENV.key?('JENKINS_CI')
+-  require 'simplecov'
+-  require 'coveralls'
+-
+-  SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
+-    SimpleCov::Formatter::HTMLFormatter,
+-    Coveralls::SimpleCov::Formatter
+-  ]
+-
+-  SimpleCov.start do
+-    add_group 'Driver', 'lib/mongo'
+-    add_group 'BSON', 'lib/bson'
+-
+-    add_filter 'tasks'
+-    add_filter 'test'
+-    add_filter 'bin'
+-  end
 -end
-+require 'shoulda'
-+require 'mocha/setup'
++#unless RUBY_VERSION < '1.9' || ENV.key?('JENKINS_CI')
++#  require 'simplecov'
++#  require 'coveralls'
++
++#  SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
++#    SimpleCov::Formatter::HTMLFormatter,
++#    Coveralls::SimpleCov::Formatter
++#  ]
++
++#  SimpleCov.start do
++#    add_group 'Driver', 'lib/mongo'
++#    add_group 'BSON', 'lib/bson'
++
++#    add_filter 'tasks'
++#    add_filter 'test'
++#    add_filter 'bin'
++#  end
++#end
  
- class Test::Unit::TestCase
-   include Mongo
+ # required for at_exit, at_start hooks
+-require 'test-unit'
++#require 'test-unit'
+ 
+ require 'test/unit'
+ require 'shoulda'
 --- a/test/tools/mongo_config.rb
 +++ b/test/tools/mongo_config.rb
-@@ -17,7 +17,6 @@
+@@ -17,7 +17,7 @@
  require 'socket'
  require 'fileutils'
  require 'mongo'
 -require 'sfl'
++#require 'sfl'
  
  $debug_level = 2
  STDOUT.sync = true

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-mongo.git



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