parallel_tests 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Readme.md +2 -3
- data/lib/parallel_tests/tasks.rb +14 -10
- data/lib/parallel_tests/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 6166c52e0a3ff7792276b9d0fa8cd315ce7d96a0
         | 
| 4 | 
            +
              data.tar.gz: 845cea1451521dc0a49bef50cbc0f2728d2c4aa4
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: f0843a156098ba9e57ae8457376c8745591dfdaa013354719ef3123451934c551c8bd4c5d2310e23b05b9ae4b43405782706b23d40fe2b54c09edfeb2cdcfb91
         | 
| 7 | 
            +
              data.tar.gz: 02523dd42600f12708f87abedb53aa5c9f5ff48a7503f9af3bc4fc1710a993be1efb4390c67f4a2daae415daff67187b779b869e9c9241c5bcd9895f30a2d6a6
         | 
    
        data/Readme.md
    CHANGED
    
    | @@ -9,7 +9,7 @@ Setup for Rails | |
| 9 9 |  | 
| 10 10 | 
             
            ```ruby
         | 
| 11 11 | 
             
            # Gemfile
         | 
| 12 | 
            -
            gem "parallel_tests", : | 
| 12 | 
            +
            gem "parallel_tests", group: :development
         | 
| 13 13 | 
             
            ```
         | 
| 14 14 |  | 
| 15 15 | 
             
            ### Add to `config/database.yml`
         | 
| @@ -17,7 +17,7 @@ gem "parallel_tests", :group => :development | |
| 17 17 | 
             
            ParallelTests uses 1 database per test-process.
         | 
| 18 18 | 
             
            <table>
         | 
| 19 19 | 
             
              <tr><td>Process number</td><td>1</td><td>2</td><td>3</td></tr>
         | 
| 20 | 
            -
              <tr><td | 
| 20 | 
            +
              <tr><td>ENV['TEST_ENV_NUMBER']</td><td>''</td><td>'2'</td><td>'3'</td></tr>
         | 
| 21 21 | 
             
            </table>
         | 
