semaphore_test_boosters 1.4.2 → 1.4.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/.gitignore +1 -0
- data/.rubocop.yml +1 -0
- data/LICENSE.txt +1 -1
- data/README.md +8 -25
- data/exe/cucumber_booster +2 -8
- data/lib/test_boosters/cucumber/booster.rb +56 -0
- data/lib/test_boosters/cucumber/thread.rb +71 -0
- data/lib/test_boosters/split_configuration.rb +0 -7
- data/lib/test_boosters/version.rb +1 -1
- data/lib/test_boosters.rb +3 -11
- data/test_boosters.gemspec +3 -11
- metadata +8 -9
- data/config/cucumber.yml +0 -13
- data/lib/test_boosters/cucumber_booster.rb +0 -75
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa0c05a135e2761cbf334e71cacdf310462650f5
|
4
|
+
data.tar.gz: 7bdc059143b61f6960cadd5f851975b1405542e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 610f504b0ce4d82b9c0405f8dc924a81f0d29cd3220d8997523cae63b30bf690f16b0322db0dd432e49be8b7c6dde931dcd16ffe83a9421341e9666ff8331e0e
|
7
|
+
data.tar.gz: faf3337b8cca83ec87c5472a420976dd0bd5680a102595eebf9473020f1d5e8e045cfc164031965b29e18afb649994cdfa71bb676d74bf091933f20adbc2e330
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -2,42 +2,25 @@
|
|
2
2
|
|
3
3
|
[](https://badge.fury.io/rb/semaphore_test_boosters)
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
TODO: Delete this and the text above, and describe your gem
|
5
|
+
Auto Parallelization — runs test files in multiple threads.
|
8
6
|
|
9
7
|
## Installation
|
10
8
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
gem 'test_boosters'
|
15
|
-
```
|
16
|
-
|
17
|
-
And then execute:
|
18
|
-
|
19
|
-
$ bundle
|
20
|
-
|
21
|
-
Or install it yourself as:
|
22
|
-
|
23
|
-
$ gem install test_boosters
|
9
|
+
``` bash
|
10
|
+
gem install test_boosters
|
11
|
+
````
|
24
12
|
|
25
13
|
## Usage
|
26
14
|
|
27
15
|
TODO: Write usage instructions here
|
28
16
|
|
29
|
-
## Development
|
30
|
-
|
31
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
32
|
-
|
33
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
34
|
-
|
35
17
|
## Contributing
|
36
18
|
|
37
|
-
Bug reports and pull requests are welcome on GitHub at
|
19
|
+
Bug reports and pull requests are welcome on GitHub at
|
20
|
+
https://github.com/renderedtext/test-boosters.
|
38
21
|
|
39
22
|
|
40
23
|
## License
|
41
24
|
|
42
|
-
The gem is available as open source under the terms of the
|
43
|
-
|
25
|
+
The gem is available as open source under the terms of the
|
26
|
+
[MIT License](http://opensource.org/licenses/MIT).
|
data/exe/cucumber_booster
CHANGED
@@ -2,14 +2,8 @@
|
|
2
2
|
|
3
3
|
require "test_boosters"
|
4
4
|
|
5
|
-
TestBoosters.run_cucumber_config
|
6
|
-
|
7
5
|
cli_options = TestBoosters::CliParser.parse
|
8
6
|
thread_index = cli_options[:index] - 1
|
9
|
-
cucumber_booster = TestBoosters::
|
10
|
-
exit_status = cucumber_booster.run
|
11
|
-
|
12
|
-
report_path = cucumber_booster.report_path
|
13
|
-
TestBoosters::InsightsUploader.upload("cucumber", report_path)
|
7
|
+
cucumber_booster = TestBoosters::Cucumber::Booster.new(thread_index)
|
14
8
|
|
15
|
-
exit(
|
9
|
+
exit(cucumber_booster.run)
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module TestBoosters
|
2
|
+
module Cucumber
|
3
|
+
class Booster
|
4
|
+
|
5
|
+
def initialize(thread_index)
|
6
|
+
@thread_index = thread_index
|
7
|
+
end
|
8
|
+
|
9
|
+
def run
|
10
|
+
TestBoosters::Shell.display_title("Cucumber Boster v#{TestBoosters::VERSION}")
|
11
|
+
|
12
|
+
unless split_configuration.valid?
|
13
|
+
puts "[ERROR] The split configuration file is malformed!"
|
14
|
+
|
15
|
+
return 1 # failure exit status
|
16
|
+
end
|
17
|
+
|
18
|
+
threads[@thread_index].run
|
19
|
+
end
|
20
|
+
|
21
|
+
def thread_count
|
22
|
+
@thread_count ||= split_configuration.thread_count
|
23
|
+
end
|
24
|
+
|
25
|
+
def threads
|
26
|
+
@threads ||= Array.new(thread_count) do |thread_index|
|
27
|
+
known_files = all_specs & split_configuration.files_for_thread(thread_index)
|
28
|
+
leftover_files = TestBoosters::LeftoverFiles.select(all_leftover_specs, thread_count, thread_index)
|
29
|
+
|
30
|
+
TestBoosters::Cucumber::Thread.new(known_files, leftover_files)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def all_specs
|
35
|
+
@all_specs ||= Dir["#{specs_path}/**/*.feature"].sort
|
36
|
+
end
|
37
|
+
|
38
|
+
def all_leftover_specs
|
39
|
+
@all_leftover_specs ||= all_specs - split_configuration.all_files
|
40
|
+
end
|
41
|
+
|
42
|
+
def split_configuration
|
43
|
+
@split_configuration ||= TestBoosters::SplitConfiguration.new(split_configuration_path)
|
44
|
+
end
|
45
|
+
|
46
|
+
def specs_path
|
47
|
+
@specs_path ||= ENV["SPEC_PATH"] || "spec"
|
48
|
+
end
|
49
|
+
|
50
|
+
def split_configuration_path
|
51
|
+
ENV["CUCUMBER_SPLIT_CONFIGURATION_PATH"] || "#{ENV["HOME"]}/cucumber_split_configuration.json"
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module TestBoosters
|
2
|
+
module Cucumber
|
3
|
+
class Thread
|
4
|
+
|
5
|
+
attr_reader :files_from_split_configuration
|
6
|
+
attr_reader :leftover_files
|
7
|
+
|
8
|
+
def initialize(files_from_split_configuration, leftover_files)
|
9
|
+
@files_from_split_configuration = files_from_split_configuration
|
10
|
+
@leftover_files = leftover_files
|
11
|
+
end
|
12
|
+
|
13
|
+
# :reek:TooManyStatements { max_statements: 10 }
|
14
|
+
def run
|
15
|
+
if all_files.empty?
|
16
|
+
puts("No files to run in this thread!")
|
17
|
+
|
18
|
+
return 0
|
19
|
+
end
|
20
|
+
|
21
|
+
run_cucumber_config
|
22
|
+
|
23
|
+
display_thread_info
|
24
|
+
|
25
|
+
exit_status = run_cucumber
|
26
|
+
|
27
|
+
upload_report
|
28
|
+
|
29
|
+
exit_status
|
30
|
+
end
|
31
|
+
|
32
|
+
def display_thread_info
|
33
|
+
TestBoosters::Shell.display_files(
|
34
|
+
"Known specs for this thread",
|
35
|
+
files_from_split_configuration)
|
36
|
+
|
37
|
+
TestBoosters::Shell.display_files(
|
38
|
+
"Leftover specs for this thread",
|
39
|
+
leftover_files)
|
40
|
+
end
|
41
|
+
|
42
|
+
def run_cucumber_config
|
43
|
+
CucumberBoosterConfig::Injection.new(Dir.pwd, report_path).run
|
44
|
+
puts "-------------------------------------------------------"
|
45
|
+
puts
|
46
|
+
end
|
47
|
+
|
48
|
+
def run_cucumber
|
49
|
+
TestBoosters::Shell.display_title("Running Cucumber")
|
50
|
+
TestBoosters::Shell.execute(cucumber_command)
|
51
|
+
end
|
52
|
+
|
53
|
+
def upload_report
|
54
|
+
TestBoosters::InsightsUploader.upload("cucumber", report_path)
|
55
|
+
end
|
56
|
+
|
57
|
+
def all_files
|
58
|
+
@all_files ||= files_from_split_configuration + leftover_files
|
59
|
+
end
|
60
|
+
|
61
|
+
def cucumber_command
|
62
|
+
"bundle exec cucumber #{all_files.join(" ")}"
|
63
|
+
end
|
64
|
+
|
65
|
+
def report_path
|
66
|
+
@report_path ||= ENV["REPORT_PATH"] || "#{ENV["HOME"]}/cucumber_report.json"
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -3,13 +3,6 @@ module TestBoosters
|
|
3
3
|
|
4
4
|
Thread = Struct.new(:files, :thread_index)
|
5
5
|
|
6
|
-
def self.for_cucumber
|
7
|
-
path_from_env = ENV["CUCUMBER_SPLIT_CONFIGURATION_PATH"]
|
8
|
-
default_path = "#{ENV["HOME"]}/cucumber_split_configuration.json"
|
9
|
-
|
10
|
-
new(path_from_env || default_path)
|
11
|
-
end
|
12
|
-
|
13
6
|
def initialize(path)
|
14
7
|
@path = path
|
15
8
|
end
|
data/lib/test_boosters.rb
CHANGED
@@ -11,19 +11,11 @@ module TestBoosters
|
|
11
11
|
require "test_boosters/logger"
|
12
12
|
require "test_boosters/shell"
|
13
13
|
require "test_boosters/leftover_files"
|
14
|
+
require "test_boosters/insights_uploader"
|
14
15
|
|
15
16
|
require "test_boosters/rspec/booster"
|
16
17
|
require "test_boosters/rspec/thread"
|
17
|
-
require "test_boosters/cucumber_booster"
|
18
|
-
require "test_boosters/insights_uploader"
|
19
|
-
|
20
|
-
module_function
|
21
|
-
|
22
|
-
def run_cucumber_config
|
23
|
-
puts
|
24
|
-
puts "================== Running Cucumber Booster Config ==================="
|
25
|
-
puts
|
26
18
|
|
27
|
-
|
28
|
-
|
19
|
+
require "test_boosters/cucumber/booster"
|
20
|
+
require "test_boosters/cucumber/thread"
|
29
21
|
end
|
data/test_boosters.gemspec
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
require "test_boosters/version"
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "semaphore_test_boosters"
|
8
8
|
spec.version = TestBoosters::VERSION
|
9
|
-
spec.authors = ["
|
9
|
+
spec.authors = ["Developers at Rendered Text"]
|
10
10
|
spec.email = ["devops@renderedtext.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{Semaphore job parallelization.}
|
@@ -14,20 +14,12 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = "https://github.com/renderedtext/test-boosters"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
-
if spec.respond_to?(:metadata)
|
20
|
-
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
|
-
else
|
22
|
-
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
-
end
|
24
|
-
|
25
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
18
|
spec.bindir = "exe"
|
27
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
20
|
spec.require_paths = ["lib"]
|
29
21
|
|
30
|
-
spec.add_dependency "semaphore_cucumber_booster_config", "~> 1.
|
22
|
+
spec.add_dependency "semaphore_cucumber_booster_config", "~> 1.3"
|
31
23
|
|
32
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
33
25
|
spec.add_development_dependency "rspec", "~> 3.5"
|
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.4.
|
4
|
+
version: 1.4.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-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: semaphore_cucumber_booster_config
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.3'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -155,12 +155,12 @@ files:
|
|
155
155
|
- bin/console
|
156
156
|
- bin/setup
|
157
157
|
- config.reek
|
158
|
-
- config/cucumber.yml
|
159
158
|
- exe/cucumber_booster
|
160
159
|
- exe/rspec_booster
|
161
160
|
- lib/test_boosters.rb
|
162
161
|
- lib/test_boosters/cli_parser.rb
|
163
|
-
- lib/test_boosters/
|
162
|
+
- lib/test_boosters/cucumber/booster.rb
|
163
|
+
- lib/test_boosters/cucumber/thread.rb
|
164
164
|
- lib/test_boosters/insights_uploader.rb
|
165
165
|
- lib/test_boosters/leftover_files.rb
|
166
166
|
- lib/test_boosters/logger.rb
|
@@ -181,8 +181,7 @@ files:
|
|
181
181
|
homepage: https://github.com/renderedtext/test-boosters
|
182
182
|
licenses:
|
183
183
|
- MIT
|
184
|
-
metadata:
|
185
|
-
allowed_push_host: https://rubygems.org
|
184
|
+
metadata: {}
|
186
185
|
post_install_message:
|
187
186
|
rdoc_options: []
|
188
187
|
require_paths:
|
data/config/cucumber.yml
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
default: --format pretty --profile semaphoreci --profile semaphoreci --profile semaphoreci --profile semaphoreci --profile semaphoreci --profile semaphoreci --profile semaphoreci --profile semaphoreci --profile semaphoreci --profile semaphoreci --profile semaphoreci --profile semaphoreci
|
2
|
-
semaphoreci: --format json --out=../cucumber_report.json
|
3
|
-
semaphoreci: --format json --out=../cucumber_report.json
|
4
|
-
semaphoreci: --format json --out=../cucumber_report.json
|
5
|
-
semaphoreci: --format json --out=../cucumber_report.json
|
6
|
-
semaphoreci: --format json --out=../cucumber_report.json
|
7
|
-
semaphoreci: --format json --out=../cucumber_report.json
|
8
|
-
semaphoreci: --format json --out=../cucumber_report.json
|
9
|
-
semaphoreci: --format json --out=../cucumber_report.json
|
10
|
-
semaphoreci: --format json --out=../cucumber_report.json
|
11
|
-
semaphoreci: --format json --out=../cucumber_report.json
|
12
|
-
semaphoreci: --format json --out=../cucumber_report.json
|
13
|
-
semaphoreci: --format json --out=../cucumber_report.json
|
@@ -1,75 +0,0 @@
|
|
1
|
-
module TestBoosters
|
2
|
-
class CucumberBooster
|
3
|
-
attr_reader :report_path
|
4
|
-
|
5
|
-
def initialize(thread_index)
|
6
|
-
@thread_index = thread_index
|
7
|
-
@report_path = ENV["REPORT_PATH"] || "#{ENV["HOME"]}/cucumber_report.json"
|
8
|
-
@spec_path = ENV["SPEC_PATH"] || "features"
|
9
|
-
end
|
10
|
-
|
11
|
-
def run
|
12
|
-
exit_code = true
|
13
|
-
begin
|
14
|
-
features_to_run = select
|
15
|
-
|
16
|
-
if features_to_run.empty?
|
17
|
-
puts "No feature files in this thread!"
|
18
|
-
else
|
19
|
-
exit_code = run_command(features_to_run.join(" "))
|
20
|
-
end
|
21
|
-
rescue StandardError
|
22
|
-
if @thread_index == 0
|
23
|
-
exit_code = run_command(@spec_path)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
exit_code
|
27
|
-
end
|
28
|
-
|
29
|
-
def run_command(specs)
|
30
|
-
puts
|
31
|
-
puts "========================= Running Cucumber =========================="
|
32
|
-
puts
|
33
|
-
|
34
|
-
TestBoosters::Shell.execute("bundle exec cucumber #{specs}")
|
35
|
-
end
|
36
|
-
|
37
|
-
def select
|
38
|
-
with_fallback do
|
39
|
-
split_configuration = TestBoosters::SplitConfiguration.for_cucumber
|
40
|
-
thread_count = split_configuration.threads.count
|
41
|
-
|
42
|
-
all_features = Dir["#{@spec_path}/**/*.feature"].sort
|
43
|
-
all_known_features = split_configuration.all_files
|
44
|
-
|
45
|
-
all_leftover_features = all_features - all_known_features
|
46
|
-
thread_leftover_features = TestBoosters::LeftoverFiles.select(all_leftover_features, thread_count, @thread_index)
|
47
|
-
thread_features = all_features & split_configuration.files_for_thread(@thread_index)
|
48
|
-
features_to_run = thread_features + thread_leftover_features
|
49
|
-
|
50
|
-
TestBoosters::Shell.display_files("This thread features:", thread_features)
|
51
|
-
TestBoosters::Shell.display_title_and_count("All leftover features:", all_leftover_features)
|
52
|
-
TestBoosters::Shell.display_files("This thread leftover features:", thread_leftover_features)
|
53
|
-
|
54
|
-
features_to_run
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def with_fallback
|
59
|
-
yield
|
60
|
-
rescue StandardError => e
|
61
|
-
error = %{
|
62
|
-
WARNING: An error detected while parsing the test boosters report file.
|
63
|
-
WARNING: All tests will be executed on the first thread.
|
64
|
-
}
|
65
|
-
|
66
|
-
puts error
|
67
|
-
|
68
|
-
error += "Exception: #{e.message}"
|
69
|
-
|
70
|
-
TestBoosters::Logger.error(error)
|
71
|
-
|
72
|
-
raise
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|