treye-semaphore_test_boosters 2.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.rubocop.yml +105 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +226 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/config.reek +16 -0
- data/exe/cucumber_booster +5 -0
- data/exe/ex_unit_booster +5 -0
- data/exe/go_test_booster +5 -0
- data/exe/minitest_booster +5 -0
- data/exe/rspec_booster +5 -0
- data/lib/test_boosters.rb +28 -0
- data/lib/test_boosters/boosters/base.rb +81 -0
- data/lib/test_boosters/boosters/cucumber.rb +37 -0
- data/lib/test_boosters/boosters/ex_unit.rb +17 -0
- data/lib/test_boosters/boosters/go_test.rb +17 -0
- data/lib/test_boosters/boosters/minitest.rb +21 -0
- data/lib/test_boosters/boosters/rspec.rb +49 -0
- data/lib/test_boosters/cli_parser.rb +49 -0
- data/lib/test_boosters/files/distributor.rb +45 -0
- data/lib/test_boosters/files/leftover_files.rb +42 -0
- data/lib/test_boosters/files/split_configuration.rb +68 -0
- data/lib/test_boosters/insights_uploader.rb +24 -0
- data/lib/test_boosters/job.rb +40 -0
- data/lib/test_boosters/logger.rb +19 -0
- data/lib/test_boosters/project_info.rb +32 -0
- data/lib/test_boosters/shell.rb +51 -0
- data/lib/test_boosters/version.rb +3 -0
- data/rspec_formatters/semaphore_rspec3_json_formatter.rb +55 -0
- data/test_boosters.gemspec +32 -0
- metadata +195 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 27c22f8102f333cd7e8144fa2b4d7a17a5c7a77f
|
4
|
+
data.tar.gz: 779e690fb739830d6c52d9d86bbc49464d2faf6c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1015436ed3fe5b5ff4b3ebc7b2b55069ffe7ee34138ed1e6907e154db48379df0f272a8ec0cae7dcf40ecfdb005681ea720d40e5c8b3a15ed15408bb913f8b77
|
7
|
+
data.tar.gz: 7d9f7b00719e7fd971925e59a2063852fbb945535c103313a86c8fc8d1722dfeb9d542bca0d6396abd507e1a126621ac2fb167a0a4959df715e390998df3931e
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
require: rubocop-rspec
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
DisplayCopNames: true
|
5
|
+
|
6
|
+
Exclude:
|
7
|
+
- "*.gemspec"
|
8
|
+
- "vendor/**/*"
|
9
|
+
- "features/**/*"
|
10
|
+
- "lib/test_boosters/cucumber_booster.rb"
|
11
|
+
- "test_data_pass/**/*"
|
12
|
+
- "test_data_fail/**/*"
|
13
|
+
- "rspec_formatters/semaphore_rspec3_json_formatter.rb"
|
14
|
+
|
15
|
+
Style/StringLiterals:
|
16
|
+
EnforcedStyle: double_quotes
|
17
|
+
|
18
|
+
Style/StringLiteralsInInterpolation:
|
19
|
+
EnforcedStyle: double_quotes
|
20
|
+
|
21
|
+
Style/NumericLiterals:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Style/Documentation:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Style/HashSyntax:
|
28
|
+
EnforcedStyle: hash_rockets
|
29
|
+
|
30
|
+
Style/CollectionMethods:
|
31
|
+
StyleGuide: "https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size"
|
32
|
+
Enabled: true
|
33
|
+
|
34
|
+
Metrics/LineLength:
|
35
|
+
Max: 120
|
36
|
+
|
37
|
+
Style/EmptyLinesAroundClassBody:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
Style/EmptyLinesAroundModuleBody:
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
Style/MultilineMethodCallIndentation:
|
44
|
+
EnforcedStyle: indented
|
45
|
+
IndentationWidth: 2
|
46
|
+
|
47
|
+
Style/SpecialGlobalVars:
|
48
|
+
Enabled: false
|
49
|
+
|
50
|
+
Style/PercentLiteralDelimiters:
|
51
|
+
Enabled: false
|
52
|
+
|
53
|
+
RSpec/InstanceVariable:
|
54
|
+
Enabled: false
|
55
|
+
|
56
|
+
RSpec/MultipleExpectations:
|
57
|
+
Max: 5
|
58
|
+
|
59
|
+
Metrics/BlockLength:
|
60
|
+
Exclude:
|
61
|
+
- "Rakefile"
|
62
|
+
- "**/*.rake"
|
63
|
+
- "spec/**/*.rb"
|
64
|
+
|
65
|
+
Style/EmptyLinesAroundBlockBody:
|
66
|
+
Enabled: false
|
67
|
+
|
68
|
+
RSpec/BeforeAfterAll:
|
69
|
+
Enabled: false
|
70
|
+
|
71
|
+
RSpec/ExampleLength:
|
72
|
+
Enabled: false
|
73
|
+
|
74
|
+
RSpec/DescribedClass:
|
75
|
+
Enabled: false
|
76
|
+
|
77
|
+
Style/IndentArray:
|
78
|
+
EnforcedStyle: consistent
|
79
|
+
|
80
|
+
Style/MultilineMethodCallBraceLayout:
|
81
|
+
Enabled: false
|
82
|
+
|
83
|
+
RSpec/MessageSpies:
|
84
|
+
Enabled: false
|
85
|
+
|
86
|
+
Style/MultilineBlockLayout:
|
87
|
+
Enabled: false
|
88
|
+
|
89
|
+
RSpec/SubjectStub:
|
90
|
+
Enabled: false
|
91
|
+
|
92
|
+
RSpec/DescribeClass:
|
93
|
+
Enabled: false
|
94
|
+
|
95
|
+
RSpec/LeadingSubject:
|
96
|
+
Enabled: false
|
97
|
+
|
98
|
+
Style/WordArray:
|
99
|
+
Enabled: false
|
100
|
+
|
101
|
+
RSpec/NotToNot:
|
102
|
+
Enabled: false
|
103
|
+
|
104
|
+
Metrics/MethodLength:
|
105
|
+
Enabled: false
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Rendered Text
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,226 @@
|
|
1
|
+
# Test Boosters
|
2
|
+
|
3
|
+
Note: This version is just an updated copy of the original with the new version number.
|
4
|
+
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/semaphore_test_boosters.svg)](https://badge.fury.io/rb/semaphore_test_boosters)
|
6
|
+
[![Build Status](https://semaphoreci.com/api/v1/renderedtext/test-boosters/branches/master/badge.svg)](https://semaphoreci.com/renderedtext/test-boosters)
|
7
|
+
|
8
|
+
Auto Parallelization — runs test files in multiple jobs
|
9
|
+
|
10
|
+
- [Installation](#installation)
|
11
|
+
|
12
|
+
Test Booster basics:
|
13
|
+
|
14
|
+
- [What are Test Boosters](#what-are-test-boosters)
|
15
|
+
- [Split Configuration](#split-configuration)
|
16
|
+
- [Leftover Files](#split-configuration)
|
17
|
+
|
18
|
+
Test Boosters:
|
19
|
+
|
20
|
+
- [RSpec Booster](#rspec-booster)
|
21
|
+
- [Cucumber Booster](#cucumber-booster)
|
22
|
+
- [Minitest Booster](#minitest-booster)
|
23
|
+
- [ExUnit Booster](#ex-unit-booster)
|
24
|
+
- [GoTest Booster](#go-test-booster)
|
25
|
+
|
26
|
+
## Installation
|
27
|
+
|
28
|
+
``` bash
|
29
|
+
gem install semaphore_test_boosters
|
30
|
+
````
|
31
|
+
|
32
|
+
## What are Test Boosters
|
33
|
+
|
34
|
+
Test Boosters take your test suite and split the test files into multiple jobs.
|
35
|
+
This allows you to quickly parallelize your test suite across multiple build
|
36
|
+
machines.
|
37
|
+
|
38
|
+
As an example, let's take a look at the `rspec_booster --job 1/10` command. It
|
39
|
+
lists all the files that match the `spec/**/*_spec.rb` glob in your project,
|
40
|
+
distributes them into 10 jobs, and execute the first job.
|
41
|
+
|
42
|
+
### Split Configuration
|
43
|
+
|
44
|
+
Every test booster can load a split configuration file that helps the test
|
45
|
+
booster to make a better distribution.
|
46
|
+
|
47
|
+
For example, if you have 3 RSpec Booster jobs, and you want to run:
|
48
|
+
|
49
|
+
- `spec/a_spec.rb` and `spec/b_spec.rb` in the first job
|
50
|
+
- `spec/c_spec.rb` and `spec/d_spec.rb` in the second job
|
51
|
+
- `spec/e_spec.rb` in the third job
|
52
|
+
|
53
|
+
you should put the following in your split configuration file:
|
54
|
+
|
55
|
+
``` json
|
56
|
+
[
|
57
|
+
{ "files": ["spec/a_spec.rb", "spec/b_spec.rb"] },
|
58
|
+
{ "files": ["spec/c_spec.rb", "spec/d_spec.rb"] },
|
59
|
+
{ "files": ["spec/e_spec.rb"] }
|
60
|
+
]
|
61
|
+
```
|
62
|
+
|
63
|
+
Semaphore uses Split configurations to split your test files based on their
|
64
|
+
durations in the previous builds.
|
65
|
+
|
66
|
+
### Leftover Files
|
67
|
+
|
68
|
+
Files that are part of your test suite, but are not in the split
|
69
|
+
configuration file, are called "leftover files". These files will be distributed
|
70
|
+
based on their file size in a round robin fashion across your jobs.
|
71
|
+
|
72
|
+
For example, if you have the following in your split configuration:
|
73
|
+
|
74
|
+
``` json
|
75
|
+
[
|
76
|
+
{ "files": ["spec/a_spec.rb"] }
|
77
|
+
{ "files": ["spec/b_spec.rb"] }
|
78
|
+
{ "files": ["spec/c_spec.rb"] }
|
79
|
+
]
|
80
|
+
```
|
81
|
+
|
82
|
+
and the following files in your spec directory:
|
83
|
+
|
84
|
+
``` bash
|
85
|
+
# Files from split configuration ↓
|
86
|
+
|
87
|
+
spec/a_spec.rb
|
88
|
+
spec/b_spec.rb
|
89
|
+
spec/c_spec.rb
|
90
|
+
|
91
|
+
# Leftover files ↓
|
92
|
+
|
93
|
+
spec/d_spec.rb
|
94
|
+
spec/e_spec.rb
|
95
|
+
```
|
96
|
+
|
97
|
+
When you run the `rspec_booster --job 1/3` command, the files from the
|
98
|
+
configuration's first job and some leftover files will be executed.
|
99
|
+
|
100
|
+
``` bash
|
101
|
+
rspec_booster --job 1/3
|
102
|
+
|
103
|
+
# => runs: bundle exec rspec spec/a_spec.rb spec/d_spec.rb
|
104
|
+
```
|
105
|
+
|
106
|
+
Booster will distribute your leftover files uniformly across jobs.
|
107
|
+
|
108
|
+
## RSpec Booster
|
109
|
+
|
110
|
+
The `rspec_booster` loads all the files that match the `spec/**/*_spec.rb`
|
111
|
+
pattern and uses the `~/rspec_split_configuration.json` file to parallelize your
|
112
|
+
test suite.
|
113
|
+
|
114
|
+
Example of running job 4 out of 32 jobs:
|
115
|
+
|
116
|
+
``` bash
|
117
|
+
rspec_booster --job 4/32
|
118
|
+
```
|
119
|
+
|
120
|
+
Under the hood, the RSpec Booster uses the following command:
|
121
|
+
|
122
|
+
``` bash
|
123
|
+
bundle exec rspec --format documentation --format json --out /home/<user>/rspec_report.json <file_list>
|
124
|
+
```
|
125
|
+
|
126
|
+
Optionally, you can pass additional RSpec flags with the `TB_RSPEC_OPTIONS`
|
127
|
+
environment variable. You can also set a RSpec formatter with the `TB_RSPEC_FORMATTER` environment variable.
|
128
|
+
Default formatter is `documentation`.
|
129
|
+
|
130
|
+
|
131
|
+
Example:
|
132
|
+
``` bash
|
133
|
+
TB_RSPEC_OPTIONS='--fail-fast=3' TB_RSPEC_FORMATTER=Fivemat rspec_booster --job 4/32
|
134
|
+
|
135
|
+
# will execute:
|
136
|
+
bundle exec rspec --fail-fast=3 --format Fivemat --format json --out /home/<user>/rspec_report.json <file_list>
|
137
|
+
```
|
138
|
+
|
139
|
+
## Cucumber Booster
|
140
|
+
|
141
|
+
The `cucumber_booster` loads all the files that match the `features/**/*.feature`
|
142
|
+
pattern and uses the `~/cucumber_split_configuration.json` file to parallelize
|
143
|
+
your test suite.
|
144
|
+
|
145
|
+
Example of running job 4 out of 32 jobs:
|
146
|
+
|
147
|
+
``` bash
|
148
|
+
cucumber_booster --job 4/32
|
149
|
+
```
|
150
|
+
|
151
|
+
Under the hood, the Cucumber Booster uses the following command:
|
152
|
+
|
153
|
+
``` bash
|
154
|
+
bundle exec cucumber <file_list>
|
155
|
+
```
|
156
|
+
|
157
|
+
## Minitest Booster
|
158
|
+
|
159
|
+
The `minitest_booster` loads all the files that match the `test/**/*_test.rb`
|
160
|
+
pattern and uses the `~/minitest_split_configuration.json` file to parallelize
|
161
|
+
your test suite.
|
162
|
+
|
163
|
+
Example of running job 4 out of 32 jobs:
|
164
|
+
|
165
|
+
``` bash
|
166
|
+
minitest_booster --job 4/32
|
167
|
+
```
|
168
|
+
|
169
|
+
Under the hood, the Minitest Booster uses the following command:
|
170
|
+
|
171
|
+
``` bash
|
172
|
+
ruby -e 'ARGV.each { |f| require ".#{f}" }' <file_list>
|
173
|
+
```
|
174
|
+
|
175
|
+
## ExUnit Booster
|
176
|
+
|
177
|
+
The `ex_unit_booster` loads all the files that match the `test/**/*_test.exs`
|
178
|
+
pattern and uses the `~/ex_unit_split_configuration.json` file to parallelize
|
179
|
+
your test suite.
|
180
|
+
|
181
|
+
Example of running job 4 out of 32 jobs:
|
182
|
+
|
183
|
+
``` bash
|
184
|
+
ex_unit_booster --job 4/32
|
185
|
+
```
|
186
|
+
|
187
|
+
Under the hood, the ExUnit Booster uses the following command:
|
188
|
+
|
189
|
+
``` bash
|
190
|
+
mix test <file_list>
|
191
|
+
```
|
192
|
+
|
193
|
+
## Go Test Booster
|
194
|
+
|
195
|
+
The `go_test_booster` loads all the files that match the `**/*_test.go`
|
196
|
+
pattern and uses the `~/go_test_split_configuration.json` file to parallelize
|
197
|
+
your test suite.
|
198
|
+
|
199
|
+
Example of running job 4 out of 32 jobs:
|
200
|
+
|
201
|
+
``` bash
|
202
|
+
go_test_booster --job 4/32
|
203
|
+
```
|
204
|
+
|
205
|
+
Under the hood, the Go Test Booster uses the following command:
|
206
|
+
|
207
|
+
``` bash
|
208
|
+
go test <file_list>
|
209
|
+
```
|
210
|
+
|
211
|
+
## Development
|
212
|
+
|
213
|
+
### Integration testing
|
214
|
+
|
215
|
+
For integration tests we use test repositories that are located in
|
216
|
+
<https://github.com/renderedtext/test-boosters-tests.git>.
|
217
|
+
|
218
|
+
## Contributing
|
219
|
+
|
220
|
+
Bug reports and pull requests are welcome on GitHub at
|
221
|
+
https://github.com/renderedtext/test-boosters.
|
222
|
+
|
223
|
+
## License
|
224
|
+
|
225
|
+
The gem is available as open source under the terms of the
|
226
|
+
[MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "test_boosters"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/config.reek
ADDED