knapsack 1.17.2 → 1.21.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/CHANGELOG.md +103 -63
- data/README.md +36 -1
- data/knapsack.gemspec +1 -1
- data/lib/knapsack/adapters/rspec_adapter.rb +5 -2
- data/lib/knapsack/config/env.rb +6 -2
- data/lib/knapsack/tracker.rb +15 -15
- 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
- data/spec/knapsack/tracker_spec.rb +7 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e6b6142c645cc42ac120b5872e16ac97f6d82f5f4cb0ff2993039ec754855b6
|
4
|
+
data.tar.gz: 82ce25f5e1982e4eb8d454e2e61246471e8e67427071383f360cf5a76025bcbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c95d0502a2d00acb89cf8170b726d42d7b11b2a1f1c7169ab5c1a30f17145330223aebb1ba4abe8af168bbba43ee2209a24d133728b225d790b89fd6079fd4d4
|
7
|
+
data.tar.gz: ea2f59c4f71f9bce115b13648e0d281c9cfba683ab676bbc1aa9973b154d85bc3e99d2871f15420f8822be306e7969159316d8765334348337bcb156c8532409
|
data/.travis.yml
CHANGED
@@ -2,14 +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
|
12
10
|
- 2.6
|
11
|
+
- 2.7
|
12
|
+
- truffleruby-head
|
13
13
|
addons:
|
14
14
|
code_climate:
|
15
15
|
repo_token: 38686058eed480dd0fcf8bce9015733e0bae88e44e30f4a1ac63df8aec2f86d8
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,46 @@
|
|
2
2
|
|
3
3
|
* TODO
|
4
4
|
|
5
|
+
### 1.21.1
|
6
|
+
|
7
|
+
* Fix a bug with tracking time for pending specs in RSpec
|
8
|
+
|
9
|
+
https://github.com/KnapsackPro/knapsack/pull/109
|
10
|
+
|
11
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.21.0...v1.21.1
|
12
|
+
|
13
|
+
### 1.21.0
|
14
|
+
|
15
|
+
* Track time in before and after `:context` hooks
|
16
|
+
|
17
|
+
https://github.com/KnapsackPro/knapsack/pull/107
|
18
|
+
|
19
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.20.0...v1.21.0
|
20
|
+
|
21
|
+
### 1.20.0
|
22
|
+
|
23
|
+
* Use `Process.clock_gettime` to measure track execution time
|
24
|
+
|
25
|
+
https://github.com/KnapsackPro/knapsack/pull/100
|
26
|
+
|
27
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.19.0...v1.20.0
|
28
|
+
|
29
|
+
### 1.19.0
|
30
|
+
|
31
|
+
* Add support for Bitbucket Pipelines
|
32
|
+
|
33
|
+
https://github.com/KnapsackPro/knapsack/pull/97
|
34
|
+
|
35
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.18.0...v1.19.0
|
36
|
+
|
37
|
+
### 1.18.0
|
38
|
+
|
39
|
+
* Add support for Semaphore 2.0
|
40
|
+
|
41
|
+
https://github.com/KnapsackPro/knapsack/pull/92
|
42
|
+
|
43
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.17.2...v1.18.0
|
44
|
+
|
5
45
|
### 1.17.2
|
6
46
|
|
7
47
|
* Allow for new `bundler` in development
|
@@ -9,65 +49,65 @@
|
|
9
49
|
* Add info about Knapsack Pro Queue Mode in knapsack output
|
10
50
|
* Update URL to FAQ in knapsack output
|
11
51
|
|
12
|
-
https://github.com/
|
52
|
+
https://github.com/KnapsackPro/knapsack/pull/90
|
13
53
|
|
14
|
-
https://github.com/
|
54
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.17.1...v1.17.2
|
15
55
|
|
16
56
|
### 1.17.1
|
17
57
|
|
18
58
|
* Fix RSpec signal handling by replacing process
|
19
59
|
|
20
|
-
https://github.com/
|
60
|
+
https://github.com/KnapsackPro/knapsack/pull/86
|
21
61
|
|
22
|
-
https://github.com/
|
62
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.17.0...v1.17.1
|
23
63
|
|
24
64
|
### 1.17.0
|
25
65
|
|
26
66
|
* Add support for GitLab CI ENV variable `CI_NODE_INDEX` starting from 1.
|
27
67
|
|
28
|
-
https://github.com/
|
68
|
+
https://github.com/KnapsackPro/knapsack/pull/83
|
29
69
|
|
30
|
-
https://github.com/
|
70
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.16.0...v1.17.0
|
31
71
|
|
32
72
|
### 1.16.0
|
33
73
|
|
34
74
|
* Add support for Ruby >= 1.9.3.
|
35
75
|
|
36
|
-
https://github.com/
|
76
|
+
https://github.com/KnapsackPro/knapsack/pull/77
|
37
77
|
|
38
|
-
https://github.com/
|
78
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.15.0...v1.16.0
|
39
79
|
|
40
80
|
### 1.15.0
|
41
81
|
|
42
82
|
* Add support for Cucumber 3.
|
43
83
|
|
44
|
-
https://github.com/
|
84
|
+
https://github.com/KnapsackPro/knapsack/pull/68
|
45
85
|
|
46
|
-
https://github.com/
|
86
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.14.1...v1.15.0
|
47
87
|
|
48
88
|
### 1.14.1
|
49
89
|
|
50
90
|
* Update RSpec timing adapter to be more resilient.
|
51
91
|
|
52
|
-
https://github.com/
|
92
|
+
https://github.com/KnapsackPro/knapsack/pull/64
|
53
93
|
|
54
|
-
https://github.com/
|
94
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.14.0...v1.14.1
|
55
95
|
|
56
96
|
### 1.14.0
|
57
97
|
|
58
98
|
* Moves Timecop to development dependency.
|
59
99
|
|
60
|
-
https://github.com/
|
100
|
+
https://github.com/KnapsackPro/knapsack/pull/61
|
61
101
|
|
62
|
-
https://github.com/
|
102
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.13.3...v1.14.0
|
63
103
|
|
64
104
|
### 1.13.3
|
65
105
|
|
66
106
|
* Fix: Trailing slash should be removed from allocator test_dir.
|
67
107
|
|
68
|
-
https://github.com/
|
108
|
+
https://github.com/KnapsackPro/knapsack/issues/57
|
69
109
|
|
70
|
-
https://github.com/
|
110
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.13.2...v1.13.3
|
71
111
|
|
72
112
|
### 1.13.2
|
73
113
|
|
@@ -76,78 +116,78 @@ https://github.com/ArturT/knapsack/compare/v1.13.2...v1.13.3
|
|
76
116
|
Related:
|
77
117
|
https://github.com/KnapsackPro/knapsack_pro-ruby/issues/27
|
78
118
|
|
79
|
-
https://github.com/
|
119
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.13.1...v1.13.2
|
80
120
|
|
81
121
|
### 1.13.1
|
82
122
|
|
83
123
|
* Fix: Get rid of call #zero? method on $?.exitstatus in test runners tasks
|
84
124
|
|
85
|
-
https://github.com/
|
125
|
+
https://github.com/KnapsackPro/knapsack/pull/52
|
86
126
|
|
87
|
-
https://github.com/
|
127
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.13.0...v1.13.1
|
88
128
|
|
89
129
|
### 1.13.0
|
90
130
|
|
91
131
|
* Add KNAPSACK_LOG_LEVEL option
|
92
132
|
|
93
|
-
https://github.com/
|
133
|
+
https://github.com/KnapsackPro/knapsack/pull/49
|
94
134
|
|
95
|
-
https://github.com/
|
135
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.12.2...v1.13.0
|
96
136
|
|
97
137
|
### 1.12.2
|
98
138
|
|
99
139
|
* Fix support for turnip >= 2.x
|
100
140
|
|
101
|
-
https://github.com/
|
141
|
+
https://github.com/KnapsackPro/knapsack/pull/47
|
102
142
|
|
103
|
-
https://github.com/
|
143
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.12.1...v1.12.2
|
104
144
|
|
105
145
|
### 1.12.1
|
106
146
|
|
107
147
|
* Cucumber and Spinach should load files from proper folder in case when you use custom test directory.
|
108
148
|
|
109
|
-
https://github.com/
|
149
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.12.0...v1.12.1
|
110
150
|
|
111
151
|
### 1.12.0
|
112
152
|
|
113
153
|
* Add support for Minitest::SharedExamples
|
114
154
|
|
115
|
-
https://github.com/
|
155
|
+
https://github.com/KnapsackPro/knapsack/pull/46
|
116
156
|
|
117
|
-
https://github.com/
|
157
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.11.1...v1.12.0
|
118
158
|
|
119
159
|
### 1.11.1
|
120
160
|
|
121
161
|
* 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
|
122
162
|
|
123
163
|
Related PR:
|
124
|
-
https://github.com/
|
164
|
+
https://github.com/KnapsackPro/knapsack/pull/41
|
125
165
|
|
126
|
-
https://github.com/
|
166
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.11.0...v1.11.1
|
127
167
|
|
128
168
|
### 1.11.0
|
129
169
|
|
130
170
|
* Add support for Spinach
|
131
171
|
|
132
|
-
https://github.com/
|
172
|
+
https://github.com/KnapsackPro/knapsack/pull/41
|
133
173
|
|
134
|
-
https://github.com/
|
174
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.10.0...v1.11.0
|
135
175
|
|
136
176
|
### 1.10.0
|
137
177
|
|
138
178
|
* Log the time offset warning at INFO if time not exceeded
|
139
179
|
|
140
|
-
https://github.com/
|
180
|
+
https://github.com/KnapsackPro/knapsack/pull/40
|
141
181
|
|
142
|
-
https://github.com/
|
182
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.9.0...v1.10.0
|
143
183
|
|
144
184
|
### 1.9.0
|
145
185
|
|
146
186
|
* Use Knapsack.logger for runner output
|
147
187
|
|
148
|
-
https://github.com/
|
188
|
+
https://github.com/KnapsackPro/knapsack/pull/39
|
149
189
|
|
150
|
-
https://github.com/
|
190
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.8.0...v1.9.0
|
151
191
|
|
152
192
|
### 1.8.0
|
153
193
|
|
@@ -155,15 +195,15 @@ https://github.com/ArturT/knapsack/compare/v1.8.0...v1.9.0
|
|
155
195
|
|
156
196
|
https://github.com/KnapsackPro/knapsack_pro-ruby/issues/5
|
157
197
|
|
158
|
-
https://github.com/
|
198
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.7.0...v1.8.0
|
159
199
|
|
160
200
|
### 1.7.0
|
161
201
|
|
162
202
|
* Add ability to run tests from multiple directories
|
163
203
|
|
164
|
-
https://github.com/
|
204
|
+
https://github.com/KnapsackPro/knapsack/pull/35
|
165
205
|
|
166
|
-
https://github.com/
|
206
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.6.1...v1.7.0
|
167
207
|
|
168
208
|
### 1.6.1
|
169
209
|
|
@@ -171,106 +211,106 @@ https://github.com/ArturT/knapsack/compare/v1.6.1...v1.7.0
|
|
171
211
|
|
172
212
|
https://github.com/KnapsackPro/knapsack_pro-ruby/pull/4
|
173
213
|
|
174
|
-
https://github.com/
|
214
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.6.0...v1.6.1
|
175
215
|
|
176
216
|
### 1.6.0
|
177
217
|
|
178
218
|
* Add support for Cucumber 2
|
179
219
|
|
180
|
-
https://github.com/
|
220
|
+
https://github.com/KnapsackPro/knapsack/issues/30
|
181
221
|
|
182
|
-
https://github.com/
|
222
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.5.1...v1.6.0
|
183
223
|
|
184
224
|
### 1.5.1
|
185
225
|
|
186
226
|
* Add link to FAQ at the end of time offset warning
|
187
227
|
|
188
|
-
https://github.com/
|
228
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.5.0...v1.5.1
|
189
229
|
|
190
230
|
### 1.5.0
|
191
231
|
|
192
232
|
* Add support for snap-ci.com
|
193
233
|
|
194
|
-
https://github.com/
|
234
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.4.1...v1.5.0
|
195
235
|
|
196
236
|
### 1.4.1
|
197
237
|
|
198
|
-
* Update test file pattern in tests also. Related PR https://github.com/
|
238
|
+
* Update test file pattern in tests also. Related PR https://github.com/KnapsackPro/knapsack/pull/27
|
199
239
|
* Ensure there are no duplicates in leftover tests because of new test file pattern
|
200
240
|
|
201
|
-
https://github.com/
|
241
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.4.0...v1.4.1
|
202
242
|
|
203
243
|
### 1.4.0
|
204
244
|
|
205
245
|
* Rename RspecAdapter to RSpecAdapter so that it is consistent
|
206
246
|
|
207
|
-
https://github.com/
|
247
|
+
https://github.com/KnapsackPro/knapsack/pull/28
|
208
248
|
|
209
249
|
* Change file path patterns to support 1-level symlinks by default
|
210
250
|
|
211
|
-
https://github.com/
|
251
|
+
https://github.com/KnapsackPro/knapsack/pull/27
|
212
252
|
|
213
|
-
https://github.com/
|
253
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.3.4...v1.4.0
|
214
254
|
|
215
255
|
### 1.3.4
|
216
256
|
|
217
257
|
* Make knapsack backwards compatible with earlier version of minitest
|
218
258
|
|
219
|
-
https://github.com/
|
259
|
+
https://github.com/KnapsackPro/knapsack/pull/26
|
220
260
|
|
221
|
-
https://github.com/
|
261
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.3.3...v1.3.4
|
222
262
|
|
223
263
|
### 1.3.3
|
224
264
|
|
225
265
|
* Fix wrong dependency for timecop
|
226
266
|
|
227
|
-
https://github.com/
|
267
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.3.2...v1.3.3
|
228
268
|
|
229
269
|
### 1.3.2
|
230
270
|
|
231
271
|
* Use Timecop as dependency and always use Time.now_without_mock_time to avoid problem when someone did stub on Time without using Timecop.
|
232
272
|
* Don't exit on successful RSpec and Cucumber runs
|
233
273
|
|
234
|
-
https://github.com/
|
274
|
+
https://github.com/KnapsackPro/knapsack/pull/25
|
235
275
|
|
236
|
-
https://github.com/
|
276
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.3.1...v1.3.2
|
237
277
|
|
238
278
|
### 1.3.1
|
239
279
|
|
240
280
|
* Treat KNAPSACK_GENERATE_REPORT=false as generate_report -> false
|
241
281
|
|
242
|
-
https://github.com/
|
282
|
+
https://github.com/KnapsackPro/knapsack/pull/22
|
243
283
|
|
244
|
-
https://github.com/
|
284
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.3.0...v1.3.1
|
245
285
|
|
246
286
|
### 1.3.0
|
247
287
|
|
248
288
|
* Add knapsack binary
|
249
289
|
|
250
|
-
https://github.com/
|
290
|
+
https://github.com/KnapsackPro/knapsack/pull/21
|
251
291
|
|
252
|
-
https://github.com/
|
292
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.2.1...v1.3.0
|
253
293
|
|
254
294
|
### 1.2.1
|
255
295
|
|
256
296
|
* Add support for Turnip features
|
257
297
|
|
258
|
-
https://github.com/
|
298
|
+
https://github.com/KnapsackPro/knapsack/pull/19
|
259
299
|
|
260
|
-
https://github.com/
|
300
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.2.0...v1.2.1
|
261
301
|
|
262
302
|
### 1.2.0
|
263
303
|
|
264
304
|
* Add minitest adapter.
|
265
305
|
* Fix bug with missing global time execution when tests took less than second.
|
266
306
|
|
267
|
-
https://github.com/
|
307
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.1.1...v1.2.0
|
268
308
|
|
269
309
|
### 1.1.1
|
270
310
|
|
271
311
|
* Use `system` instead of `exec` in rake tasks so we can return exit code from command.
|
272
312
|
|
273
|
-
https://github.com/
|
313
|
+
https://github.com/KnapsackPro/knapsack/compare/v1.1.0...v1.1.1
|
274
314
|
|
275
315
|
### 1.1.0
|
276
316
|
|
@@ -280,15 +320,15 @@ https://github.com/ArturT/knapsack/compare/v1.1.0...v1.1.1
|
|
280
320
|
|
281
321
|
* Pull request #12 - Raise error when CI_NODE_INDEX >= CI_NODE_TOTAL
|
282
322
|
|
283
|
-
https://github.com/
|
323
|
+
https://github.com/KnapsackPro/knapsack/pull/12
|
284
324
|
|
285
325
|
### 1.0.3
|
286
326
|
|
287
327
|
* Fix bug #11 - Track properly time when using Timecop gem in tests.
|
288
328
|
|
289
|
-
https://github.com/
|
329
|
+
https://github.com/KnapsackPro/knapsack/issues/11
|
290
330
|
|
291
|
-
https://github.com/
|
331
|
+
https://github.com/KnapsackPro/knapsack/issues/9
|
292
332
|
|
293
333
|
### 1.0.2
|
294
334
|
|
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")
|
@@ -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/tracker.rb
CHANGED
@@ -23,15 +23,19 @@ module Knapsack
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def stop_timer
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
execution_time = now_without_mock_time.to_f - @start_time
|
27
|
+
|
28
|
+
if test_path
|
29
|
+
update_global_time(execution_time)
|
30
|
+
update_test_file_time(execution_time)
|
31
|
+
@test_path = nil
|
32
|
+
end
|
33
|
+
|
34
|
+
execution_time
|
30
35
|
end
|
31
36
|
|
32
37
|
def test_path
|
33
|
-
|
34
|
-
@test_path.sub(/^\.\//, '')
|
38
|
+
@test_path.sub(/^\.\//, '') if @test_path
|
35
39
|
end
|
36
40
|
|
37
41
|
def time_exceeded?
|
@@ -62,13 +66,13 @@ module Knapsack
|
|
62
66
|
@test_path = nil
|
63
67
|
end
|
64
68
|
|
65
|
-
def update_global_time
|
66
|
-
@global_time +=
|
69
|
+
def update_global_time(execution_time)
|
70
|
+
@global_time += execution_time
|
67
71
|
end
|
68
72
|
|
69
|
-
def update_test_file_time
|
73
|
+
def update_test_file_time(execution_time)
|
70
74
|
@test_files_with_time[test_path] ||= 0
|
71
|
-
@test_files_with_time[test_path] +=
|
75
|
+
@test_files_with_time[test_path] += execution_time
|
72
76
|
end
|
73
77
|
|
74
78
|
def report_distributor
|
@@ -81,11 +85,7 @@ module Knapsack
|
|
81
85
|
end
|
82
86
|
|
83
87
|
def now_without_mock_time
|
84
|
-
|
85
|
-
Time.now_without_mock_time
|
86
|
-
else
|
87
|
-
Time.raw_now
|
88
|
-
end
|
88
|
+
Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|
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
|
@@ -48,7 +48,7 @@ describe Knapsack::Tracker do
|
|
48
48
|
|
49
49
|
context 'when test_path not set' do
|
50
50
|
it do
|
51
|
-
expect
|
51
|
+
expect(subject).to be_nil
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -133,6 +133,9 @@ describe Knapsack::Tracker do
|
|
133
133
|
it { expect(tracker.test_files_with_time.keys.size).to eql 2 }
|
134
134
|
it { expect(tracker.test_files_with_time['a_spec.rb']).to be_within(delta).of(0.1) }
|
135
135
|
it { expect(tracker.test_files_with_time['b_spec.rb']).to be_within(delta).of(0.2) }
|
136
|
+
it 'resets test_path after time is measured' do
|
137
|
+
expect(tracker.test_path).to be_nil
|
138
|
+
end
|
136
139
|
end
|
137
140
|
|
138
141
|
context "with Timecop - Timecop shouldn't have impact on measured test time" do
|
@@ -157,6 +160,9 @@ describe Knapsack::Tracker do
|
|
157
160
|
it { expect(tracker.test_files_with_time.keys.size).to eql 2 }
|
158
161
|
it { expect(tracker.test_files_with_time['a_spec.rb']).to be_within(delta).of(0) }
|
159
162
|
it { expect(tracker.test_files_with_time['b_spec.rb']).to be_within(delta).of(0) }
|
163
|
+
it 'resets test_path after time is measured' do
|
164
|
+
expect(tracker.test_path).to be_nil
|
165
|
+
end
|
160
166
|
end
|
161
167
|
end
|
162
168
|
|
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.1
|
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
|
@@ -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,8 +285,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
285
285
|
- !ruby/object:Gem::Version
|
286
286
|
version: '0'
|
287
287
|
requirements: []
|
288
|
-
rubygems_version: 3.0.
|
289
|
-
signing_key:
|
288
|
+
rubygems_version: 3.0.6
|
289
|
+
signing_key:
|
290
290
|
specification_version: 4
|
291
291
|
summary: Knapsack splits tests across CI nodes and makes sure that tests will run
|
292
292
|
comparable time on each node.
|