knapsack_pro 6.0.3 → 7.0.0
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/.circleci/config.yml +375 -28
- data/.github/pull_request_template.md +22 -0
- data/.gitignore +4 -0
- data/CHANGELOG.md +95 -0
- data/Gemfile +9 -0
- data/README.md +0 -7
- data/knapsack_pro.gemspec +2 -1
- data/lib/knapsack_pro/adapters/base_adapter.rb +7 -2
- data/lib/knapsack_pro/adapters/cucumber_adapter.rb +1 -3
- data/lib/knapsack_pro/adapters/rspec_adapter.rb +16 -9
- data/lib/knapsack_pro/config/env.rb +1 -9
- data/lib/knapsack_pro/extensions/rspec_extension.rb +137 -0
- data/lib/knapsack_pro/formatters/time_tracker.rb +10 -26
- data/lib/knapsack_pro/formatters/time_tracker_fetcher.rb +8 -0
- data/lib/knapsack_pro/presenter.rb +1 -1
- data/lib/knapsack_pro/pure/queue/rspec_pure.rb +92 -0
- data/lib/knapsack_pro/runners/queue/base_runner.rb +6 -1
- data/lib/knapsack_pro/runners/queue/cucumber_runner.rb +6 -6
- data/lib/knapsack_pro/runners/queue/minitest_runner.rb +10 -6
- data/lib/knapsack_pro/runners/queue/rspec_runner.rb +124 -173
- data/lib/knapsack_pro/urls.rb +2 -0
- data/lib/knapsack_pro/version.rb +1 -1
- data/lib/knapsack_pro.rb +1 -0
- data/spec/integration/runners/queue/rspec_runner.rb +80 -0
- data/spec/integration/runners/queue/rspec_runner_spec.rb +2232 -0
- data/spec/knapsack_pro/adapters/base_adapter_spec.rb +17 -11
- data/spec/knapsack_pro/adapters/cucumber_adapter_spec.rb +2 -5
- data/spec/knapsack_pro/adapters/rspec_adapter_spec.rb +2 -24
- data/spec/knapsack_pro/config/env_spec.rb +1 -35
- data/spec/knapsack_pro/formatters/time_tracker_specs.rb +8 -37
- data/spec/knapsack_pro/hooks/queue_spec.rb +2 -2
- data/spec/knapsack_pro/presenter_spec.rb +1 -1
- data/spec/knapsack_pro/pure/queue/rspec_pure_spec.rb +224 -0
- data/spec/knapsack_pro/runners/queue/cucumber_runner_spec.rb +16 -16
- data/spec/knapsack_pro/runners/queue/minitest_runner_spec.rb +14 -14
- data/spec/knapsack_pro_spec.rb +3 -3
- data/spec/spec_helper.rb +0 -1
- metadata +17 -12
- data/lib/knapsack_pro/formatters/rspec_queue_profile_formatter_extension.rb +0 -58
- data/lib/knapsack_pro/formatters/rspec_queue_summary_formatter.rb +0 -145
- data/spec/knapsack_pro/runners/queue/rspec_runner_spec.rb +0 -536
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f27ac674f611af638b9d0ea3dd1d3441a9e680e70296738ff5b93d5d18f9741
|
4
|
+
data.tar.gz: 79bdc380a1c882178b4a3cde626de7e2db1d30ae64ae1a301f023a5ff5d71623
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75bf722c575fce515b8a1a79f7e05ad5ed8ce6f69c05f4ff7cff8fdd570e5eb3e170cbf83765c66b2d1a187a5c076235637188ef9e7bd9d3d703fa37d1bf989c
|
7
|
+
data.tar.gz: 1a355724b69bd0d62b23dd32b6e995dbdd882d0fcb0299d5cddb42c3b4c0635a588839c7194cfb2af83504d91ba4db192a68cc393a8380713450b44971c682bf
|
data/.circleci/config.yml
CHANGED
@@ -1,45 +1,392 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
4
|
-
#
|
5
|
-
version: 2
|
6
|
-
jobs:
|
7
|
-
build:
|
8
|
-
parallelism: 1
|
9
|
-
docker:
|
10
|
-
# specify the version you desire here
|
11
|
-
# https://circleci.com/developer/images/image/cimg/ruby
|
12
|
-
- image: cimg/ruby:3.2.1
|
13
|
-
environment:
|
14
|
-
CODECLIMATE_REPO_TOKEN: b6626e682a8e97e0c5978febc92c3526792a2d018b41b8e1b52689da37fb7d92
|
15
|
-
|
16
|
-
working_directory: ~/knapsack_pro-ruby
|
1
|
+
version: 2.1
|
17
2
|
|
3
|
+
commands:
|
4
|
+
setup_knapsack_pro_ruby:
|
18
5
|
steps:
|
19
6
|
- checkout
|
20
|
-
|
21
|
-
# Download and cache dependencies
|
22
7
|
- restore_cache:
|
23
8
|
keys:
|
24
|
-
-
|
25
|
-
|
26
|
-
|
9
|
+
- v1-bundler-ruby-{{ checksum "knapsack_pro.gemspec" }}
|
10
|
+
- v1-bundler-ruby-
|
11
|
+
- run:
|
12
|
+
command: |
|
13
|
+
bundle config set --local path './vendor/bundle'
|
14
|
+
bundle install --jobs=4 --retry=3
|
15
|
+
- save_cache:
|
16
|
+
paths:
|
17
|
+
- ./vendor/bundle
|
18
|
+
key: v1-bundler-ruby-{{ checksum "knapsack_pro.gemspec" }}
|
27
19
|
|
20
|
+
setup_rails_app_with_knapsack_pro:
|
21
|
+
parameters:
|
22
|
+
path:
|
23
|
+
type: string
|
24
|
+
ruby:
|
25
|
+
type: string
|
26
|
+
rspec:
|
27
|
+
type: string
|
28
|
+
default: ""
|
29
|
+
steps:
|
28
30
|
- run:
|
29
|
-
|
31
|
+
working_directory: << parameters.path >>
|
30
32
|
command: |
|
31
|
-
|
33
|
+
git clone --depth 1 --branch $CIRCLE_BRANCH --single-branch git@github.com:KnapsackPro/rails-app-with-knapsack_pro.git ./ || git clone --depth 1 git@github.com:KnapsackPro/rails-app-with-knapsack_pro.git ./
|
34
|
+
if [[ "<< parameters.rspec >>" != "" ]]; then
|
35
|
+
sed -i 's/.*gem.*rspec-core.*/gem "rspec-core", "<< parameters.rspec >>"/g' ./Gemfile
|
36
|
+
echo "Updated RSpec version in Gemfile"
|
37
|
+
fi
|
38
|
+
- restore_cache:
|
39
|
+
keys:
|
40
|
+
- v1-bundler-rails-{{ checksum "Gemfile.lock" }}-ruby-<< parameters.ruby >>-rspec-<< parameters.rspec >>
|
41
|
+
- v1-bundler-rails-{{ checksum "Gemfile.lock" }}-ruby-<< parameters.ruby >>-
|
42
|
+
- v1-bundler-rails-{{ checksum "Gemfile.lock" }}-
|
43
|
+
- v1-bundler-rails-
|
44
|
+
- run:
|
45
|
+
working_directory: << parameters.path >>
|
46
|
+
command: |
|
47
|
+
bundle config set --local path './vendor/bundle'
|
48
|
+
bundle install --jobs=4 --retry=3
|
49
|
+
- save_cache:
|
50
|
+
paths:
|
51
|
+
- << parameters.path >>/vendor/bundle
|
52
|
+
key: v1-bundler-rails-{{ checksum "Gemfile.lock" }}-ruby-<< parameters.ruby >>-rspec-<< parameters.rspec >>
|
32
53
|
|
54
|
+
jobs:
|
55
|
+
unit:
|
56
|
+
parallelism: 1
|
57
|
+
working_directory: ~/knapsack_pro-ruby
|
58
|
+
resource_class: small
|
59
|
+
docker:
|
60
|
+
- image: cimg/ruby:3.3
|
61
|
+
steps:
|
62
|
+
- setup_knapsack_pro_ruby
|
33
63
|
- run: gem install rubocop
|
64
|
+
- run: rubocop --fail-level A --only Style/FrozenStringLiteralComment,Layout/EmptyLineAfterMagicComment lib/
|
65
|
+
- run: bundle exec rspec spec
|
66
|
+
- run: bundle exec ruby spec/knapsack_pro/formatters/time_tracker_specs.rb
|
34
67
|
|
68
|
+
integration-rspec:
|
69
|
+
parallelism: 1
|
70
|
+
working_directory: ~/knapsack_pro-ruby
|
71
|
+
resource_class: small
|
72
|
+
parameters:
|
73
|
+
ruby:
|
74
|
+
type: string
|
75
|
+
rspec:
|
76
|
+
type: string
|
77
|
+
docker:
|
78
|
+
- image: cimg/ruby:<< parameters.ruby >>
|
79
|
+
steps:
|
80
|
+
- checkout
|
81
|
+
- run:
|
82
|
+
command: |
|
83
|
+
if [[ "<< parameters.rspec >>" != "" ]]; then
|
84
|
+
sed -i 's/.*gem.*rspec-core.*/gem "rspec-core", "<< parameters.rspec >>"/g' ./Gemfile
|
85
|
+
echo "Updated RSpec version in Gemfile"
|
86
|
+
fi
|
87
|
+
- restore_cache:
|
88
|
+
keys:
|
89
|
+
- v1-bundler-gem-{{ checksum "knapsack_pro.gemspec" }}-ruby-<< parameters.ruby >>-rspec-<< parameters.rspec >>
|
90
|
+
- v1-bundler-gem-{{ checksum "knapsack_pro.gemspec" }}-ruby-<< parameters.ruby >>-
|
91
|
+
- v1-bundler-gem-{{ checksum "knapsack_pro.gemspec" }}-
|
92
|
+
- v1-bundler-gem-
|
93
|
+
- run:
|
94
|
+
command: |
|
95
|
+
bundle config set --local path './vendor/bundle'
|
96
|
+
bundle install --jobs=4 --retry=3
|
35
97
|
- save_cache:
|
36
98
|
paths:
|
37
99
|
- ./vendor/bundle
|
38
|
-
key:
|
100
|
+
key: v1-bundler-gem-{{ checksum "knapsack_pro.gemspec" }}-ruby-<< parameters.ruby >>-rspec-<< parameters.rspec >>
|
101
|
+
- run:
|
102
|
+
command: |
|
103
|
+
ruby --version
|
104
|
+
bundle exec rspec --version
|
105
|
+
RSPEC=$(bundle exec rspec --version | grep rspec-core | head -n1 | cut -d " " -f5)
|
106
|
+
[ $RSPEC != << parameters.rspec >> ] && exit 1 || echo "Correct version of RSpec installed: $RSPEC"
|
107
|
+
- run: bundle exec rspec spec/integration/runners/queue/rspec_runner_spec.rb
|
39
108
|
|
40
|
-
|
41
|
-
|
109
|
+
e2e-regular-rspec:
|
110
|
+
parallelism: 2
|
111
|
+
working_directory: ~/knapsack_pro-ruby
|
112
|
+
resource_class: small
|
113
|
+
parameters:
|
114
|
+
ruby:
|
115
|
+
type: string
|
116
|
+
rspec:
|
117
|
+
type: string
|
118
|
+
docker:
|
119
|
+
- image: cimg/ruby:<< parameters.ruby >>-browsers
|
120
|
+
environment:
|
121
|
+
PGHOST: 127.0.0.1
|
122
|
+
PGUSER: rails-app-with-knapsack_pro
|
123
|
+
RAILS_ENV: test
|
124
|
+
RACK_ENV: test
|
125
|
+
KNAPSACK_PRO_ENDPOINT: https://api-staging.knapsackpro.com
|
126
|
+
KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: $KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC
|
127
|
+
EXTRA_TEST_FILES_DELAY: 10
|
128
|
+
- image: cimg/postgres:14.7
|
129
|
+
environment:
|
130
|
+
POSTGRES_DB: rails-app-with-knapsack_pro_test
|
131
|
+
POSTGRES_PASSWORD: password
|
132
|
+
POSTGRES_USER: rails-app-with-knapsack_pro
|
133
|
+
steps:
|
134
|
+
- setup_knapsack_pro_ruby
|
135
|
+
- setup_rails_app_with_knapsack_pro:
|
136
|
+
path: ~/rails-app-with-knapsack_pro
|
137
|
+
ruby: << parameters.ruby >>
|
138
|
+
rspec: << parameters.rspec >>
|
139
|
+
- run: dockerize -wait tcp://localhost:5432 -timeout 1m
|
140
|
+
- run:
|
141
|
+
working_directory: ~/rails-app-with-knapsack_pro
|
142
|
+
command: |
|
143
|
+
ruby --version
|
144
|
+
bundle exec rspec --version
|
145
|
+
RSPEC=$(bundle exec rspec --version | grep rspec-core | head -n1 | cut -d " " -f5)
|
146
|
+
[ $RSPEC != << parameters.rspec >> ] && exit 1 || echo "Correct version of RSpec installed: $RSPEC"
|
147
|
+
- run:
|
148
|
+
working_directory: ~/rails-app-with-knapsack_pro
|
149
|
+
command: bin/rails db:setup
|
150
|
+
- run:
|
151
|
+
working_directory: ~/rails-app-with-knapsack_pro
|
152
|
+
command: |
|
153
|
+
export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--regular"
|
154
|
+
bundle exec rake knapsack_pro:rspec
|
155
|
+
- run:
|
156
|
+
working_directory: ~/rails-app-with-knapsack_pro
|
157
|
+
command: |
|
158
|
+
# fallback ||
|
159
|
+
export KNAPSACK_PRO_ENDPOINT=https://api-fake.knapsackpro.com
|
160
|
+
export KNAPSACK_PRO_MAX_REQUEST_RETRIES=1
|
161
|
+
bundle exec rake knapsack_pro:rspec
|
162
|
+
- run:
|
163
|
+
working_directory: ~/rails-app-with-knapsack_pro
|
164
|
+
command: |
|
165
|
+
# split by test examples ||
|
166
|
+
export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--regular--split"
|
167
|
+
export KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES=true
|
168
|
+
bundle exec rake knapsack_pro:rspec
|
169
|
+
- run:
|
170
|
+
working_directory: ~/rails-app-with-knapsack_pro
|
171
|
+
command: |
|
172
|
+
# split custom files by test examples ||
|
173
|
+
export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--regular--split-custom-files"
|
174
|
+
export KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES=true
|
175
|
+
export KNAPSACK_PRO_SLOW_TEST_FILE_PATTERN="spec/features/calculator_spec.rb"
|
176
|
+
bundle exec rake knapsack_pro:rspec
|
42
177
|
|
43
|
-
|
178
|
+
e2e-queue-rspec:
|
179
|
+
parameters:
|
180
|
+
ruby:
|
181
|
+
type: string
|
182
|
+
rspec:
|
183
|
+
type: string
|
184
|
+
parallelism: 2
|
185
|
+
working_directory: ~/knapsack_pro-ruby
|
186
|
+
resource_class: small
|
187
|
+
docker:
|
188
|
+
- image: cimg/ruby:<< parameters.ruby >>-browsers
|
189
|
+
environment:
|
190
|
+
PGHOST: 127.0.0.1
|
191
|
+
PGUSER: rails-app-with-knapsack_pro
|
192
|
+
RAILS_ENV: test
|
193
|
+
RACK_ENV: test
|
194
|
+
KNAPSACK_PRO_ENDPOINT: https://api-staging.knapsackpro.com
|
195
|
+
KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: $KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC
|
196
|
+
EXTRA_TEST_FILES_DELAY: 10
|
197
|
+
- image: cimg/postgres:14.7
|
198
|
+
environment:
|
199
|
+
POSTGRES_DB: rails-app-with-knapsack_pro_test
|
200
|
+
POSTGRES_PASSWORD: password
|
201
|
+
POSTGRES_USER: rails-app-with-knapsack_pro
|
202
|
+
steps:
|
203
|
+
- setup_knapsack_pro_ruby
|
204
|
+
- setup_rails_app_with_knapsack_pro:
|
205
|
+
path: ~/rails-app-with-knapsack_pro
|
206
|
+
ruby: << parameters.ruby >>
|
207
|
+
rspec: << parameters.rspec >>
|
208
|
+
- run: dockerize -wait tcp://localhost:5432 -timeout 1m
|
209
|
+
- run:
|
210
|
+
working_directory: ~/rails-app-with-knapsack_pro
|
211
|
+
command: |
|
212
|
+
ruby --version
|
213
|
+
bundle exec rspec --version
|
214
|
+
RSPEC=$(bundle exec rspec --version | grep rspec-core | head -n1 | cut -d " " -f5)
|
215
|
+
[ $RSPEC != << parameters.rspec >> ] && exit 1 || echo "Correct version of RSpec installed: $RSPEC"
|
216
|
+
- run:
|
217
|
+
working_directory: ~/rails-app-with-knapsack_pro
|
218
|
+
command: bin/rails db:setup
|
219
|
+
- run:
|
220
|
+
working_directory: ~/rails-app-with-knapsack_pro
|
221
|
+
command: |
|
222
|
+
export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--queue"
|
223
|
+
bundle exec rake knapsack_pro:queue:rspec
|
224
|
+
- run:
|
225
|
+
working_directory: ~/rails-app-with-knapsack_pro
|
226
|
+
command: |
|
227
|
+
# run 0 tests as queue is consumed ||
|
228
|
+
export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--queue"
|
229
|
+
export KNAPSACK_PRO_FIXED_QUEUE_SPLIT=false
|
230
|
+
bundle exec rake knapsack_pro:queue:rspec
|
231
|
+
- run:
|
232
|
+
working_directory: ~/rails-app-with-knapsack_pro
|
233
|
+
command: |
|
234
|
+
# retry the same split ||
|
235
|
+
export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--queue"
|
236
|
+
export KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true
|
237
|
+
bundle exec rake knapsack_pro:queue:rspec
|
238
|
+
- run:
|
239
|
+
working_directory: ~/rails-app-with-knapsack_pro
|
240
|
+
command: |
|
241
|
+
# fallback ||
|
242
|
+
export KNAPSACK_PRO_ENDPOINT=https://api-fake.knapsackpro.com
|
243
|
+
export KNAPSACK_PRO_MAX_REQUEST_RETRIES=1
|
244
|
+
bundle exec rake knapsack_pro:queue:rspec
|
245
|
+
- run:
|
246
|
+
working_directory: ~/rails-app-with-knapsack_pro
|
247
|
+
command: |
|
248
|
+
# split by test examples ||
|
249
|
+
export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--queue--split"
|
250
|
+
export KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true
|
251
|
+
export KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES=true
|
252
|
+
bundle exec rake knapsack_pro:queue:rspec
|
253
|
+
- run:
|
254
|
+
working_directory: ~/rails-app-with-knapsack_pro
|
255
|
+
command: |
|
256
|
+
# turnip ||
|
257
|
+
export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--queue--turnip"
|
258
|
+
export KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true
|
259
|
+
export KNAPSACK_PRO_TEST_DIR=turnip
|
260
|
+
export KNAPSACK_PRO_TEST_FILE_PATTERN="turnip/**/*.feature"
|
261
|
+
bundle exec rake "knapsack_pro:queue:rspec[-r turnip/rspec]"
|
262
|
+
- run:
|
263
|
+
working_directory: ~/rails-app-with-knapsack_pro
|
264
|
+
command: |
|
265
|
+
# turnip retry ||
|
266
|
+
export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--queue--turnip"
|
267
|
+
export KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true
|
268
|
+
export KNAPSACK_PRO_TEST_DIR=turnip
|
269
|
+
export KNAPSACK_PRO_TEST_FILE_PATTERN="turnip/**/*.feature"
|
270
|
+
bundle exec rake "knapsack_pro:queue:rspec[-r turnip/rspec]"
|
44
271
|
|
45
|
-
|
272
|
+
e2e-regular-minitest:
|
273
|
+
parallelism: 2
|
274
|
+
working_directory: ~/knapsack_pro-ruby
|
275
|
+
resource_class: small
|
276
|
+
parameters:
|
277
|
+
ruby:
|
278
|
+
type: string
|
279
|
+
docker:
|
280
|
+
- image: cimg/ruby:<< parameters.ruby >>-browsers
|
281
|
+
environment:
|
282
|
+
PGHOST: 127.0.0.1
|
283
|
+
PGUSER: rails-app-with-knapsack_pro
|
284
|
+
RAILS_ENV: test
|
285
|
+
RACK_ENV: test
|
286
|
+
KNAPSACK_PRO_ENDPOINT: https://api-staging.knapsackpro.com
|
287
|
+
KNAPSACK_PRO_TEST_SUITE_TOKEN_MINITEST: $KNAPSACK_PRO_TEST_SUITE_TOKEN_MINITEST
|
288
|
+
EXTRA_TEST_FILES_DELAY: 10
|
289
|
+
- image: cimg/postgres:14.7
|
290
|
+
environment:
|
291
|
+
POSTGRES_DB: rails-app-with-knapsack_pro_test
|
292
|
+
POSTGRES_PASSWORD: password
|
293
|
+
POSTGRES_USER: rails-app-with-knapsack_pro
|
294
|
+
steps:
|
295
|
+
- setup_knapsack_pro_ruby
|
296
|
+
- setup_rails_app_with_knapsack_pro:
|
297
|
+
path: ~/rails-app-with-knapsack_pro
|
298
|
+
ruby: << parameters.ruby >>
|
299
|
+
- run: dockerize -wait tcp://localhost:5432 -timeout 1m
|
300
|
+
- run:
|
301
|
+
working_directory: ~/rails-app-with-knapsack_pro
|
302
|
+
command: ruby --version
|
303
|
+
- run:
|
304
|
+
working_directory: ~/rails-app-with-knapsack_pro
|
305
|
+
command: bin/rails db:setup
|
306
|
+
- run:
|
307
|
+
working_directory: ~/rails-app-with-knapsack_pro
|
308
|
+
command: |
|
309
|
+
export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--regular"
|
310
|
+
bundle exec rake knapsack_pro:minitest[--verbose]
|
311
|
+
|
312
|
+
e2e-queue-minitest:
|
313
|
+
parameters:
|
314
|
+
ruby:
|
315
|
+
type: string
|
316
|
+
parallelism: 2
|
317
|
+
working_directory: ~/knapsack_pro-ruby
|
318
|
+
resource_class: small
|
319
|
+
docker:
|
320
|
+
- image: cimg/ruby:<< parameters.ruby >>-browsers
|
321
|
+
environment:
|
322
|
+
PGHOST: 127.0.0.1
|
323
|
+
PGUSER: rails-app-with-knapsack_pro
|
324
|
+
RAILS_ENV: test
|
325
|
+
RACK_ENV: test
|
326
|
+
KNAPSACK_PRO_ENDPOINT: https://api-staging.knapsackpro.com
|
327
|
+
KNAPSACK_PRO_TEST_SUITE_TOKEN_MINITEST: $KNAPSACK_PRO_TEST_SUITE_TOKEN_MINITEST
|
328
|
+
EXTRA_TEST_FILES_DELAY: 10
|
329
|
+
- image: cimg/postgres:14.7
|
330
|
+
environment:
|
331
|
+
POSTGRES_DB: rails-app-with-knapsack_pro_test
|
332
|
+
POSTGRES_PASSWORD: password
|
333
|
+
POSTGRES_USER: rails-app-with-knapsack_pro
|
334
|
+
steps:
|
335
|
+
- setup_knapsack_pro_ruby
|
336
|
+
- setup_rails_app_with_knapsack_pro:
|
337
|
+
path: ~/rails-app-with-knapsack_pro
|
338
|
+
ruby: << parameters.ruby >>
|
339
|
+
- run: dockerize -wait tcp://localhost:5432 -timeout 1m
|
340
|
+
- run:
|
341
|
+
working_directory: ~/rails-app-with-knapsack_pro
|
342
|
+
command: ruby --version
|
343
|
+
- run:
|
344
|
+
working_directory: ~/rails-app-with-knapsack_pro
|
345
|
+
command: bin/rails db:setup
|
346
|
+
- run:
|
347
|
+
working_directory: ~/rails-app-with-knapsack_pro
|
348
|
+
command: |
|
349
|
+
# minitest ||
|
350
|
+
export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--queue--minitest"
|
351
|
+
export KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true
|
352
|
+
bundle exec rake knapsack_pro:queue:minitest[--verbose]
|
353
|
+
- run:
|
354
|
+
working_directory: ~/rails-app-with-knapsack_pro
|
355
|
+
command: |
|
356
|
+
# minitest retry ||
|
357
|
+
export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--queue--minitest"
|
358
|
+
export KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true
|
359
|
+
bundle exec rake knapsack_pro:queue:minitest[--verbose]
|
360
|
+
|
361
|
+
workflows:
|
362
|
+
tests:
|
363
|
+
jobs:
|
364
|
+
- unit
|
365
|
+
- integration-rspec:
|
366
|
+
name: integration__ruby-<< matrix.ruby >>__rspec-<< matrix.rspec >>
|
367
|
+
matrix:
|
368
|
+
parameters:
|
369
|
+
ruby: ["3.0", "3.1", "3.2", "3.3"]
|
370
|
+
rspec: ["3.10.2", "3.11.0", "3.12.2"]
|
371
|
+
- e2e-regular-rspec:
|
372
|
+
name: e2e-regular__ruby-<< matrix.ruby >>__rspec-<< matrix.rspec >>
|
373
|
+
matrix:
|
374
|
+
parameters:
|
375
|
+
ruby: ["3.0", "3.1", "3.2", "3.3"]
|
376
|
+
rspec: ["3.10.2", "3.11.0", "3.12.2"]
|
377
|
+
- e2e-queue-rspec:
|
378
|
+
name: e2e-queue__ruby-<< matrix.ruby >>__rspec-<< matrix.rspec >>
|
379
|
+
matrix:
|
380
|
+
parameters:
|
381
|
+
ruby: ["3.0", "3.1", "3.2", "3.3"]
|
382
|
+
rspec: ["3.10.2", "3.11.0", "3.12.2"]
|
383
|
+
- e2e-regular-minitest:
|
384
|
+
name: e2e-regular__ruby-<< matrix.ruby >>__minitest
|
385
|
+
matrix:
|
386
|
+
parameters:
|
387
|
+
ruby: ["3.0", "3.1", "3.2", "3.3"]
|
388
|
+
- e2e-queue-minitest:
|
389
|
+
name: e2e-queue__ruby-<< matrix.ruby >>__minitest
|
390
|
+
matrix:
|
391
|
+
parameters:
|
392
|
+
ruby: ["3.0", "3.1", "3.2", "3.3"]
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Story
|
2
|
+
|
3
|
+
TODO: link to the internal story
|
4
|
+
|
5
|
+
## Related
|
6
|
+
|
7
|
+
TODO: links to related PRs or issues
|
8
|
+
|
9
|
+
# Description
|
10
|
+
|
11
|
+
TODO
|
12
|
+
|
13
|
+
# Changes
|
14
|
+
|
15
|
+
TODO: changes introduced by this PR
|
16
|
+
|
17
|
+
# Checklist reminder
|
18
|
+
|
19
|
+
- [ ] You follow the architecture outlined below for RSpec in Queue Mode, which is a work in progress (feel free to propose changes):
|
20
|
+
- Pure: `lib/knapsack_pro/pure/queue/rspec_pure.rb` contains pure functions that are unit tested.
|
21
|
+
- Extension: `lib/knapsack_pro/extensions/rspec_extension.rb` encapsulates calls to RSpec internals and is integration and e2e tested.
|
22
|
+
- Runner: `lib/knapsack_pro/runners/queue/rspec_runner.rb` invokes the pure code and the extension to produce side effects, which are integration and e2e tested.
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,100 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### 7.0.0
|
4
|
+
|
5
|
+
* __(breaking change)__ RSpec in Queue Mode:
|
6
|
+
* The default for `KNAPSACK_PRO_LOG_LEVEL` is `info` instead of `debug`.
|
7
|
+
* The RSpec `before(:suite)` and `after(:suite)` hooks changed:
|
8
|
+
|
9
|
+
__Before:__<br>
|
10
|
+
The `before(:suite)` and `after(:suite)` hooks were executed multiple times. Each time for a batch of tests fetched from Knapsack Pro Queue API.
|
11
|
+
|
12
|
+
__After:__<br>
|
13
|
+
The `before(:suite)` and `after(:suite)` hooks are executed only once: `before(:suite)` is executed before starting tests, `after(:suite)` is executed after all tests are completed. (It is what you would expect from RSpec).
|
14
|
+
|
15
|
+
* The `KnapsackPro::Hooks::Queue.after_queue` hook change:
|
16
|
+
|
17
|
+
__Before:__<br>
|
18
|
+
The `KnapsackPro::Hooks::Queue.after_queue` hook is executed outside of the `after(:suite)` hook.
|
19
|
+
|
20
|
+
__After:__<br>
|
21
|
+
The `KnapsackPro::Hooks::Queue.after_queue` hook is executed __inside__ of the `after(:suite)` hook.
|
22
|
+
|
23
|
+
* Recommended RSpec changes in your project:
|
24
|
+
* Remove the following code if you use Queue Mode and the `rspec_junit_formatter` gem to generate JUnit XML or JSON reports:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
# REMOVE THE FOLLOWING CODE
|
28
|
+
|
29
|
+
# spec_helper.rb or rails_helper.rb
|
30
|
+
TMP_REPORT = "tmp/rspec_#{ENV['KNAPSACK_PRO_CI_NODE_INDEX']}.xml"
|
31
|
+
FINAL_REPORT = "tmp/final_rspec_#{ENV['KNAPSACK_PRO_CI_NODE_INDEX']}.xml"
|
32
|
+
|
33
|
+
KnapsackPro::Hooks::Queue.after_subset_queue do |queue_id, subset_queue_id|
|
34
|
+
if File.exist?(TMP_REPORT)
|
35
|
+
FileUtils.mv(TMP_REPORT, FINAL_REPORT)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
Learn more about [using Knapsack Pro with RSpec formatters](https://docs.knapsackpro.com/ruby/rspec/#formatters-rspec_junit_formatter-json) and [using Knapsack Pro with CircleCI](https://docs.knapsackpro.com/ruby/circleci/) in the docs.
|
41
|
+
|
42
|
+
* Replace the following code if you are using Queue Mode and the `percy-capybara` gem on a version older than 4:
|
43
|
+
|
44
|
+
Before:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
KnapsackPro::Hooks::Queue.before_queue { |queue_id| Percy::Capybara.initialize_build }
|
48
|
+
KnapsackPro::Hooks::Queue.after_queue { |queue_id| Percy::Capybara.finalize_build }
|
49
|
+
```
|
50
|
+
|
51
|
+
After:
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
# recommended
|
55
|
+
before(:suite) { Percy::Capybara.initialize_build }
|
56
|
+
after(:suite) { Percy::Capybara.finalize_build }
|
57
|
+
```
|
58
|
+
|
59
|
+
Learn more about [using Knapsack Pro with Percy](https://docs.knapsackpro.com/ruby/hooks/#percy-capybara) in the docs.
|
60
|
+
|
61
|
+
* We are no longer modifying the default RSpec formatters in Queue Mode. You can remove the [`KNAPSACK_PRO_MODIFY_DEFAULT_RSPEC_FORMATTERS`](https://docs.knapsackpro.com/ruby/reference/#knapsack_pro_modify_default_rspec_formatters-removed-rspec) environment variable from your CI config if you are using it.
|
62
|
+
|
63
|
+
* RSpec improvements in Queue Mode:
|
64
|
+
* Termination signals (`HUP`, `INT`, `TERM`, `ABRT`, `QUIT`, `USR1`, and `USR2`) are handled earlier: the process will terminate before the next top-level example group (`describe` or `context`) instead of waiting for the next Knapsack Pro batch of tests.
|
65
|
+
|
66
|
+
* Respect the `--error-exit-code` option. It sets a custom exit code (instead of `1`) when RSpec fails outside an example (e.g. lack of memory, termination signal).
|
67
|
+
|
68
|
+
```bash
|
69
|
+
bundle exec rake "knapsack_pro:queue:rspec[--error-exit-code 3]"
|
70
|
+
```
|
71
|
+
|
72
|
+
* Respect the `--failure-exit-code` option. It sets a custom exit code for when any examples fail.
|
73
|
+
|
74
|
+
```bash
|
75
|
+
bundle exec rake "knapsack_pro:queue:rspec[--failure-exit-code 2]"
|
76
|
+
```
|
77
|
+
|
78
|
+
* Respect the `--fail-fast` option and show a warning in the Knapsack Pro log.
|
79
|
+
|
80
|
+
* Ignore the `fail_if_no_examples` option in Queue Mode:
|
81
|
+
* A late CI node, started after all tests were executed by other nodes, is expected to receive an empty batch.
|
82
|
+
* A batch could contain tests with no examples (e.g. commented out)
|
83
|
+
|
84
|
+
* Raise an exception if the [deprecated `run_all_when_everything_filtered`](https://docs.knapsackpro.com/ruby/rspec/#some-of-my-test-files-are-not-executed) option is detected.
|
85
|
+
|
86
|
+
PR with the above changes: https://github.com/KnapsackPro/knapsack_pro-ruby/pull/237
|
87
|
+
|
88
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v6.0.4...v7.0.0
|
89
|
+
|
90
|
+
### 6.0.4
|
91
|
+
|
92
|
+
* fix(minitest): avoid installing `at_exit` (that would result in an empty run of Minitest after Knapsack Pro is finished in Queue Mode)
|
93
|
+
|
94
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/pull/236
|
95
|
+
|
96
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v6.0.3...v6.0.4
|
97
|
+
|
3
98
|
### 6.0.3
|
4
99
|
|
5
100
|
* fix(Turnip): make sure `.feature` files are recorded
|
data/Gemfile
CHANGED
@@ -2,3 +2,12 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in knapsack.gemspec
|
4
4
|
gemspec
|
5
|
+
|
6
|
+
group :test do
|
7
|
+
gem 'rspec_junit_formatter', require: false
|
8
|
+
gem 'nokogiri', require: false
|
9
|
+
gem 'simplecov', require: false
|
10
|
+
|
11
|
+
# This line is going to be replaced on CI to test different RSpec versions.
|
12
|
+
# gem 'rspec-core', 'x.x.x'
|
13
|
+
end
|
data/README.md
CHANGED
@@ -18,9 +18,6 @@
|
|
18
18
|
<a href="https://rubygems.org/gems/knapsack_pro">
|
19
19
|
<img alt="Gem Version" src="https://badge.fury.io/rb/knapsack_pro.svg" />
|
20
20
|
</a>
|
21
|
-
<a href="https://codeclimate.com/github/KnapsackPro/knapsack_pro-ruby">
|
22
|
-
<img alt="Code Climate" src="https://codeclimate.com/github/KnapsackPro/knapsack_pro-ruby/badges/gpa.svg" />
|
23
|
-
</a>
|
24
21
|
</div>
|
25
22
|
|
26
23
|
<br />
|
@@ -45,10 +42,6 @@ The `knapsack_pro` gem supports all CIs and the following test runners:
|
|
45
42
|
- Spinach
|
46
43
|
- Turnip
|
47
44
|
|
48
|
-
## Requirements
|
49
|
-
|
50
|
-
`>= Ruby 2.1.0`
|
51
|
-
|
52
45
|
## Installation
|
53
46
|
|
54
47
|
The [Installation Guide](https://docs.knapsackpro.com/knapsack_pro-ruby/guide/?utm_source=github&utm_medium=readme&utm_campaign=knapsack_pro-ruby_gem&utm_content=installation_guide) will ask you a few questions and generate instruction steps for your project:
|
data/knapsack_pro.gemspec
CHANGED
@@ -6,10 +6,11 @@ require 'knapsack_pro/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'knapsack_pro'
|
8
8
|
spec.version = KnapsackPro::VERSION
|
9
|
+
spec.required_ruby_version = '>= 2.7.0'
|
9
10
|
spec.authors = ['ArturT']
|
10
11
|
spec.email = ['support@knapsackpro.com']
|
11
12
|
spec.summary = %q{Knapsack Pro splits tests across parallel CI nodes and ensures each parallel job finish work at a similar time.}
|
12
|
-
spec.description = %q{
|
13
|
+
spec.description = %q{Knapsack Pro wraps your current test runner(s) and works with your existing CI infrastructure to parallelize tests optimally. It dynamically splits your tests based on up-to-date test execution data. It's designed from the ground up for CI and supports all of them.}
|
13
14
|
spec.homepage = 'https://knapsackpro.com'
|
14
15
|
spec.license = 'MIT'
|
15
16
|
spec.metadata = {
|
@@ -60,13 +60,13 @@ module KnapsackPro
|
|
60
60
|
File.write(self.class.adapter_bind_method_called_file, nil)
|
61
61
|
|
62
62
|
if KnapsackPro::Config::Env.recording_enabled?
|
63
|
-
KnapsackPro.logger.debug('
|
63
|
+
KnapsackPro.logger.debug('Regular Mode enabled.')
|
64
64
|
bind_time_tracker
|
65
65
|
bind_save_report
|
66
66
|
end
|
67
67
|
|
68
68
|
if KnapsackPro::Config::Env.queue_recording_enabled?
|
69
|
-
KnapsackPro.logger.debug('
|
69
|
+
KnapsackPro.logger.debug('Queue Mode enabled.')
|
70
70
|
bind_queue_mode
|
71
71
|
end
|
72
72
|
end
|
@@ -83,8 +83,13 @@ module KnapsackPro
|
|
83
83
|
raise NotImplementedError
|
84
84
|
end
|
85
85
|
|
86
|
+
def bind_after_queue_hook
|
87
|
+
raise NotImplementedError
|
88
|
+
end
|
89
|
+
|
86
90
|
def bind_queue_mode
|
87
91
|
bind_before_queue_hook
|
92
|
+
bind_after_queue_hook
|
88
93
|
bind_time_tracker
|
89
94
|
end
|
90
95
|
end
|