knapsack 1.18.0 → 1.22.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b673e54c4a69c274d1c0bea7d3ab53d603ad95d178550a6d787904803dcc728f
4
- data.tar.gz: b88dd14ffeb3dc33648ae953fc789d63cbc25a4be72d643dea6acddc09bc3f3e
3
+ metadata.gz: 3cd679c5843c5c9e43249da6da05bdfe304940b8e51a253dafe4eda8e1589524
4
+ data.tar.gz: a24ed8bac83fa9ddb0d3ef1fe0e0381cc39403e9332bf019e0cede622d5e82c8
5
5
  SHA512:
6
- metadata.gz: 2837e7b8732843c8b778c82c26c57c2f5757c6402c464a6e57f71c046c8c07f1674d9ae124ec6759808d81d557684cc62f7a5c1dda331a9265b1ebfc53cc8228
7
- data.tar.gz: 9270341918460fb18dad56753b6cba0308783940c601b6cbd88331629c3f4453fd3e15faa355a8830822cdd98b449e8b96c1f7a58015cff385ca78f0108a8fd4
6
+ metadata.gz: 4e1ae76d5393f45885c0121c812df6fe7cd233c71cc9102c0e47661d258b517e848971a62e272cc8306efff2d7b9cc6817524b6aa3b4cd05a31d81bf7bc8fdb9
7
+ data.tar.gz: d2b0078d56fc9ecc42e177139a7a02295ea7ea270ae297dc662f0d96eea51270bce4d91ddbd034cf89720bba54d605369fdf6e7b378ed77f64928ee94e5f7222
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,13 +2,53 @@
2
2
 
3
3
  * TODO
4
4
 
5
+ ### 1.22.0
6
+
7
+ * Update time offset warning
8
+
9
+ https://github.com/KnapsackPro/knapsack/pull/105
10
+
11
+ https://github.com/KnapsackPro/knapsack/compare/v1.21.1...v1.22.0
12
+
13
+ ### 1.21.1
14
+
15
+ * Fix a bug with tracking time for pending specs in RSpec
16
+
17
+ https://github.com/KnapsackPro/knapsack/pull/109
18
+
19
+ https://github.com/KnapsackPro/knapsack/compare/v1.21.0...v1.21.1
20
+
21
+ ### 1.21.0
22
+
23
+ * Track time in before and after `:context` hooks
24
+
25
+ https://github.com/KnapsackPro/knapsack/pull/107
26
+
27
+ https://github.com/KnapsackPro/knapsack/compare/v1.20.0...v1.21.0
28
+
29
+ ### 1.20.0
30
+
31
+ * Use `Process.clock_gettime` to measure track execution time
32
+
33
+ https://github.com/KnapsackPro/knapsack/pull/100
34
+
35
+ https://github.com/KnapsackPro/knapsack/compare/v1.19.0...v1.20.0
36
+
37
+ ### 1.19.0
38
+
39
+ * Add support for Bitbucket Pipelines
40
+
41
+ https://github.com/KnapsackPro/knapsack/pull/97
42
+
43
+ https://github.com/KnapsackPro/knapsack/compare/v1.18.0...v1.19.0
44
+
5
45
  ### 1.18.0
6
46
 
7
47
  * Add support for Semaphore 2.0
8
48
 
9
- https://github.com/ArturT/knapsack/pull/92
49
+ https://github.com/KnapsackPro/knapsack/pull/92
10
50
 
11
- https://github.com/ArturT/knapsack/compare/v1.17.2...v1.18.0
51
+ https://github.com/KnapsackPro/knapsack/compare/v1.17.2...v1.18.0
12
52
 
13
53
  ### 1.17.2
14
54
 
@@ -17,65 +57,65 @@ https://github.com/ArturT/knapsack/compare/v1.17.2...v1.18.0
17
57
  * Add info about Knapsack Pro Queue Mode in knapsack output
18
58
  * Update URL to FAQ in knapsack output
19
59
 
20
- https://github.com/ArturT/knapsack/pull/90
60
+ https://github.com/KnapsackPro/knapsack/pull/90
21
61
 
