test-queue 0.1.2 → 0.1.3

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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- test-queue (0.1.1)
4
+ test-queue (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Yet another parallel test runner, built using a centralized queue to ensure
4
4
  optimal distribution of tests between workers.
5
5
 
6
- Specifially optimized for CI environments: build statistics from each run
6
+ Specifically optimized for CI environments: build statistics from each run
7
7
  are stored locally and used to sort the queue at the beginning of the
8
8
  next run.
9
9
 
@@ -11,7 +11,7 @@ next run.
11
11
 
12
12
  ```
13
13
  $ minitest-queue $(find test/ -name \*_test.rb)
14
- $ rspec-queue $(find spec/ -name \*_spec.rb)
14
+ $ rspec-queue --format progress spec
15
15
  ```
16
16
 
17
17
  ### design
@@ -1,5 +1,6 @@
1
1
  require 'test_queue/runner'
2
2
  require 'minitest/unit'
3
+ require 'stringio'
3
4
 
4
5
  class MiniTestQueueRunner < MiniTest::Unit
5
6
  def _run_suites(*)
@@ -60,7 +61,7 @@ module TestQueue
60
61
  num_tests = worker.lines.grep(/ errors?, /).first
61
62
  failures = worker.lines.select{ |line|
62
63
  line if (line =~ /^Finished/) ... (line =~ / errors?, /)
63
- }[1..-2].join("\n").strip
64
+ }[1..-2].join("\n")
64
65
 
65
66
  [ num_tests, failures ]
66
67
  end
@@ -0,0 +1,32 @@
1
+ require 'test_queue'
2
+ require 'puppet-lint'
3
+
4
+ module TestQueue
5
+ class Runner
6
+ class PuppetLint < Runner
7
+ def run_worker(iterator)
8
+ errors = 0
9
+ linter = PuppetLint.new
10
+ iterator.each do |file|
11
+ puts "Evaluating #{file}"
12
+ linter.file = file
13
+ linter.run
14
+ errors += 1 if linter.errors?
15
+ end
16
+ errors
17
+ end
18
+
19
+ def summarize_worker(worker)
20
+ lines = worker.lines
21
+
22
+ files = lines.select{ |line| line =~ /^Evaluating/ }
23
+ errors = lines.select{ |line| line =~ /^ERROR/ }
24
+ warnings = lines.select{ |line| line =~ /^WARNING/ }
25
+
26
+ summary = "#{files.size} files, #{warnings.size} warnings, #{errors.size} errors"
27
+
28
+ [summary, errors.join("\n")]
29
+ end
30
+ end
31
+ end
32
+ end
@@ -5,6 +5,8 @@ module RSpec::Core
5
5
  class QueueRunner < CommandLine
6
6
  def initialize
7
7
  super(ARGV)
8
+ @configuration.output_stream = $stdout
9
+ @configuration.error_stream = $stderr
8
10
  end
9
11
 
10
12
  def example_groups
@@ -15,9 +17,6 @@ module RSpec::Core
15
17
  end
16
18
 
17
19
  def run_each(iterator)
18
- @configuration.error_stream = $stderr
19
- @configuration.output_stream = $stdout
20
-
21
20
  @configuration.reporter.report(0, @configuration.randomize? ? @configuration.seed : nil) do |reporter|
22
21
  begin
23
22
  @configuration.run_hook(:before, :suite)
@@ -127,13 +127,15 @@ module TestQueue
127
127
 
128
128
  def spawn_workers
129
129
  @concurrency.times do |i|
130
+ num = i+1
131
+
130
132
  pid = fork do
131
133
  @server.close
132
- after_fork(i)
134
+ after_fork(num)
133
135
  exit! run_worker(iterator = Iterator.new(@socket)) || 0
134
136
  end
135
137
 
136
- @workers[pid] = Worker.new(pid, i)
138
+ @workers[pid] = Worker.new(pid, num)
137
139
  end
138
140
  end
139
141
 
data/test-queue.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'test-queue'
3
- s.version = '0.1.2'
3
+ s.version = '0.1.3'
4
4
  s.summary = 'parallel test runner'
5
5
 
6
6
  s.homepage = "http://github.com/tmm1/test-queue"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test-queue
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Aman Gupta
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-04-24 00:00:00 Z
18
+ date: 2013-04-29 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rspec
@@ -68,6 +68,7 @@ files:
68
68
  - lib/test_queue/iterator.rb
69
69
  - lib/test_queue/runner.rb
70
70
  - lib/test_queue/runner/minitest.rb
71
+ - lib/test_queue/runner/puppet_lint.rb
71
72
  - lib/test_queue/runner/rspec.rb
72
73
  - lib/test_queue/runner/sample.rb
73
74
  - test-queue.gemspec