parallel_tests 1.8.0 → 1.9.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b98743db0fe97926ab98d0806cee0e82c1accf85
4
- data.tar.gz: 74cd35a0d5771dde97914a0ef39b9ccefaf1c065
3
+ metadata.gz: 4fb10aac687b9a04a4407bfc4fe1e30c5f08ea48
4
+ data.tar.gz: d931c14e1a5d0a1464ae6d25f5be2d35f104980f
5
5
  SHA512:
6
- metadata.gz: f30e2061fd6622d0013593855775c0e129e64a73bfec5d95ebb1270ac1bfcbd2d6d53305442ba201eb6dea6bd69d02cf8890b011069f7d2057cb12ef75bdfb30
7
- data.tar.gz: fbbcb2dc6d59f94b86d002cbd9dd7a2353c084bd1764665b337ec9c8de6fe4d2d056fa1b98a743c0834a73c7212cd5609cca97362cb62e94789ec064bb5f11f6
6
+ metadata.gz: cd851e63b561992a2115875ae3155172d2efc7ead6469ee1cc2d9c91360ef3238394615e2d92168592b408a53403edd2a2c6885261d4c66eb57ccea5fcd59063
7
+ data.tar.gz: 498a0035ed38fa887740a7229ccee841b689027544ac88d4db74c511fb58df4d504a76fe7d4add0414f2476fd5ca0e4eda9fd50b12da327cc38e7fd09988995b
data/Readme.md CHANGED
@@ -325,6 +325,7 @@ inspired by [pivotal labs](http://pivotallabs.com/users/miked/blog/articles/849-
325
325
  - [Ed Slocomb](https://github.com/edslocomb)
326
326
  - [Cezary Baginski](https://github.com/e2)
327
327
  - [Marius Ioana](https://github.com/mariusioana)
328
+ - [Lukas Oberhuber](https://github.com/lukaso)
328
329
 
329
330
 
330
331
  [Michael Grosser](http://grosser.it)<br/>
@@ -59,7 +59,7 @@ module ParallelTests
59
59
 
60
60
  def run_tests(group, process_number, num_processes, options)
61
61
  if group.empty?
62
- {:stdout => '', :exit_status => 0}
62
+ {:stdout => '', :exit_status => 0, :command => '', :seed => nil}
63
63
  else
64
64
  @runner.run_tests(group, process_number, num_processes, options)
65
65
  end
@@ -88,6 +88,20 @@ module ParallelTests
88
88
  results = @runner.find_results(test_results.map { |result| result[:stdout] }*"")
89
89
  puts ""
90
90
  puts @runner.summarize_results(results)
91
+ report_failure_rerun_commmand(test_results)
92
+ end
93
+
94
+ def report_failure_rerun_commmand(test_results)
95
+ failing_sets = test_results.reject { |r| r[:exit_status] == 0 }
96
+ return if failing_sets.none?
97
+
98
+ puts "\n\nTests have failed for a parallel_test group. Use the following command to run the group again:\n\n"
99
+ failing_sets.each do |failing_set|
100
+ command = failing_set[:command]
101
+ command = command.gsub(/;export [A-Z_]+;/, ' ') # remove ugly export statements
102
+ command = @runner.command_with_seed(command, failing_set[:seed]) if failing_set[:seed]
103
+ puts command
104
+ end
91
105
  end
92
106
 
93
107
  def report_number_of_tests(groups)
@@ -26,6 +26,11 @@ module ParallelTests
26
26
  output.join("\n\n")
27
27
  end
28
28
 
29
+ def command_with_seed(cmd, seed)
30
+ cmd = cmd.sub(/\s--order random(:\d*)?/, '')
31
+ "#{cmd} --order random:#{seed}"
32
+ end
33
+
29
34
  private
30
35
 
31
36
  def failing_scenario_regex
@@ -95,8 +95,9 @@ module ParallelTests
95
95
 
96
96
  output = open("|#{cmd}", "r") { |output| capture_output(output, silence) }
97
97
  exitstatus = $?.exitstatus
98
+ seed = output[/seed (\d+)/,1]
98
99
 
99
- {:stdout => output, :exit_status => exitstatus}
100
+ {:stdout => output, :exit_status => exitstatus, :command => cmd, :seed => seed}
100
101
  end
101
102
 
102
103
  def find_results(test_output)
@@ -116,6 +117,12 @@ module ParallelTests
116
117
  sums.sort.map{|word, number| "#{number} #{word}#{'s' if number != 1}" }.join(', ')
117
118
  end
118
119
 
120
+ def command_with_seed(cmd, seed)
121
+ cmd = cmd.sub(/\s--seed(\s\d*){0,1}/, '')
122
+ cmd = cmd.sub(/\s--order rand(:\d*){0,1}/, '')
123
+ "#{cmd} --seed #{seed}"
124
+ end
125
+
119
126
  protected
120
127
 
121
128
  def executable
@@ -1,3 +1,3 @@
1
1
  module ParallelTests
2
- VERSION = Version = '1.8.0'
2
+ VERSION = Version = '1.9.0'
3
3
  end
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.8.0
4
+ version: 1.9.0
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-10-01 00:00:00.000000000 Z
11
+ date: 2015-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel