knapsack 1.17.1 → 1.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -2
- data/CHANGELOG.md +104 -61
- data/README.md +36 -1
- data/knapsack.gemspec +2 -2
- data/lib/knapsack/adapters/rspec_adapter.rb +5 -2
- data/lib/knapsack/config/env.rb +6 -2
- data/lib/knapsack/presenter.rb +6 -2
- data/lib/knapsack/tracker.rb +1 -5
- data/lib/knapsack/version.rb +1 -1
- data/spec/knapsack/adapters/rspec_adapter_spec.rb +5 -5
- data/spec/knapsack/config/env_spec.rb +20 -0
- metadata +15 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 620ac5f634996f21d32b1c65ac8609a61c47ac6f07b773fe1fa2bf6487f41d88
|
4
|
+
data.tar.gz: e5851433f161642429b11bea40e28ad37a0bd5f7008f34b641750afc7168e8e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edf2dbf2877aa04107e8a62e6ea91426df85288a87954d28068d3bb49dc31006bf61094bff3b564eb7d9b302b5966d2656e418bd83cd5a7ab751f9e2d33763b5
|
7
|
+
data.tar.gz: 14d9e941b65ffad0d5ec9d5120d56a77be8dc30ba4e2bb463a8621fe04947c804e1db41e7b10ae5a9ff87439acda309e1accb0076683e62ab1e25ca86f33718d
|
data/.travis.yml
CHANGED
@@ -2,13 +2,14 @@
|
|
2
2
|
sudo: false
|
3
3
|
language: ruby
|
4
4
|
rvm:
|
5
|
-
- 1.9.3
|
6
|
-
- 2.0.0
|
7
5
|
- 2.1
|
8
6
|
- 2.2
|
9
7
|
- 2.3
|
10
8
|
- 2.4
|
11
9
|
- 2.5
|
10
|
+
- 2.6
|
11
|
+
- 2.7
|
12
|
+
- truffleruby-head
|
12
13
|
addons:
|
13
14
|
code_climate:
|
14
15
|
repo_token: 38686058eed480dd0fcf8bce9015733e0bae88e44e30f4a1ac63df8aec2f86d8
|
data/CHANGELOG.md
CHANGED
@@ -2,61 +2,104 @@
|
|
2
2
|
|
3
3
|
* TODO
|
4
4
|
|
5
|
+
### 1.21.0
|
6
|
+
|
7
|
+
* Track time in before and after `:context` hooks
|
8
|
+
|
9
|
+
https://github.com/KnapsackPro/knapsack/pull/107
|
10
|
+
|
11
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.20.0...v1.21.0
|
12
|
+
|
13
|
+
### 1.20.0
|
14
|
+
|
15
|
+
* Use `Process.clock_gettime` to measure track execution time
|
16
|
+
|
17
|
+
https://github.com/KnapsackPro/knapsack/pull/100
|
18
|
+
|
19
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.19.0...v1.20.0
|
20
|
+
|
21
|
+
### 1.19.0
|
22
|
+
|
23
|
+
* Add support for Bitbucket Pipelines
|
24
|
+
|
25
|
+
https://github.com/KnapsackPro/knapsack/pull/97
|
26
|
+
|
27
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.18.0...v1.19.0
|
28
|
+
|
29
|
+
### 1.18.0
|
30
|
+
|
31
|
+
* Add support for Semaphore 2.0
|
32
|
+
|
33
|
+
https://github.com/KnapsackPro/knapsack/pull/92
|
34
|
+
|
35
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.17.2...v1.18.0
|
36
|
+
|
37
|
+
### 1.17.2
|
38
|
+
|
39
|
+
* Allow for new `bundler` in development
|
40
|
+
* Test Ruby 2.6 on CI
|
41
|
+
* Add info about Knapsack Pro Queue Mode in knapsack output
|
42
|
+
* Update URL to FAQ in knapsack output
|
43
|
+
|
44
|
+
https://github.com/KnapsackPro/knapsack/pull/90
|
45
|
+
|
46
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.17.1...v1.17.2
|
47
|
+
|
5
48
|
### 1.17.1
|
6
49
|
|
7
50
|
* Fix RSpec signal handling by replacing process
|
8
51
|
|
9
|
-
https://github.com/
|
52
|
+
https://github.com/KnapsackPro/knapsack/pull/86
|
10
53
|
|
11
|
-
https://github.com/
|
54
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.17.0...v1.17.1
|
12
55
|
|
13
56
|
### 1.17.0
|
14
57
|
|
15
58
|
* Add support for GitLab CI ENV variable `CI_NODE_INDEX` starting from 1.
|
16
59
|
|
17
|
-
https://github.com/
|
60
|
+
https://github.com/KnapsackPro/knapsack/pull/83
|
18
61
|
|
19
|
-
https://github.com/
|
62
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.16.0...v1.17.0
|
20
63
|
|
21
64
|
### 1.16.0
|
22
65
|
|
23
66
|
* Add support for Ruby >= 1.9.3.
|
24
67
|
|
25
|
-
https://github.com/
|
68
|
+
https://github.com/KnapsackPro/knapsack/pull/77
|
26
69
|
|
27
|
-
https://github.com/
|
70
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.15.0...v1.16.0
|
28
71
|
|
29
72
|
### 1.15.0
|
30
73
|
|
31
74
|
* Add support for Cucumber 3.
|
32
75
|
|
33
|
-
https://github.com/
|
76
|
+
https://github.com/KnapsackPro/knapsack/pull/68
|
34
77
|
|
35
|
-
https://github.com/
|
78
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.14.1...v1.15.0
|
36
79
|
|
37
80
|
### 1.14.1
|
38
81
|
|
39
82
|
* Update RSpec timing adapter to be more resilient.
|
40
83
|
|
41
|
-
https://github.com/
|
84
|
+
https://github.com/KnapsackPro/knapsack/pull/64
|
42
85
|
|
43
|
-
https://github.com/
|
86
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.14.0...v1.14.1
|
44
87
|
|
45
88
|
### 1.14.0
|
46
89
|
|
47
90
|
* Moves Timecop to development dependency.
|
48
91
|
|
49
|
-
https://github.com/
|
92
|
+
https://github.com/KnapsackPro/knapsack/pull/61
|
50
93
|
|
51
|
-
https://github.com/
|
94
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.13.3...v1.14.0
|
52
95
|
|
53
96
|
### 1.13.3
|
54
97
|
|
55
98
|
* Fix: Trailing slash should be removed from allocator test_dir.
|
56
99
|
|
57
|
-
https://github.com/
|
100
|
+
https://github.com/KnapsackPro/knapsack/issues/57
|
58
101
|
|
59
|
-
https://github.com/
|
102
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.13.2...v1.13.3
|
60
103
|
|
61
104
|
### 1.13.2
|
62
105
|
|
@@ -65,78 +108,78 @@ https://github.com/ArturT/knapsack/compare/v1.13.2...v1.13.3
|
|
65
108
|
Related:
|
66
109
|
https://github.com/KnapsackPro/knapsack_pro-ruby/issues/27
|
67
110
|
|
68
|
-
https://github.com/
|
111
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.13.1...v1.13.2
|
69
112
|
|
70
113
|
### 1.13.1
|
71
114
|
|
72
115
|
* Fix: Get rid of call #zero? method on $?.exitstatus in test runners tasks
|
73
116
|
|
74
|
-
https://github.com/
|
117
|
+
https://github.com/KnapsackPro/knapsack/pull/52
|
75
118
|
|
76
|
-
https://github.com/
|
119
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.13.0...v1.13.1
|
77
120
|
|
78
121
|
### 1.13.0
|
79
122
|
|
80
123
|
* Add KNAPSACK_LOG_LEVEL option
|
81
124
|
|
82
|
-
https://github.com/
|
125
|
+
https://github.com/KnapsackPro/knapsack/pull/49
|
83
126
|
|
84
|
-
https://github.com/
|
127
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.12.2...v1.13.0
|
85
128
|
|
86
129
|
### 1.12.2
|
87
130
|
|
88
131
|
* Fix support for turnip >= 2.x
|
89
132
|
|
90
|
-
https://github.com/
|
133
|
+
https://github.com/KnapsackPro/knapsack/pull/47
|
91
134
|
|
92
|
-
https://github.com/
|
135
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.12.1...v1.12.2
|
93
136
|
|
94
137
|
### 1.12.1
|
95
138
|
|
96
139
|
* Cucumber and Spinach should load files from proper folder in case when you use custom test directory.
|
97
140
|
|
98
|
-
https://github.com/
|
141
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.12.0...v1.12.1
|
99
142
|
|
100
143
|
### 1.12.0
|
101
144
|
|
102
145
|
* Add support for Minitest::SharedExamples
|
103
146
|
|
104
|
-
https://github.com/
|
147
|
+
https://github.com/KnapsackPro/knapsack/pull/46
|
105
148
|
|
106
|
-
https://github.com/
|
149
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.11.1...v1.12.0
|
107
150
|
|
108
151
|
### 1.11.1
|
109
152
|
|
110
153
|
* Require spinach in spec helper so tests will pass but don't require it in spinach adapter because it breaks for users who don't use spinach and they don't want to add it to their Gemfile
|
111
154
|
|
112
155
|
Related PR:
|
113
|
-
https://github.com/
|
156
|
+
https://github.com/KnapsackPro/knapsack/pull/41
|
114
157
|
|
115
|
-
https://github.com/
|
158
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.11.0...v1.11.1
|
116
159
|
|
117
160
|
### 1.11.0
|
118
161
|
|
119
162
|
* Add support for Spinach
|
120
163
|
|
121
|
-
https://github.com/
|
164
|
+
https://github.com/KnapsackPro/knapsack/pull/41
|
122
165
|
|
123
|
-
https://github.com/
|
166
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.10.0...v1.11.0
|
124
167
|
|
125
168
|
### 1.10.0
|
126
169
|
|
127
170
|
* Log the time offset warning at INFO if time not exceeded
|
128
171
|
|
129
|
-
https://github.com/
|
172
|
+
https://github.com/KnapsackPro/knapsack/pull/40
|
130
173
|
|
131
|
-
https://github.com/
|
174
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.9.0...v1.10.0
|
132
175
|
|
133
176
|
### 1.9.0
|
134
177
|
|
135
178
|
* Use Knapsack.logger for runner output
|
136
179
|
|
137
|
-
https://github.com/
|
180
|
+
https://github.com/KnapsackPro/knapsack/pull/39
|
138
181
|
|
139
|
-
https://github.com/
|
182
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.8.0...v1.9.0
|
140
183
|
|
141
184
|
### 1.8.0
|
142
185
|
|
@@ -144,15 +187,15 @@ https://github.com/ArturT/knapsack/compare/v1.8.0...v1.9.0
|
|
144
187
|
|
145
188
|
https://github.com/KnapsackPro/knapsack_pro-ruby/issues/5
|
146
189
|
|
147
|
-
https://github.com/
|
190
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.7.0...v1.8.0
|
148
191
|
|
149
192
|
### 1.7.0
|
150
193
|
|
151
194
|
* Add ability to run tests from multiple directories
|
152
195
|
|
153
|
-
https://github.com/
|
196
|
+
https://github.com/KnapsackPro/knapsack/pull/35
|
154
197
|
|
155
|
-
https://github.com/
|
198
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.6.1...v1.7.0
|
156
199
|
|
157
200
|
### 1.6.1
|
158
201
|
|
@@ -160,106 +203,106 @@ https://github.com/ArturT/knapsack/compare/v1.6.1...v1.7.0
|
|
160
203
|
|
161
204
|
https://github.com/KnapsackPro/knapsack_pro-ruby/pull/4
|
162
205
|
|
163
|
-
https://github.com/
|
206
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.6.0...v1.6.1
|
164
207
|
|
165
208
|
### 1.6.0
|
166
209
|
|
167
210
|
* Add support for Cucumber 2
|
168
211
|
|
169
|
-
https://github.com/
|
212
|
+
https://github.com/KnapsackPro/knapsack/issues/30
|
170
213
|
|
171
|
-
https://github.com/
|
214
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.5.1...v1.6.0
|
172
215
|
|
173
216
|
### 1.5.1
|
174
217
|
|
175
218
|
* Add link to FAQ at the end of time offset warning
|
176
219
|
|
177
|
-
https://github.com/
|
220
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.5.0...v1.5.1
|
178
221
|
|
179
222
|
### 1.5.0
|
180
223
|
|
181
224
|
* Add support for snap-ci.com
|
182
225
|
|
183
|
-
https://github.com/
|
226
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.4.1...v1.5.0
|
184
227
|
|
185
228
|
### 1.4.1
|
186
229
|
|
187
|
-
* Update test file pattern in tests also. Related PR https://github.com/
|
230
|
+
* Update test file pattern in tests also. Related PR https://github.com/KnapsackPro/knapsack/pull/27
|
188
231
|
* Ensure there are no duplicates in leftover tests because of new test file pattern
|
189
232
|
|
190
|
-
https://github.com/
|
233
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.4.0...v1.4.1
|
191
234
|
|
192
235
|
### 1.4.0
|
193
236
|
|
194
237
|
* Rename RspecAdapter to RSpecAdapter so that it is consistent
|
195
238
|
|
196
|
-
https://github.com/
|
239
|
+
https://github.com/KnapsackPro/knapsack/pull/28
|
197
240
|
|
198
241
|
* Change file path patterns to support 1-level symlinks by default
|
199
242
|
|
200
|
-
https://github.com/
|
243
|
+
https://github.com/KnapsackPro/knapsack/pull/27
|
201
244
|
|
202
|
-
https://github.com/
|
245
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.3.4...v1.4.0
|
203
246
|
|
204
247
|
### 1.3.4
|
205
248
|
|
206
249
|
* Make knapsack backwards compatible with earlier version of minitest
|
207
250
|
|
208
|
-
https://github.com/
|
251
|
+
https://github.com/KnapsackPro/knapsack/pull/26
|
209
252
|
|
210
|
-
https://github.com/
|
253
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.3.3...v1.3.4
|
211
254
|
|
212
255
|
### 1.3.3
|
213
256
|
|
214
257
|
* Fix wrong dependency for timecop
|
215
258
|
|
216
|
-
https://github.com/
|
259
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.3.2...v1.3.3
|
217
260
|
|
218
261
|
### 1.3.2
|
219
262
|
|
220
263
|
* Use Timecop as dependency and always use Time.now_without_mock_time to avoid problem when someone did stub on Time without using Timecop.
|
221
264
|
* Don't exit on successful RSpec and Cucumber runs
|
222
265
|
|
223
|
-
https://github.com/
|
266
|
+
https://github.com/KnapsackPro/knapsack/pull/25
|
224
267
|
|
225
|
-
https://github.com/
|
268
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.3.1...v1.3.2
|
226
269
|
|
227
270
|
### 1.3.1
|
228
271
|
|
229
272
|
* Treat KNAPSACK_GENERATE_REPORT=false as generate_report -> false
|
230
273
|
|
231
|
-
https://github.com/
|
274
|
+
https://github.com/KnapsackPro/knapsack/pull/22
|
232
275
|
|
233
|
-
https://github.com/
|
276
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.3.0...v1.3.1
|
234
277
|
|
235
278
|
### 1.3.0
|
236
279
|
|
237
280
|
* Add knapsack binary
|
238
281
|
|
239
|
-
https://github.com/
|
282
|
+
https://github.com/KnapsackPro/knapsack/pull/21
|
240
283
|
|
241
|
-
https://github.com/
|
284
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.2.1...v1.3.0
|
242
285
|
|
243
286
|
### 1.2.1
|
244
287
|
|
245
288
|
* Add support for Turnip features
|
246
289
|
|
247
|
-
https://github.com/
|
290
|
+
https://github.com/KnapsackPro/knapsack/pull/19
|
248
291
|
|
249
|
-
https://github.com/
|
292
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.2.0...v1.2.1
|
250
293
|
|
251
294
|
### 1.2.0
|
252
295
|
|
253
296
|
* Add minitest adapter.
|
254
297
|
* Fix bug with missing global time execution when tests took less than second.
|
255
298
|
|
256
|
-
https://github.com/
|
299
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.1.1...v1.2.0
|
257
300
|
|
258
301
|
### 1.1.1
|
259
302
|
|
260
303
|
* Use `system` instead of `exec` in rake tasks so we can return exit code from command.
|
261
304
|
|
262
|
-
https://github.com/
|
305
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.1.0...v1.1.1
|
263
306
|
|
264
307
|
### 1.1.0
|
265
308
|
|
@@ -269,15 +312,15 @@ https://github.com/ArturT/knapsack/compare/v1.1.0...v1.1.1
|
|
269
312
|
|
270
313
|
* Pull request #12 - Raise error when CI_NODE_INDEX >= CI_NODE_TOTAL
|
271
314
|
|
272
|
-
https://github.com/
|
315
|
+
https://github.com/KnapsackPro/knapsack/pull/12
|
273
316
|
|
274
317
|
### 1.0.3
|
275
318
|
|
276
319
|
* Fix bug #11 - Track properly time when using Timecop gem in tests.
|
277
320
|
|
278
|
-
https://github.com/
|
321
|
+
https://github.com/KnapsackPro/knapsack/issues/11
|
279
322
|
|
280
|
-
https://github.com/
|
323
|
+
https://github.com/KnapsackPro/knapsack/issues/9
|
281
324
|
|
282
325
|
### 1.0.2
|
283
326
|
|
data/README.md
CHANGED
@@ -1 +1,36 @@
|
|
1
|
-
#
|
1
|
+
# knapsack gem
|
2
|
+
|
3
|
+
Knapsack splits tests evenly across parallel CI nodes to run fast CI build and save you time.
|
4
|
+
|
5
|
+
| | knapsack gem | knapsack_pro gem |
|
6
|
+
| -------------------------------------------- | ------------ | ---------------- |
|
7
|
+
| __Is free__ | ✓ Yes | ✓ Yes, [free plan](https://knapsackpro.com?utm_source=github&utm_medium=readme&utm_campaign=knapsack_gem&utm_content=free_plan) |
|
8
|
+
| __Regular Mode - a static tests split__ | ✓ Yes | ✓ Yes |
|
9
|
+
| __Queue Mode - a dynamic tests split__ <br>([ensures all CI nodes finish work at the same time](https://docs.knapsackpro.com/2020/how-to-speed-up-ruby-and-javascript-tests-with-ci-parallelisation)) | No | ✓ Yes |
|
10
|
+
| __Auto [split slow RSpec test file](https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it) between parallel CI nodes__ <br>(a single test file can be auto split by test examples between parallel jobs) | No | ✓ Yes |
|
11
|
+
| Tracking tests timing per commit, branch | No | ✓ Yes |
|
12
|
+
| Support for other programming languages | No | ✓ Yes |
|
13
|
+
| Support for CI providers | limited | ✓ Yes |
|
14
|
+
| __Installation README__ | [Install README](http://docs.knapsackpro.com/ruby/knapsack) | [Install README](https://docs.knapsackpro.com/integration/) |
|
15
|
+
|
16
|
+
[Features of knapsack vs knapsack_pro Ruby gem](https://knapsackpro.com/features/ruby_knapsack_pro_vs_knapsack?utm_source=github&utm_medium=readme&utm_campaign=knapsack_gem&utm_content=ruby_knapsack_pro_vs_knapsack)
|
17
|
+
|
18
|
+
# Do you use Heroku?
|
19
|
+
|
20
|
+
Do you know Knapsack Pro Ruby gem is available as Heroku add-on that's currently in beta and it's free to all beta users? It works with your current CI server.
|
21
|
+
https://elements.heroku.com/addons/knapsack-pro
|
22
|
+
|
23
|
+
Knapsack Pro has Queue Mode that will split Ruby & JS tests in a dynamic way across parallel CI nodes to ensure each parallel job takes a similar time. Thanks to that there is no bottleneck in your CI pipelines.
|
24
|
+
|
25
|
+
__See introduction how the Knapsack Pro add-on works__
|
26
|
+
https://youtu.be/rmXES2N0_QU
|
27
|
+
|
28
|
+
You may also find useful article how to run parallel dynos on Heroku CI to complete tests faster
|
29
|
+
https://docs.knapsackpro.com/2019/how-to-run-tests-faster-on-heroku-ci-with-parallel-dynos
|
30
|
+
|
31
|
+
## Do you know
|
32
|
+
|
33
|
+
* Knapsack Pro is risk-free integration! Knapsack Pro runs tests in Fallback Mode if your CI servers can't reach our API for any reason.
|
34
|
+
* We don't need access to your repository. Knapsack Pro is just wrapper around test runner like RSpec, Cucumber, Minitest etc.
|
35
|
+
* Hundreds of developers use Knapsack Pro every day to run fast CI builds.
|
36
|
+
* It works with other programming languages.
|
data/knapsack.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["arturtrzop@gmail.com"]
|
11
11
|
spec.summary = %q{Knapsack splits tests across CI nodes and makes sure that tests will run comparable time on each node.}
|
12
12
|
spec.description = %q{Parallel tests across CI server nodes based on each test file's time execution. It generates a test time execution report and uses it for future test runs.}
|
13
|
-
spec.homepage = "https://github.com/
|
13
|
+
spec.homepage = "https://github.com/KnapsackPro/knapsack"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
|
23
23
|
spec.add_dependency 'rake', '>= 0'
|
24
24
|
|
25
|
-
spec.add_development_dependency 'bundler', '
|
25
|
+
spec.add_development_dependency 'bundler', '>= 1.6'
|
26
26
|
spec.add_development_dependency 'rspec', '~> 3.0', '>= 2.10.0'
|
27
27
|
spec.add_development_dependency 'rspec-its', '~> 1.2'
|
28
28
|
spec.add_development_dependency 'cucumber', '>= 0'
|
@@ -6,6 +6,10 @@ module Knapsack
|
|
6
6
|
|
7
7
|
def bind_time_tracker
|
8
8
|
::RSpec.configure do |config|
|
9
|
+
config.prepend_before(:context) do
|
10
|
+
Knapsack.tracker.start_timer
|
11
|
+
end
|
12
|
+
|
9
13
|
config.prepend_before(:each) do
|
10
14
|
current_example_group =
|
11
15
|
if ::RSpec.respond_to?(:current_example)
|
@@ -14,10 +18,9 @@ module Knapsack
|
|
14
18
|
example.metadata
|
15
19
|
end
|
16
20
|
Knapsack.tracker.test_path = RSpecAdapter.test_path(current_example_group)
|
17
|
-
Knapsack.tracker.start_timer
|
18
21
|
end
|
19
22
|
|
20
|
-
config.append_after(:
|
23
|
+
config.append_after(:context) do
|
21
24
|
Knapsack.tracker.stop_timer
|
22
25
|
end
|
23
26
|
|
data/lib/knapsack/config/env.rb
CHANGED
@@ -7,11 +7,11 @@ module Knapsack
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def ci_node_total
|
10
|
-
ENV['CI_NODE_TOTAL'] || ENV['CIRCLE_NODE_TOTAL'] || ENV['SEMAPHORE_THREAD_COUNT'] || ENV['BUILDKITE_PARALLEL_JOB_COUNT'] || ENV['SNAP_WORKER_TOTAL'] || 1
|
10
|
+
ENV['CI_NODE_TOTAL'] || ENV['CIRCLE_NODE_TOTAL'] || ENV['SEMAPHORE_JOB_COUNT'] || ENV['SEMAPHORE_THREAD_COUNT'] || ENV['BUILDKITE_PARALLEL_JOB_COUNT'] || ENV['SNAP_WORKER_TOTAL'] || ENV['BITBUCKET_PARALLEL_STEP_COUNT'] || 1
|
11
11
|
end
|
12
12
|
|
13
13
|
def ci_node_index
|
14
|
-
gitlab_ci_node_index || ENV['CI_NODE_INDEX'] || ENV['CIRCLE_NODE_INDEX'] || semaphore_current_thread || ENV['BUILDKITE_PARALLEL_JOB'] || snap_ci_worker_index || 0
|
14
|
+
gitlab_ci_node_index || ENV['CI_NODE_INDEX'] || ENV['CIRCLE_NODE_INDEX'] || semaphore_job_index || semaphore_current_thread || ENV['BUILDKITE_PARALLEL_JOB'] || snap_ci_worker_index || ENV['BITBUCKET_PARALLEL_STEP'] || 0
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_file_pattern
|
@@ -36,6 +36,10 @@ module Knapsack
|
|
36
36
|
index.to_i - 1 if index
|
37
37
|
end
|
38
38
|
|
39
|
+
def semaphore_job_index
|
40
|
+
index_starting_from_one(ENV['SEMAPHORE_JOB_INDEX'])
|
41
|
+
end
|
42
|
+
|
39
43
|
def semaphore_current_thread
|
40
44
|
index_starting_from_one(ENV['SEMAPHORE_CURRENT_THREAD'])
|
41
45
|
end
|
data/lib/knapsack/presenter.rb
CHANGED
@@ -61,9 +61,13 @@ Global time execution for this CI node is fine.
|
|
61
61
|
Happy testing!}
|
62
62
|
end
|
63
63
|
str << "\n\nNeed explanation? See FAQ:"
|
64
|
-
str << "\nhttps://
|
64
|
+
str << "\nhttps://docs.knapsackpro.com/ruby/knapsack#faq"
|
65
65
|
str << "\n=================================================\n"
|
66
|
-
str << %{
|
66
|
+
str << %{See how to split tests in a dynamic way using Queue Mode to ensure all parallel nodes
|
67
|
+
finish work at a similar time even when your CI or random test execution is a bottleneck:
|
68
|
+
https://youtu.be/hUEB1XDKEFY
|
69
|
+
|
70
|
+
Sign up for Knapsack Pro here:
|
67
71
|
https://knapsackpro.com}
|
68
72
|
str << "\n=================================================\n"
|
69
73
|
str
|
data/lib/knapsack/tracker.rb
CHANGED
data/lib/knapsack/version.rb
CHANGED
@@ -24,8 +24,9 @@ describe Knapsack::Adapters::RSpecAdapter do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it do
|
27
|
+
expect(config).to receive(:prepend_before).with(:context).and_yield
|
27
28
|
expect(config).to receive(:prepend_before).with(:each).and_yield
|
28
|
-
expect(config).to receive(:append_after).with(:
|
29
|
+
expect(config).to receive(:append_after).with(:context).and_yield
|
29
30
|
expect(config).to receive(:after).with(:suite).and_yield
|
30
31
|
expect(::RSpec).to receive(:configure).and_yield(config)
|
31
32
|
|
@@ -33,10 +34,9 @@ describe Knapsack::Adapters::RSpecAdapter do
|
|
33
34
|
expect(described_class).to receive(:test_path).with(example_group).and_return(test_path)
|
34
35
|
|
35
36
|
allow(Knapsack).to receive(:tracker).and_return(tracker)
|
36
|
-
expect(tracker).to receive(:
|
37
|
-
expect(tracker).to receive(:
|
38
|
-
|
39
|
-
expect(tracker).to receive(:stop_timer)
|
37
|
+
expect(tracker).to receive(:start_timer).ordered
|
38
|
+
expect(tracker).to receive(:test_path=).with(test_path).ordered
|
39
|
+
expect(tracker).to receive(:stop_timer).ordered
|
40
40
|
|
41
41
|
expect(Knapsack::Presenter).to receive(:global_time).and_return(global_time)
|
42
42
|
expect(logger).to receive(:info).with(global_time)
|
@@ -27,6 +27,11 @@ describe Knapsack::Config::Env do
|
|
27
27
|
it { should eql 4 }
|
28
28
|
end
|
29
29
|
|
30
|
+
context 'when SEMAPHORE_JOB_COUNT has value' do
|
31
|
+
before { stub_const("ENV", { 'SEMAPHORE_JOB_COUNT' => 3 }) }
|
32
|
+
it { should eql 3 }
|
33
|
+
end
|
34
|
+
|
30
35
|
context 'when SEMAPHORE_THREAD_COUNT has value' do
|
31
36
|
before { stub_const("ENV", { 'SEMAPHORE_THREAD_COUNT' => 3 }) }
|
32
37
|
it { should eql 3 }
|
@@ -41,6 +46,11 @@ describe Knapsack::Config::Env do
|
|
41
46
|
before { stub_const("ENV", { 'SNAP_WORKER_TOTAL' => 6 }) }
|
42
47
|
it { should eql 6 }
|
43
48
|
end
|
49
|
+
|
50
|
+
context 'when BITBUCKET_PARALLEL_STEP_COUNT has value' do
|
51
|
+
before { stub_const("ENV", { 'BITBUCKET_PARALLEL_STEP_COUNT' => 8 }) }
|
52
|
+
it { should eql 8 }
|
53
|
+
end
|
44
54
|
end
|
45
55
|
|
46
56
|
context "when ENV doesn't exist" do
|
@@ -67,6 +77,11 @@ describe Knapsack::Config::Env do
|
|
67
77
|
it { should eql 2 }
|
68
78
|
end
|
69
79
|
|
80
|
+
context 'when SEMAPHORE_JOB_INDEX has value' do
|
81
|
+
before { stub_const("ENV", { 'SEMAPHORE_JOB_INDEX' => 3 }) }
|
82
|
+
it { should eql 2 }
|
83
|
+
end
|
84
|
+
|
70
85
|
context 'when SEMAPHORE_CURRENT_THREAD has value' do
|
71
86
|
before { stub_const("ENV", { 'SEMAPHORE_CURRENT_THREAD' => 1 }) }
|
72
87
|
it { should eql 0 }
|
@@ -81,6 +96,11 @@ describe Knapsack::Config::Env do
|
|
81
96
|
before { stub_const("ENV", { 'SNAP_WORKER_INDEX' => 4 }) }
|
82
97
|
it { should eql 3 }
|
83
98
|
end
|
99
|
+
|
100
|
+
context 'when BITBUCKET_PARALLEL_STEP has value' do
|
101
|
+
before { stub_const("ENV", { 'BITBUCKET_PARALLEL_STEP' => 7 }) }
|
102
|
+
it { should eql 7 }
|
103
|
+
end
|
84
104
|
end
|
85
105
|
|
86
106
|
context "when ENV doesn't exist" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knapsack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ArturT
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -28,36 +28,36 @@ dependencies:
|
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.6'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.6'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '3.0'
|
48
45
|
- - ">="
|
49
46
|
- !ruby/object:Gem::Version
|
50
47
|
version: 2.10.0
|
48
|
+
- - "~>"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '3.0'
|
51
51
|
type: :development
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
|
-
- - "~>"
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: '3.0'
|
58
55
|
- - ">="
|
59
56
|
- !ruby/object:Gem::Version
|
60
57
|
version: 2.10.0
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '3.0'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rspec-its
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -266,11 +266,11 @@ files:
|
|
266
266
|
- test_examples/fast/unit_test.rb
|
267
267
|
- test_examples/slow/slow_test.rb
|
268
268
|
- test_examples/test_helper.rb
|
269
|
-
homepage: https://github.com/
|
269
|
+
homepage: https://github.com/KnapsackPro/knapsack
|
270
270
|
licenses:
|
271
271
|
- MIT
|
272
272
|
metadata: {}
|
273
|
-
post_install_message:
|
273
|
+
post_install_message:
|
274
274
|
rdoc_options: []
|
275
275
|
require_paths:
|
276
276
|
- lib
|
@@ -285,9 +285,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
285
285
|
- !ruby/object:Gem::Version
|
286
286
|
version: '0'
|
287
287
|
requirements: []
|
288
|
-
|
289
|
-
|
290
|
-
signing_key:
|
288
|
+
rubygems_version: 3.0.6
|
289
|
+
signing_key:
|
291
290
|
specification_version: 4
|
292
291
|
summary: Knapsack splits tests across CI nodes and makes sure that tests will run
|
293
292
|
comparable time on each node.
|