22
- https://github.com/ArturT/knapsack/compare/v1.17.1...v1.17.2
62
+ https://github.com/KnapsackPro/knapsack/compare/v1.17.1...v1.17.2
23
63
 
24
64
  ### 1.17.1
25
65
 
26
66
  * Fix RSpec signal handling by replacing process
27
67
 
28
- https://github.com/ArturT/knapsack/pull/86
68
+ https://github.com/KnapsackPro/knapsack/pull/86
29
69
 
30
- https://github.com/ArturT/knapsack/compare/v1.17.0...v1.17.1
70
+ https://github.com/KnapsackPro/knapsack/compare/v1.17.0...v1.17.1
31
71
 
32
72
  ### 1.17.0
33
73
 
34
74
  * Add support for GitLab CI ENV variable `CI_NODE_INDEX` starting from 1.
35
75
 
36
- https://github.com/ArturT/knapsack/pull/83
76
+ https://github.com/KnapsackPro/knapsack/pull/83
37
77
 
38
- https://github.com/ArturT/knapsack/compare/v1.16.0...v1.17.0
78
+ https://github.com/KnapsackPro/knapsack/compare/v1.16.0...v1.17.0
39
79
 
40
80
  ### 1.16.0
41
81
 
42
82
  * Add support for Ruby >= 1.9.3.
43
83
 
44
- https://github.com/ArturT/knapsack/pull/77
84
+ https://github.com/KnapsackPro/knapsack/pull/77
45
85
 
46
- https://github.com/ArturT/knapsack/compare/v1.15.0...v1.16.0
86
+ https://github.com/KnapsackPro/knapsack/compare/v1.15.0...v1.16.0
47
87
 
48
88
  ### 1.15.0
49
89
 
50
90
  * Add support for Cucumber 3.
51
91
 
52
- https://github.com/ArturT/knapsack/pull/68
92
+ https://github.com/KnapsackPro/knapsack/pull/68
53
93
 
54
- https://github.com/ArturT/knapsack/compare/v1.14.1...v1.15.0
94
+ https://github.com/KnapsackPro/knapsack/compare/v1.14.1...v1.15.0
55
95
 
56
96
  ### 1.14.1
57
97
 
58
98
  * Update RSpec timing adapter to be more resilient.
59
99
 
60
- https://github.com/ArturT/knapsack/pull/64
100
+ https://github.com/KnapsackPro/knapsack/pull/64
61
101
 
62
- https://github.com/ArturT/knapsack/compare/v1.14.0...v1.14.1
102
+ https://github.com/KnapsackPro/knapsack/compare/v1.14.0...v1.14.1
63
103
 
64
104
  ### 1.14.0
65
105
 
66
106
  * Moves Timecop to development dependency.
67
107
 
68
- https://github.com/ArturT/knapsack/pull/61
108
+ https://github.com/KnapsackPro/knapsack/pull/61
69
109
 
70
- https://github.com/ArturT/knapsack/compare/v1.13.3...v1.14.0
110
+ https://github.com/KnapsackPro/knapsack/compare/v1.13.3...v1.14.0
71
111
 
72
112
  ### 1.13.3
73
113
 
74
114
  * Fix: Trailing slash should be removed from allocator test_dir.
75
115
 
76
- https://github.com/ArturT/knapsack/issues/57
116
+ https://github.com/KnapsackPro/knapsack/issues/57
77
117
 
78
- https://github.com/ArturT/knapsack/compare/v1.13.2...v1.13.3
118
+ https://github.com/KnapsackPro/knapsack/compare/v1.13.2...v1.13.3
79
119
 
80
120
  ### 1.13.2
81
121
 
@@ -84,78 +124,78 @@ https://github.com/ArturT/knapsack/compare/v1.13.2...v1.13.3
84
124
  Related:
85
125
  https://github.com/KnapsackPro/knapsack_pro-ruby/issues/27
86
126
 
87
- https://github.com/ArturT/knapsack/compare/v1.13.1...v1.13.2
127
+ https://github.com/KnapsackPro/knapsack/compare/v1.13.1...v1.13.2
88
128
 
89
129
  ### 1.13.1
90
130
 
91
131
  * Fix: Get rid of call #zero? method on $?.exitstatus in test runners tasks
92
132
 
93
- https://github.com/ArturT/knapsack/pull/52
133
+ https://github.com/KnapsackPro/knapsack/pull/52
94
134
 
95
- https://github.com/ArturT/knapsack/compare/v1.13.0...v1.13.1
135
+ https://github.com/KnapsackPro/knapsack/compare/v1.13.0...v1.13.1
96
136
 
97
137
  ### 1.13.0
98
138
 
99
139
  * Add KNAPSACK_LOG_LEVEL option
100
140
 
101
- https://github.com/ArturT/knapsack/pull/49
141
+ https://github.com/KnapsackPro/knapsack/pull/49
102
142
 
103
- https://github.com/ArturT/knapsack/compare/v1.12.2...v1.13.0
143
+ https://github.com/KnapsackPro/knapsack/compare/v1.12.2...v1.13.0
104
144
 
105
145
  ### 1.12.2
106
146
 
107
147
  * Fix support for turnip >= 2.x
108
148
 
109
- https://github.com/ArturT/knapsack/pull/47
149
+ https://github.com/KnapsackPro/knapsack/pull/47
110
150
 
111
- https://github.com/ArturT/knapsack/compare/v1.12.1...v1.12.2
151
+ https://github.com/KnapsackPro/knapsack/compare/v1.12.1...v1.12.2
112
152
 
113
153
  ### 1.12.1
114
154
 
115
155
  * Cucumber and Spinach should load files from proper folder in case when you use custom test directory.
116
156
 
117
- https://github.com/ArturT/knapsack/compare/v1.12.0...v1.12.1
157
+ https://github.com/KnapsackPro/knapsack/compare/v1.12.0...v1.12.1
118
158
 
119
159
  ### 1.12.0
120
160
 
121
161
  * Add support for Minitest::SharedExamples
122
162
 
123
- https://github.com/ArturT/knapsack/pull/46
163
+ https://github.com/KnapsackPro/knapsack/pull/46
124
164
 
125
- https://github.com/ArturT/knapsack/compare/v1.11.1...v1.12.0
165
+ https://github.com/KnapsackPro/knapsack/compare/v1.11.1...v1.12.0
126
166
 
127
167
  ### 1.11.1
128
168
 
129
169
  * 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
130
170
 
131
171
  Related PR:
132
- https://github.com/ArturT/knapsack/pull/41
172
+ https://github.com/KnapsackPro/knapsack/pull/41
133
173
 
134
- https://github.com/ArturT/knapsack/compare/v1.11.0...v1.11.1
174
+ https://github.com/KnapsackPro/knapsack/compare/v1.11.0...v1.11.1
135
175
 
136
176
  ### 1.11.0
137
177
 
138
178
  * Add support for Spinach
139
179
 
140
- https://github.com/ArturT/knapsack/pull/41
180
+ https://github.com/KnapsackPro/knapsack/pull/41
141
181
 
142
- https://github.com/ArturT/knapsack/compare/v1.10.0...v1.11.0
182
+ https://github.com/KnapsackPro/knapsack/compare/v1.10.0...v1.11.0
143
183
 
144
184
  ### 1.10.0
145
185
 
146
186
  * Log the time offset warning at INFO if time not exceeded
147
187
 
148
- https://github.com/ArturT/knapsack/pull/40
188
+ https://github.com/KnapsackPro/knapsack/pull/40
149
189
 
150
- https://github.com/ArturT/knapsack/compare/v1.9.0...v1.10.0
190
+ https://github.com/KnapsackPro/knapsack/compare/v1.9.0...v1.10.0
151
191
 
152
192
  ### 1.9.0
153
193
 
154
194
  * Use Knapsack.logger for runner output
155
195
 
156
- https://github.com/ArturT/knapsack/pull/39
196
+ https://github.com/KnapsackPro/knapsack/pull/39
157
197
 
158
- https://github.com/ArturT/knapsack/compare/v1.8.0...v1.9.0
198
+ https://github.com/KnapsackPro/knapsack/compare/v1.8.0...v1.9.0
159
199
 
160
200
  ### 1.8.0
161
201
 
@@ -163,15 +203,15 @@ https://github.com/ArturT/knapsack/compare/v1.8.0...v1.9.0
163
203
 
164
204
  https://github.com/KnapsackPro/knapsack_pro-ruby/issues/5
165
205
 
166
- https://github.com/ArturT/knapsack/compare/v1.7.0...v1.8.0
206
+ https://github.com/KnapsackPro/knapsack/compare/v1.7.0...v1.8.0
167
207
 
168
208
  ### 1.7.0
169
209
 
170
210
  * Add ability to run tests from multiple directories
171
211
 
172
- https://github.com/ArturT/knapsack/pull/35
212
+ https://github.com/KnapsackPro/knapsack/pull/35
173
213
 
174
- https://github.com/ArturT/knapsack/compare/v1.6.1...v1.7.0
214
+ https://github.com/KnapsackPro/knapsack/compare/v1.6.1...v1.7.0
175
215
 
176
216
  ### 1.6.1
177
217
 
@@ -179,106 +219,106 @@ https://github.com/ArturT/knapsack/compare/v1.6.1...v1.7.0
179
219
 
180
220
  https://github.com/KnapsackPro/knapsack_pro-ruby/pull/4
181
221
 
182
- https://github.com/ArturT/knapsack/compare/v1.6.0...v1.6.1
222
+ https://github.com/KnapsackPro/knapsack/compare/v1.6.0...v1.6.1
183
223
 
184
224
  ### 1.6.0
185
225
 
186
226
  * Add support for Cucumber 2
187
227
 
188
- https://github.com/ArturT/knapsack/issues/30
228
+ https://github.com/KnapsackPro/knapsack/issues/30
189
229
 
190
- https://github.com/ArturT/knapsack/compare/v1.5.1...v1.6.0
230
+ https://github.com/KnapsackPro/knapsack/compare/v1.5.1...v1.6.0
191
231
 
192
232
  ### 1.5.1
193
233
 
194
234
  * Add link to FAQ at the end of time offset warning
195
235
 
196
- https://github.com/ArturT/knapsack/compare/v1.5.0...v1.5.1
236
+ https://github.com/KnapsackPro/knapsack/compare/v1.5.0...v1.5.1
197
237
 
198
238
  ### 1.5.0
199
239
 
200
240
  * Add support for snap-ci.com
201
241
 
202
- https://github.com/ArturT/knapsack/compare/v1.4.1...v1.5.0
242
+ https://github.com/KnapsackPro/knapsack/compare/v1.4.1...v1.5.0
203
243
 
204
244
  ### 1.4.1
205
245
 
206
- * Update test file pattern in tests also. Related PR https://github.com/ArturT/knapsack/pull/27
246
+ * Update test file pattern in tests also. Related PR https://github.com/KnapsackPro/knapsack/pull/27
207
247
  * Ensure there are no duplicates in leftover tests because of new test file pattern
208
248
 
209
- https://github.com/ArturT/knapsack/compare/v1.4.0...v1.4.1
249
+ https://github.com/KnapsackPro/knapsack/compare/v1.4.0...v1.4.1
210
250
 
211
251
  ### 1.4.0
212
252
 
213
253
  * Rename RspecAdapter to RSpecAdapter so that it is consistent
214
254
 
215
- https://github.com/ArturT/knapsack/pull/28
255
+ https://github.com/KnapsackPro/knapsack/pull/28
216
256
 
217
257
  * Change file path patterns to support 1-level symlinks by default
218
258
 
219
- https://github.com/ArturT/knapsack/pull/27
259
+ https://github.com/KnapsackPro/knapsack/pull/27
220
260
 
221
- https://github.com/ArturT/knapsack/compare/v1.3.4...v1.4.0
261
+ https://github.com/KnapsackPro/knapsack/compare/v1.3.4...v1.4.0
222
262
 
223
263
  ### 1.3.4
224
264
 