| 22 22 |  | 
| 23 23 | 
             
            ```yaml
         | 
| @@ -240,7 +240,6 @@ TIPS | |
| 240 240 | 
             
            TODO
         | 
| 241 241 | 
             
            ====
         | 
| 242 242 | 
             
             - fix tests vs cucumber >= 1.2 `unknown option --format`
         | 
| 243 | 
            -
             - add integration tests for the rake tasks, maybe generate a rails project ...
         | 
| 244 243 | 
             
             - add unit tests for cucumber runtime formatter
         | 
| 245 244 | 
             
             - make windows compatible
         | 
| 246 245 |  | 
    
        data/lib/parallel_tests/tasks.rb
    CHANGED
    
    | @@ -7,6 +7,10 @@ module ParallelTests | |
| 7 7 | 
             
                    ENV['RAILS_ENV'] || 'test'
         | 
| 8 8 | 
             
                  end
         | 
| 9 9 |  | 
| 10 | 
            +
                  def purge_before_load
         | 
| 11 | 
            +
                    "db:test:purge" if Gem::Version.new(Rails.version) > Gem::Version.new('4.2.0')
         | 
| 12 | 
            +
                  end
         | 
| 13 | 
            +
             | 
| 10 14 | 
             
                  def run_in_parallel(cmd, options={})
         | 
| 11 15 | 
             
                    count = " -n #{options[:count]}" unless options[:count].to_s.empty?
         | 
| 12 16 | 
             
                    executable = File.expand_path("../../../bin/parallel_test", __FILE__)
         | 
| @@ -69,17 +73,17 @@ end | |
| 69 73 |  | 
| 70 74 | 
             
            namespace :parallel do
         | 
| 71 75 | 
             
              desc "create test databases via db:create --> parallel:create[num_cpus]"
         | 
| 72 | 
            -
              task :create, :count do | | 
| 76 | 
            +
              task :create, :count do |_,args|
         | 
| 73 77 | 
             
                ParallelTests::Tasks.run_in_parallel("rake db:create RAILS_ENV=#{ParallelTests::Tasks.rails_env}", args)
         | 
| 74 78 | 
             
              end
         | 
| 75 79 |  | 
| 76 80 | 
             
              desc "drop test databases via db:drop --> parallel:drop[num_cpus]"
         | 
| 77 | 
            -
              task :drop, :count do | | 
| 81 | 
            +
              task :drop, :count do |_,args|
         | 
| 78 82 | 
             
                ParallelTests::Tasks.run_in_parallel("rake db:drop RAILS_ENV=#{ParallelTests::Tasks.rails_env}", args)
         | 
| 79 83 | 
             
              end
         | 
| 80 84 |  | 
| 81 85 | 
             
              desc "update test databases by dumping and loading --> parallel:prepare[num_cpus]"
         | 
| 82 | 
            -
              task(:prepare, [:count]) do | | 
| 86 | 
            +
              task(:prepare, [:count]) do |_,args|
         | 
| 83 87 | 
             
                ParallelTests::Tasks.check_for_pending_migrations
         | 
| 84 88 | 
             
                if defined?(ActiveRecord) && ActiveRecord::Base.schema_format == :ruby
         | 
| 85 89 | 
             
                  # dump then load in parallel
         | 
| @@ -95,30 +99,30 @@ namespace :parallel do | |
| 95 99 |  | 
| 96 100 | 
             
              # when dumping/resetting takes too long
         | 
| 97 101 | 
             
              desc "update test databases via db:migrate --> parallel:migrate[num_cpus]"
         | 
| 98 | 
            -
              task :migrate, :count do | | 
| 102 | 
            +
              task :migrate, :count do |_,args|
         | 
| 99 103 | 
             
                ParallelTests::Tasks.run_in_parallel("rake db:migrate RAILS_ENV=#{ParallelTests::Tasks.rails_env}", args)
         | 
| 100 104 | 
             
              end
         | 
| 101 105 |  | 
| 102 106 | 
             
              # just load the schema (good for integration server <-> no development db)
         | 
| 103 107 | 
             
              desc "load dumped schema for test databases via db:schema:load --> parallel:load_schema[num_cpus]"
         | 
| 104 | 
            -
              task :load_schema, :count do | | 
| 105 | 
            -
                command = "rake  | 
| 108 | 
            +
              task :load_schema, :count do |_,args|
         | 
| 109 | 
            +
                command = "rake #{ParallelTests::Tasks.purge_before_load} db:schema:load RAILS_ENV=#{ParallelTests::Tasks.rails_env}"
         | 
| 106 110 | 
             
                ParallelTests::Tasks.run_in_parallel(ParallelTests::Tasks.suppress_output(command, "^   ->\\|^-- "), args)
         | 
| 107 111 | 
             
              end
         | 
| 108 112 |  | 
| 109 113 | 
             
              # load the structure from the structure.sql file
         | 
| 110 114 | 
             
              desc "load structure for test databases via db:structure:load --> parallel:load_structure[num_cpus]"
         | 
| 111 | 
            -
              task :load_structure, :count do | | 
| 112 | 
            -
                ParallelTests::Tasks.run_in_parallel("rake db:structure:load RAILS_ENV=#{ParallelTests::Tasks.rails_env}", args)
         | 
| 115 | 
            +
              task :load_structure, :count do |_,args|
         | 
| 116 | 
            +
                ParallelTests::Tasks.run_in_parallel("rake #{ParallelTests::Tasks.purge_before_load} db:structure:load RAILS_ENV=#{ParallelTests::Tasks.rails_env}", args)
         | 
| 113 117 | 
             
              end
         | 
| 114 118 |  | 
| 115 119 | 
             
              desc "load the seed data from db/seeds.rb via db:seed --> parallel:seed[num_cpus]"
         | 
| 116 | 
            -
              task :seed, :count do | | 
| 120 | 
            +
              task :seed, :count do |_,args|
         | 
| 117 121 | 
             
                ParallelTests::Tasks.run_in_parallel("rake db:seed RAILS_ENV=#{ParallelTests::Tasks.rails_env}", args)
         | 
| 118 122 | 
             
              end
         | 
| 119 123 |  | 
| 120 124 | 
             
              desc "launch given rake command in parallel"
         | 
| 121 | 
            -
              task :rake, :command do | | 
| 125 | 
            +
              task :rake, :command do |_, args|
         | 
| 122 126 | 
             
                ParallelTests::Tasks.run_in_parallel("RAILS_ENV=#{ParallelTests::Tasks.rails_env} rake #{args.command}")
         | 
| 123 127 | 
             
              end
         | 
| 124 128 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: parallel_tests
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.5. | 
| 4 | 
            +
              version: 1.5.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Michael Grosser
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2015-06- | 
| 11 | 
            +
            date: 2015-06-26 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: parallel
         |