semaphore_test_boosters 1.7.2 → 1.7.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.
- checksums.yaml +4 -4
- data/config.reek +1 -48
- data/lib/test_boosters/cli_parser.rb +2 -0
- data/lib/test_boosters/cucumber/booster.rb +5 -5
- data/lib/test_boosters/leftover_files.rb +28 -18
- data/lib/test_boosters/rspec/booster.rb +5 -5
- data/lib/test_boosters/version.rb +1 -1
- metadata +2 -10
- data/test_data/a.feature +0 -1
- data/test_data/a_spec.rb +0 -1
- data/test_data/b.feature +0 -1
- data/test_data/b_spec.rb +0 -1
- data/test_data/c.feature +0 -1
- data/test_data/c_spec.rb +0 -1
- data/test_data_fail/fail_spec.rb +0 -7
- data/test_data_pass/pass_spec.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55ecf357e070533847ba7fc22764a026d0ec2918
|
4
|
+
data.tar.gz: 52e0d4afb19f129f079378600b871bb0c47e9d4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecb7d0fb08e4a94de4bc17d9adefe2b2694185666b0c16fa0b4c0fcee4483c5f2de5b484646ea8f83448a5647b38b89e074648080fba0bec43e2160630541e31
|
7
|
+
data.tar.gz: 866a3b4b308094b0f3ffb1d9593f6595ed74ba5683c191178f8738915f00fddccd21e41c30fcfa7f55955a35e0de38cead7218eb14420d5d886d9d1eb9bd3270
|
data/config.reek
CHANGED
@@ -2,61 +2,14 @@
|
|
2
2
|
IrresponsibleModule:
|
3
3
|
enabled: false
|
4
4
|
|
5
|
-
NestedIterators:
|
6
|
-
exclude:
|
7
|
-
- TestBoosters::CliParser#parse
|
8
|
-
- TestBoosters::LeftoverFiles#select
|
9
|
-
|
10
|
-
TooManyStatements:
|
11
|
-
exclude:
|
12
|
-
- initialize
|
13
|
-
- TestBoosters::CliParser#parse
|
14
|
-
- TestBoosters::CucumberBooster#run
|
15
|
-
- TestBoosters::CucumberBooster#select
|
16
|
-
- TestBoosters::CucumberBooster#with_fallback
|
17
|
-
- TestBoosters::LeftoverFiles#select
|
18
|
-
- TestBoosters::RspecBooster#run
|
19
|
-
- TestBoosters::RspecBooster#run_command
|
20
|
-
- TestBoosters::RspecBooster#select
|
21
|
-
- TestBoosters::RspecBooster#with_fallback
|
22
|
-
|
23
|
-
UncommunicativeVariableName:
|
24
|
-
exclude:
|
25
|
-
- TestBoosters::CucumberBooster#with_fallback
|
26
|
-
- TestBoosters::LeftoverFiles#select
|
27
|
-
- TestBoosters::LeftoverFiles#sort_descending_by_size
|
28
|
-
- TestBoosters::RspecBooster#run
|
29
|
-
- TestBoosters::RspecBooster#with_fallback
|
30
|
-
|
31
5
|
FeatureEnvy:
|
32
6
|
enabled: false
|
33
7
|
|
34
8
|
ControlParameter:
|
35
9
|
enabled: false
|
36
10
|
|
37
|
-
NilCheck:
|
38
|
-
exclude:
|
39
|
-
- TestBoosters::LeftoverFiles#select
|
40
|
-
|
41
|
-
UncommunicativeMethodName:
|
42
|
-
exclude:
|
43
|
-
- a
|
44
|
-
- b
|
45
|
-
- c
|
46
|
-
- Setup#a
|
47
|
-
- Setup#b
|
48
|
-
- Setup#c
|
49
|
-
- Setup::Cucumber#a
|
50
|
-
- Setup::Cucumber#b
|
51
|
-
- Setup::Cucumber#c
|
52
|
-
|
53
11
|
UtilityFunction:
|
54
|
-
|
55
|
-
- a
|
56
|
-
- b
|
57
|
-
- c
|
58
|
-
- expected_specs
|
59
|
-
- input_specs
|
12
|
+
enabled: false
|
60
13
|
|
61
14
|
exclude_paths:
|
62
15
|
- vendor
|
@@ -27,10 +27,10 @@ module TestBoosters
|
|
27
27
|
|
28
28
|
def threads
|
29
29
|
@threads ||= Array.new(@thread_count) do |thread_index|
|
30
|
-
|
31
|
-
|
30
|
+
known = all_specs & split_configuration.files_for_thread(thread_index)
|
31
|
+
leftover = leftover_specs.select(:index => thread_index, :total => thread_count)
|
32
32
|
|
33
|
-
TestBoosters::Cucumber::Thread.new(
|
33
|
+
TestBoosters::Cucumber::Thread.new(known, leftover)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -38,8 +38,8 @@ module TestBoosters
|
|
38
38
|
@all_specs ||= Dir["#{specs_path}/**/*.feature"].sort
|
39
39
|
end
|
40
40
|
|
41
|
-
def
|
42
|
-
@
|
41
|
+
def leftover_specs
|
42
|
+
@leftover_specs ||= TestBoosters::LeftoverFiles.new(all_specs - split_configuration.all_files)
|
43
43
|
end
|
44
44
|
|
45
45
|
def split_configuration
|
@@ -1,29 +1,39 @@
|
|
1
1
|
module TestBoosters
|
2
|
-
|
3
|
-
module_function
|
2
|
+
class LeftoverFiles
|
4
3
|
|
5
|
-
|
6
|
-
all_leftover_files = sort_descending_by_size(all_leftover_files)
|
4
|
+
attr_reader :files
|
7
5
|
|
8
|
-
|
6
|
+
def initialize(files)
|
7
|
+
@files = files
|
8
|
+
end
|
9
|
+
|
10
|
+
def select(options = {})
|
11
|
+
index = options.fetch(:index)
|
12
|
+
total = options.fetch(:total)
|
13
|
+
|
14
|
+
file_distribution(total)[index]
|
15
|
+
end
|
9
16
|
|
10
|
-
|
11
|
-
.each_slice(thread_count)
|
12
|
-
.reduce { |acc, slice| acc.map { |a| a }.zip(slice.reverse) }
|
13
|
-
.map { |f| f.is_a?(Array) ? f.flatten : [f] } [thread_index]
|
17
|
+
private
|
14
18
|
|
15
|
-
|
16
|
-
|
19
|
+
def file_distribution(thread_count)
|
20
|
+
# create N empty boxes
|
21
|
+
threads = Array.new(thread_count) { [] }
|
22
|
+
|
23
|
+
# distribute files in Round Robin fashion
|
24
|
+
sorted_files_by_file_size.each.with_index do |file, index|
|
25
|
+
threads[index % thread_count] << file
|
17
26
|
end
|
27
|
+
|
28
|
+
threads
|
29
|
+
end
|
30
|
+
|
31
|
+
def sorted_files_by_file_size
|
32
|
+
@sorted_files_by_file_size ||= existing_files.sort_by { |file| -File.size(file) }
|
18
33
|
end
|
19
34
|
|
20
|
-
def
|
21
|
-
files
|
22
|
-
.select { |f| File.file?(f) }
|
23
|
-
.map { |f| [f, File.size(f)] }
|
24
|
-
.sort_by { |a| a[1] }
|
25
|
-
.map { |a| a[0] }
|
26
|
-
.reverse
|
35
|
+
def existing_files
|
36
|
+
@existing_files ||= @files.select { |file| File.file?(file) }
|
27
37
|
end
|
28
38
|
|
29
39
|
end
|
@@ -27,10 +27,10 @@ module TestBoosters
|
|
27
27
|
|
28
28
|
def threads
|
29
29
|
@threads ||= Array.new(@thread_count) do |thread_index|
|
30
|
-
|
31
|
-
|
30
|
+
known = all_specs & split_configuration.files_for_thread(thread_index)
|
31
|
+
leftover = leftover_specs.select(:index => thread_index, :total => thread_count)
|
32
32
|
|
33
|
-
TestBoosters::Rspec::Thread.new(
|
33
|
+
TestBoosters::Rspec::Thread.new(known, leftover)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -38,8 +38,8 @@ module TestBoosters
|
|
38
38
|
@all_specs ||= Dir["#{specs_path}/**/*_spec.rb"].sort
|
39
39
|
end
|
40
40
|
|
41
|
-
def
|
42
|
-
@
|
41
|
+
def leftover_specs
|
42
|
+
@leftover_specs ||= TestBoosters::LeftoverFiles.new(all_specs - split_configuration.all_files)
|
43
43
|
end
|
44
44
|
|
45
45
|
def split_configuration
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semaphore_test_boosters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Developers at Rendered Text
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: semaphore_cucumber_booster_config
|
@@ -171,14 +171,6 @@ files:
|
|
171
171
|
- lib/test_boosters/split_configuration.rb
|
172
172
|
- lib/test_boosters/version.rb
|
173
173
|
- test_boosters.gemspec
|
174
|
-
- test_data/a.feature
|
175
|
-
- test_data/a_spec.rb
|
176
|
-
- test_data/b.feature
|
177
|
-
- test_data/b_spec.rb
|
178
|
-
- test_data/c.feature
|
179
|
-
- test_data/c_spec.rb
|
180
|
-
- test_data_fail/fail_spec.rb
|
181
|
-
- test_data_pass/pass_spec.rb
|
182
174
|
homepage: https://github.com/renderedtext/test-boosters
|
183
175
|
licenses:
|
184
176
|
- MIT
|
data/test_data/a.feature
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
12345678901234567890
|
data/test_data/a_spec.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
12345678901234567890
|
data/test_data/b.feature
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
123
|
data/test_data/b_spec.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
123
|
data/test_data/c.feature
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
123456789
|
data/test_data/c_spec.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
123456789
|
data/test_data_fail/fail_spec.rb
DELETED