225
265
  * Make knapsack backwards compatible with earlier version of minitest
226
266
 
227
- https://github.com/ArturT/knapsack/pull/26
267
+ https://github.com/KnapsackPro/knapsack/pull/26
228
268
 
229
- https://github.com/ArturT/knapsack/compare/v1.3.3...v1.3.4
269
+ https://github.com/KnapsackPro/knapsack/compare/v1.3.3...v1.3.4
230
270
 
231
271
  ### 1.3.3
232
272
 
233
273
  * Fix wrong dependency for timecop
234
274
 
235
- https://github.com/ArturT/knapsack/compare/v1.3.2...v1.3.3
275
+ https://github.com/KnapsackPro/knapsack/compare/v1.3.2...v1.3.3
236
276
 
237
277
  ### 1.3.2
238
278
 
239
279
  * Use Timecop as dependency and always use Time.now_without_mock_time to avoid problem when someone did stub on Time without using Timecop.
240
280
  * Don't exit on successful RSpec and Cucumber runs
241
281
 
242
- https://github.com/ArturT/knapsack/pull/25
282
+ https://github.com/KnapsackPro/knapsack/pull/25
243
283
 
244
- https://github.com/ArturT/knapsack/compare/v1.3.1...v1.3.2
284
+ https://github.com/KnapsackPro/knapsack/compare/v1.3.1...v1.3.2
245
285
 
246
286
  ### 1.3.1
247
287
 
248
288
  * Treat KNAPSACK_GENERATE_REPORT=false as generate_report -> false
249
289
 
250
- https://github.com/ArturT/knapsack/pull/22
290
+ https://github.com/KnapsackPro/knapsack/pull/22
251
291
 
252
- https://github.com/ArturT/knapsack/compare/v1.3.0...v1.3.1
292
+ https://github.com/KnapsackPro/knapsack/compare/v1.3.0...v1.3.1
253
293
 
254
294
  ### 1.3.0
255
295
 
256
296
  * Add knapsack binary
257
297
 
258
- https://github.com/ArturT/knapsack/pull/21
298
+ https://github.com/KnapsackPro/knapsack/pull/21
259
299
 
260
- https://github.com/ArturT/knapsack/compare/v1.2.1...v1.3.0
300
+ https://github.com/KnapsackPro/knapsack/compare/v1.2.1...v1.3.0
261
301
 
262
302
  ### 1.2.1
263
303
 
264
304
  * Add support for Turnip features
265
305
 
266
- https://github.com/ArturT/knapsack/pull/19
306
+ https://github.com/KnapsackPro/knapsack/pull/19
267
307
 
268
- https://github.com/ArturT/knapsack/compare/v1.2.0...v1.2.1
308
+ https://github.com/KnapsackPro/knapsack/compare/v1.2.0...v1.2.1
269
309
 
270
310
  ### 1.2.0
271
311
 
272
312
  * Add minitest adapter.
273
313
  * Fix bug with missing global time execution when tests took less than second.
274
314
 
275
- https://github.com/ArturT/knapsack/compare/v1.1.1...v1.2.0
315
+ https://github.com/KnapsackPro/knapsack/compare/v1.1.1...v1.2.0
276
316
 
277
317
  ### 1.1.1
278
318
 
279
319
  * Use `system` instead of `exec` in rake tasks so we can return exit code from command.
280
320
 
281
- https://github.com/ArturT/knapsack/compare/v1.1.0...v1.1.1
321
+ https://github.com/KnapsackPro/knapsack/compare/v1.1.0...v1.1.1
282
322
 
283
323
  ### 1.1.0
284
324
 
@@ -288,15 +328,15 @@ https://github.com/ArturT/knapsack/compare/v1.1.0...v1.1.1
288
328
 
289
329
  * Pull request #12 - Raise error when CI_NODE_INDEX >= CI_NODE_TOTAL
290
330
 
291
- https://github.com/ArturT/knapsack/pull/12
331
+ https://github.com/KnapsackPro/knapsack/pull/12
292
332
 
293
333
  ### 1.0.3
294
334
 
