parallel_tests 2.7.1 → 2.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Readme.md +8 -1
- data/lib/parallel_tests.rb +8 -0
- 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: b5d0e976a9335dfebb55d5a1168434a4adc7da16
|
4
|
+
data.tar.gz: 0c61ae3cba5629f99408ed1a75e46696621cfc1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04522c32d2995f52b1c29ee9acd0bad2324472149b339487d7e42c8ad78490011bed83e90555c376ddab86a4a3bed3cc85fc0cdd02704a9283aa6acefbc779c4
|
7
|
+
data.tar.gz: 22dbaeba6334af7a004d1218753118dcb1c66d4c96f8a996bebd397211f038e4f551dcaa5c29b4272cb36626b005bb6a370fab845001c9c47bf05668dc109e7f
|
data/Readme.md
CHANGED
@@ -80,16 +80,22 @@ Running things once
|
|
80
80
|
===================
|
81
81
|
|
82
82
|
```Ruby
|
83
|
-
#
|
83
|
+
# preparation:
|
84
|
+
# affected by race-condition: first process may boot slower than the second
|
84
85
|
# either sleep a bit or use a lock for example File.lock
|
85
86
|
ParallelTests.first_process? ? do_something : sleep(1)
|
86
87
|
|
88
|
+
# cleanup:
|
89
|
+
# last_process? does NOT mean last finished process, just last started
|
90
|
+
ParallelTests.last_process? ? do_something : sleep(1)
|
91
|
+
|
87
92
|
at_exit do
|
88
93
|
if ParallelTests.first_process?
|
89
94
|
ParallelTests.wait_for_other_processes_to_finish
|
90
95
|
undo_something
|
91
96
|
end
|
92
97
|
end
|
98
|
+
|
93
99
|
```
|
94
100
|
|
95
101
|
Loggers
|
@@ -352,6 +358,7 @@ inspired by [pivotal labs](https://blog.pivotal.io/labs/labs/parallelize-your-rs
|
|
352
358
|
- [Lukas Oberhuber](https://github.com/lukaso)
|
353
359
|
- [Ryan Zhang](https://github.com/ryanus)
|
354
360
|
- [Rhett Sutphin](https://github.com/rsutphin)
|
361
|
+
- [Doc Ritezel](https://github.com/ohrite)
|
355
362
|
|
356
363
|
|
357
364
|
[Michael Grosser](http://grosser.it)<br/>
|
data/lib/parallel_tests.rb
CHANGED
@@ -44,6 +44,14 @@ module ParallelTests
|
|
44
44
|
ENV["TEST_ENV_NUMBER"].to_i <= 1
|
45
45
|
end
|
46
46
|
|
47
|
+
def last_process?
|
48
|
+
current_process_number = ENV['TEST_ENV_NUMBER']
|
49
|
+
total_processes = ENV['PARALLEL_TEST_GROUPS']
|
50
|
+
return true if current_process_number.nil? && total_processes.nil?
|
51
|
+
current_process_number = '1' if current_process_number.nil?
|
52
|
+
current_process_number == total_processes
|
53
|
+
end
|
54
|
+
|
47
55
|
def parent_pid
|
48
56
|
if WINDOWS
|
49
57
|
`wmic process where (processid=#{Process.pid}) get parentprocessid`
|
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: 2.
|
4
|
+
version: 2.8.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: 2016-
|
11
|
+
date: 2016-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|