semaphore_test_boosters 2.0.0 → 2.0.1
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/README.md +88 -93
- data/lib/test_boosters/shell.rb +5 -1
- data/lib/test_boosters/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6115ef24f4518bfaaf70e3556e1cbab67c1d8820
|
4
|
+
data.tar.gz: 39f69a9a81d2dbd9df0d01c82d3d6daeefd79a28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f7ac16b098e9f3cd360b8451c35ed460f6b3aa970f3d72d58c23dc62bd9c4828eea35735ce56905e417165aecc562c0181cc14016d9adaee3e6badcc117ac7d
|
7
|
+
data.tar.gz: c6d21b3e1db2231740b74c7f2876a3b14c921187340b2e7fc975ea0f885ffc255dda0ef6d4109b4c59a61cded45635f2b9c8a583c642c3253040bd77c488204c
|
data/README.md
CHANGED
@@ -7,49 +7,41 @@ Auto Parallelization — runs test files in multiple jobs
|
|
7
7
|
|
8
8
|
- [Installation](#installation)
|
9
9
|
|
10
|
-
|
11
|
-
- [Running RSpec jobs](#rspec-booster)
|
12
|
-
- [RSpec Split Configuration](#rspec-split-configuration)
|
13
|
-
- [Leftover RSpec specs](#leftover-rspec-specs)
|
14
|
-
- [Passing custom options to RSpec](#custom-rspec-options)
|
15
|
-
|
16
|
-
- Cucumber Booster
|
17
|
-
- [Running Cucumber jobs](#cucumber-booster)
|
18
|
-
- [Cucumber Split Configuration](#cucumber-split-configuration)
|
19
|
-
- [Leftover Cucumber specs](#leftover-rspec-specs)
|
20
|
-
- [Passing custom options to Cucumber](#custom-cucumber-options)
|
10
|
+
Test Booster basics:
|
21
11
|
|
22
|
-
|
12
|
+
- [What are Test Boosters](#what-are-test-boosters)
|
13
|
+
- [Split Configuration](#split-configuration)
|
14
|
+
- [Leftover Files](#split-configuration)
|
23
15
|
|
24
|
-
|
25
|
-
gem install semaphore_test_boosters
|
26
|
-
````
|
16
|
+
Test Boosters:
|
27
17
|
|
28
|
-
|
18
|
+
- [RSpec Booster](#rspec-booster)
|
19
|
+
- [Cucumber Booster](#cucumber-booster)
|
20
|
+
- [Minitest Booster](#minitest-booster)
|
21
|
+
- [ExUnit Booster](#ex-unit-booster)
|
22
|
+
- [GoTest Booster](#go-test-booster)
|
29
23
|
|
30
|
-
The RSpec Booster splits your RSpec test suite to multiple jobs.
|
31
24
|
|
32
|
-
|
33
|
-
then executed the 3rd job, use the following command:
|
25
|
+
## Installation
|
34
26
|
|
35
27
|
``` bash
|
36
|
-
|
37
|
-
|
28
|
+
gem install semaphore_test_boosters
|
29
|
+
````
|
38
30
|
|
39
|
-
|
40
|
-
into multiple jobs. This is OK for your first run, but the distribution is
|
41
|
-
usually suboptimal.
|
31
|
+
## What are Test Boosters
|
42
32
|
|
43
|
-
|
44
|
-
|
33
|
+
Test Boosters take your test suite and split the test files into multiple jobs.
|
34
|
+
This allows you to quickly parallelize your test suite across multiple build
|
35
|
+
machines.
|
45
36
|
|
46
|
-
|
47
|
-
|
37
|
+
As an example, let's take a look at the `rspec_booster --job 1/10` command. It
|
38
|
+
lists all the files that match the `spec/**/*_spec.rb` glob in your project,
|
39
|
+
distributes them into 10 jobs, and execute the first job.
|
48
40
|
|
49
|
-
###
|
41
|
+
### Split Configuration
|
50
42
|
|
51
|
-
|
52
|
-
|
43
|
+
Every test booster can load a split configuration file that helps the test
|
44
|
+
booster to make a better distribution.
|
53
45
|
|
54
46
|
For example, if you have 3 RSpec Booster jobs, and you want to run:
|
55
47
|
|
@@ -67,9 +59,12 @@ you should put the following in your split configuration file:
|
|
67
59
|
]
|
68
60
|
```
|
69
61
|
|
70
|
-
|
62
|
+
Semaphore uses Split configurations to split your test files based their
|
63
|
+
durations in the previous builds.
|
71
64
|
|
72
|
-
|
65
|
+
### Leftover Files
|
66
|
+
|
67
|
+
Files that are part of your test suite, but are not in the split
|
73
68
|
configuration file, are called "leftover files". These files will be distributed
|
74
69
|
based on their file size in a round robin fashion across your jobs.
|
75
70
|
|
@@ -102,108 +97,108 @@ rspec_booster --job 1/3
|
|
102
97
|
# => runs: bundle exec rspec spec/a_spec.rb spec/d_spec.rb
|
103
98
|
```
|
104
99
|
|
105
|
-
|
100
|
+
## RSpec Booster
|
106
101
|
|
107
|
-
|
102
|
+
The `rspec_booster` loads all the files that match the `spec/**/*_spec.rb`
|
103
|
+
pattern and uses the `~/rspec_split_configuration.json` file to parallelize your
|
104
|
+
test suite.
|
105
|
+
|
106
|
+
Example of running job 4 out of 32 jobs:
|
108
107
|
|
109
108
|
``` bash
|
110
|
-
|
109
|
+
rspec_booster --job 4/32
|
111
110
|
```
|
112
111
|
|
113
|
-
|
114
|
-
the `TB_RSPEC_OPTIONS` environment variable.
|
112
|
+
Under the hood, the RSpec Booster uses the following command:
|
115
113
|
|
116
|
-
|
117
|
-
|
114
|
+
``` bash
|
115
|
+
bundle exec rspec --format documentation --format json --out /home/<user>/rspec_report.json <file_list>
|
116
|
+
```
|
117
|
+
|
118
|
+
Optionally, you can pass additional RSpec flags with the `TB_RSPEC_OPTIONS`
|
119
|
+
environment variable:
|
118
120
|
|
119
121
|
``` bash
|
120
|
-
|
122
|
+
TB_RSPEC_OPTIONS='--fail-fast=3' rspec_booster --job 4/32
|
123
|
+
```
|
121
124
|
|
122
|
-
|
125
|
+
The above command will execute:
|
123
126
|
|
124
|
-
|
127
|
+
``` bash
|
128
|
+
bundle exec rspec --fail-fast=3 --format documentation --format json --out /home/<user>/rspec_report.json <file_list>
|
125
129
|
```
|
126
130
|
|
127
131
|
## Cucumber Booster
|
128
132
|
|
129
|
-
The
|
133
|
+
The `cucumber_booster` loads all the files that match the `features/**/*.feature`
|
134
|
+
pattern and uses the `~/cucumber_split_configuration.json` file to parallelize
|
135
|
+
your test suite.
|
130
136
|
|
131
|
-
|
132
|
-
then executed the 3rd job, use the following command:
|
137
|
+
Example of running job 4 out of 32 jobs:
|
133
138
|
|
134
139
|
``` bash
|
135
|
-
cucumber_booster --
|
140
|
+
cucumber_booster --job 4/32
|
136
141
|
```
|
137
142
|
|
138
|
-
|
139
|
-
into multiple jobs. This is OK for your first run, but the distribution is
|
140
|
-
usually suboptimal.
|
141
|
-
|
142
|
-
If you want to achieve better build times, and split your test files more
|
143
|
-
evenly, you need to provide a split configuration file for Cucumber Booster.
|
143
|
+
Under the hood, the Cucumber Booster uses the following command:
|
144
144
|
|
145
|
-
|
146
|
-
|
145
|
+
``` bash
|
146
|
+
bundle exec cucumber <file_list>
|
147
|
+
```
|
147
148
|
|
148
|
-
|
149
|
+
## Minitest Booster
|
149
150
|
|
150
|
-
The `
|
151
|
-
and
|
151
|
+
The `minitest_booster` loads all the files that match the `test/**/*_test.rb`
|
152
|
+
pattern and uses the `~/minitest_split_configuration.json` file to parallelize
|
153
|
+
your test suite.
|
152
154
|
|
153
|
-
|
155
|
+
Example of running job 4 out of 32 jobs:
|
154
156
|
|
155
|
-
|
156
|
-
|
157
|
-
|
157
|
+
``` bash
|
158
|
+
minitest_booster --job 4/32
|
159
|
+
```
|
158
160
|
|
159
|
-
|
161
|
+
Under the hood, the Minitest Booster uses the following command:
|
160
162
|
|
161
|
-
```
|
162
|
-
|
163
|
-
{ "files": ["features/a.feature", "features/b.feature"] },
|
164
|
-
{ "files": ["features/c.feature", "features/d.feature"] },
|
165
|
-
{ "files": ["features/e.feature"] }
|
166
|
-
]
|
163
|
+
``` bash
|
164
|
+
ruby -e 'ARGV.each { |f| require ".#{f}" }' <file_list>
|
167
165
|
```
|
168
166
|
|
169
|
-
|
167
|
+
## ExUnit Booster
|
170
168
|
|
171
|
-
|
172
|
-
|
173
|
-
|
169
|
+
The `ex_unit_booster` loads all the files that match the `test/**/*_test.exs`
|
170
|
+
pattern and uses the `~/ex_unit_split_configuration.json` file to parallelize
|
171
|
+
your test suite.
|
174
172
|
|
175
|
-
|
173
|
+
Example of running job 4 out of 32 jobs:
|
176
174
|
|
177
|
-
```
|
178
|
-
|
179
|
-
{ "files": ["features/a.feature"] }
|
180
|
-
{ "files": ["features/b.feature"] }
|
181
|
-
{ "files": ["features/c.feature"] }
|
182
|
-
]
|
175
|
+
``` bash
|
176
|
+
ex_unit_booster --job 4/32
|
183
177
|
```
|
184
178
|
|
185
|
-
|
179
|
+
Under the hood, the ExUnit Booster uses the following command:
|
186
180
|
|
187
181
|
``` bash
|
188
|
-
|
189
|
-
features/b.feature
|
190
|
-
features/c.feature
|
191
|
-
features/d.feature
|
192
|
-
features/e.feature
|
182
|
+
mix test <file_list>
|
193
183
|
```
|
194
184
|
|
195
|
-
|
196
|
-
configuration's first job and some leftover files will be executed.
|
185
|
+
## Go Test Booster
|
197
186
|
|
198
|
-
|
199
|
-
|
187
|
+
The `go_test_booster` loads all the files that match the `**/*_test.go`
|
188
|
+
pattern and uses the `~/go_test_split_configuration.json` file to parallelize
|
189
|
+
your test suite.
|
190
|
+
|
191
|
+
Example of running job 4 out of 32 jobs:
|
200
192
|
|
201
|
-
|
193
|
+
``` bash
|
194
|
+
go_test_booster --job 4/32
|
202
195
|
```
|
203
196
|
|
204
|
-
|
197
|
+
Under the hood, the Go Test Booster uses the following command:
|
205
198
|
|
206
|
-
|
199
|
+
``` bash
|
200
|
+
go test <file_list>
|
201
|
+
```
|
207
202
|
|
208
203
|
## Contributing
|
209
204
|
|
data/lib/test_boosters/shell.rb
CHANGED
@@ -8,7 +8,7 @@ module TestBoosters
|
|
8
8
|
|
9
9
|
puts command unless options[:silent] == true
|
10
10
|
|
11
|
-
|
11
|
+
with_clean_env do
|
12
12
|
system(command)
|
13
13
|
end
|
14
14
|
|
@@ -19,6 +19,10 @@ module TestBoosters
|
|
19
19
|
exit_status
|
20
20
|
end
|
21
21
|
|
22
|
+
def with_clean_env
|
23
|
+
defined?(Bundler) ? Bundler.with_clean_env { yield } : yield
|
24
|
+
end
|
25
|
+
|
22
26
|
def display_title(title)
|
23
27
|
puts
|
24
28
|
puts "=== #{title} ===="
|