295
335
  * Fix bug #11 - Track properly time when using Timecop gem in tests.
296
336
 
297
- https://github.com/ArturT/knapsack/issues/11
337
+ https://github.com/KnapsackPro/knapsack/issues/11
298
338
 
299
- https://github.com/ArturT/knapsack/issues/9
339
+ https://github.com/KnapsackPro/knapsack/issues/9
300
340
 
301
341
  ### 1.0.2
302
342
 
data/README.md CHANGED
@@ -1 +1,36 @@
1
- # [Open README](http://docs.knapsackpro.com/ruby/knapsack)
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/ArturT/knapsack"
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(:each) do
23
+ config.append_after(:context) do
21
24
  Knapsack.tracker.stop_timer
22
25
  end
23
26
 
@@ -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_JOB_COUNT'] || 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_job_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
@@ -51,10 +51,14 @@ module Knapsack
51
51
  }
52
52
  if Knapsack.tracker.time_exceeded?
53
53
  str << %{
54
- Tests on this CI node took more than max allowed node time execution.
54
+ Test on this CI node ran for longer than the max allowed node time execution.
55
55
  Please regenerate your knapsack report.
56
- If that didn't help then split your heavy test file
57
- or bump time_offset_in_seconds setting.}
56
+
57
+ If that doesn't help, you can split your slowest test files into smaller files, or bump up the time_offset_in_seconds setting.
58
+
59
+ You can also allow the knapsack_pro gem to automatically divide your slow test files across parallel CI nodes.
60
+ https://knapsackpro.com/faq/question/how-to-auto-split-test-files-by-test-cases-on-parallel-jobs-ci-nodes?utm_source=knapsack_gem&utm_medium=knapsack_gem_output&utm_campaign=knapsack_gem_time_offset_warning
61
+ }
58
62
  else
59
63
  str << %{
60
64
  Global time execution for this CI node is fine.
@@ -63,9 +67,8 @@ Happy testing!}
63
67
  str << "\n\nNeed explanation? See FAQ:"
64
68
  str << "\nhttps://docs.knapsackpro.com/ruby/knapsack#faq"
65
69
  str << "\n=================================================\n"
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
70
+ str << %{Read up on the benefits of a dynamic test split with Knapsack Pro Queue Mode:
71
+ https://docs.knapsackpro.com/2020/how-to-speed-up-ruby-and-javascript-tests-with-ci-parallelisation
69
72
 
70
73
  Sign up for Knapsack Pro here:
71
74
  https://knapsackpro.com}
@@ -23,15 +23,19 @@ module Knapsack
23
23
  end
24
24
 
25
25
  def stop_timer
26
- @execution_time = now_without_mock_time.to_f - @start_time
27
- update_global_time
28
- update_test_file_time
29
- @execution_time
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
- raise("test_path needs to be set by Knapsack Adapter's bind method") unless @test_path
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 += @execution_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] += @execution_time
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
- if defined?(Timecop)
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
@@ -1,3 +1,3 @@
1
1
  module Knapsack
2
- VERSION = '1.18.0'
2
+ VERSION = '1.22.0'
3
3
  end
@@ -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(:each).and_yield
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(:test_path=).with(test_path)
37
- expect(tracker).to receive(:start_timer)
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)
@@ -46,6 +46,11 @@ describe Knapsack::Config::Env do
46
46
  before { stub_const("ENV", { 'SNAP_WORKER_TOTAL' => 6 }) }
47
47
  it { should eql 6 }
48
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
49
54
  end
50
55
 
51
56
  context "when ENV doesn't exist" do
@@ -91,6 +96,11 @@ describe Knapsack::Config::Env do
91
96
  before { stub_const("ENV", { 'SNAP_WORKER_INDEX' => 4 }) }
92
97
  it { should eql 3 }
93
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
94
104
  end
95
105
 
96
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 { subject }.to raise_error("test_path needs to be set by Knapsack Adapter's bind method")
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.18.0
4
+ version: 1.22.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: 2019-08-23 00:00:00.000000000 Z
11
+ date: 2021-04-20 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/ArturT/knapsack
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.3
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.