knapsack_pro 2.18.2 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/knapsack_pro.gemspec +1 -1
- data/lib/knapsack_pro/adapters/rspec_adapter.rb +5 -10
- data/lib/knapsack_pro/version.rb +1 -1
- data/spec/knapsack_pro/adapters/rspec_adapter_spec.rb +20 -24
- data/spec/knapsack_pro/runners/minitest_runner_spec.rb +6 -1
- data/spec/knapsack_pro/runners/test_unit_runner_spec.rb +6 -1
- metadata +3 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5187abddda32d96fdec255f8aa2e740f0c85e856d882fa31790e4e8c93a87e8
|
4
|
+
data.tar.gz: 22320f9e0795684f81a53fb4fffb29295b28b0068fef5c54739c14e423eed003
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07ea71f123f6995a6174b45561818c9ff5bf2565a141d1c49261ebf448027953fd1e822806ed1a04db962dad7fcee0fe27d025b4823c58b34d0519d2f04275a0
|
7
|
+
data.tar.gz: a84f3ae6a0b69d33e16e3efd5338e13e3b09c8db9bea6f26d77523436ff370722341586732ce28df4011f5379102fdae18ce9f7a5673286f2f0323c5b5102709
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
### 3.0.0
|
4
|
+
|
5
|
+
* __(breaking change)__ Remove support for RSpec 2.x. This change was already done by accident in [the pull request](https://github.com/KnapsackPro/knapsack_pro-ruby/pull/143) when we added the RSpec `context` hook, which is available only since RSpec 3.x.
|
6
|
+
* Use RSpec `example` block argument instead of the global `RSpec.current_example`. This allows to run tests with the `async-rspec` gem.
|
7
|
+
|
8
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/pull/153
|
9
|
+
|
10
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v2.18.2...v3.0.0
|
11
|
+
|
3
12
|
### 2.18.2
|
4
13
|
|
5
14
|
* Track all test files assigned to a CI node in Regular Mode including pending test files in order to retry proper set of tests on the retried CI node
|
data/knapsack_pro.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_dependency 'rake', '>= 0'
|
29
29
|
|
30
30
|
spec.add_development_dependency 'bundler', '>= 1.6'
|
31
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
31
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
32
32
|
spec.add_development_dependency 'rspec-its', '~> 1.3'
|
33
33
|
spec.add_development_dependency 'cucumber', '>= 0'
|
34
34
|
spec.add_development_dependency 'spinach', '>= 0.8'
|
@@ -24,8 +24,10 @@ module KnapsackPro
|
|
24
24
|
cli_args.any? { |arg| arg.start_with?('-f') || arg.start_with?('--format') }
|
25
25
|
end
|
26
26
|
|
27
|
-
def self.test_path(
|
28
|
-
|
27
|
+
def self.test_path(example)
|
28
|
+
example_group = example.metadata[:example_group]
|
29
|
+
|
30
|
+
if defined?(::Turnip) && Gem::Version.new(::Turnip::VERSION) < Gem::Version.new('2.0.0')
|
29
31
|
unless example_group[:turnip]
|
30
32
|
until example_group[:parent_example_group].nil?
|
31
33
|
example_group = example_group[:parent_example_group]
|
@@ -51,14 +53,7 @@ module KnapsackPro
|
|
51
53
|
# this way we count time spend in runtime for the previous test example after around(:each) is already done
|
52
54
|
KnapsackPro.tracker.stop_timer
|
53
55
|
|
54
|
-
|
55
|
-
if ::RSpec.respond_to?(:current_example)
|
56
|
-
::RSpec.current_example.metadata[:example_group]
|
57
|
-
else
|
58
|
-
example.metadata
|
59
|
-
end
|
60
|
-
|
61
|
-
current_test_path = KnapsackPro::Adapters::RSpecAdapter.test_path(current_example_group)
|
56
|
+
current_test_path = KnapsackPro::Adapters::RSpecAdapter.test_path(example)
|
62
57
|
|
63
58
|
KnapsackPro.tracker.current_test_path =
|
64
59
|
if KnapsackPro::Config::Env.rspec_split_by_test_examples? && KnapsackPro::Adapters::RSpecAdapter.slow_test_file?(RSpecAdapter, current_test_path)
|
data/lib/knapsack_pro/version.rb
CHANGED
@@ -111,7 +111,7 @@ describe KnapsackPro::Adapters::RSpecAdapter do
|
|
111
111
|
end
|
112
112
|
|
113
113
|
describe '.test_path' do
|
114
|
-
let(:
|
114
|
+
let(:example_group) do
|
115
115
|
{
|
116
116
|
file_path: '1_shared_example.rb',
|
117
117
|
parent_example_group: {
|
@@ -122,14 +122,19 @@ describe KnapsackPro::Adapters::RSpecAdapter do
|
|
122
122
|
}
|
123
123
|
}
|
124
124
|
end
|
125
|
+
let(:current_example) do
|
126
|
+
OpenStruct.new(metadata: {
|
127
|
+
example_group: example_group
|
128
|
+
})
|
129
|
+
end
|
125
130
|
|
126
|
-
subject { described_class.test_path(
|
131
|
+
subject { described_class.test_path(current_example) }
|
127
132
|
|
128
133
|
it { should eql 'a_spec.rb' }
|
129
134
|
|
130
135
|
context 'with turnip features' do
|
131
136
|
describe 'when the turnip version is less than 2' do
|
132
|
-
let(:
|
137
|
+
let(:example_group) do
|
133
138
|
{
|
134
139
|
file_path: "./spec/features/logging_in.feature",
|
135
140
|
turnip: true,
|
@@ -145,7 +150,7 @@ describe KnapsackPro::Adapters::RSpecAdapter do
|
|
145
150
|
end
|
146
151
|
|
147
152
|
describe 'when turnip is version 2 or greater' do
|
148
|
-
let(:
|
153
|
+
let(:example_group) do
|
149
154
|
{
|
150
155
|
file_path: "gems/turnip-2.0.0/lib/turnip/rspec.rb",
|
151
156
|
turnip: true,
|
@@ -170,13 +175,7 @@ describe KnapsackPro::Adapters::RSpecAdapter do
|
|
170
175
|
let(:logger) { instance_double(Logger) }
|
171
176
|
let(:global_time) { 'Global time: 01m 05s' }
|
172
177
|
let(:test_path) { 'spec/a_spec.rb' }
|
173
|
-
let(:
|
174
|
-
let(:example_group) { double }
|
175
|
-
let(:current_example) do
|
176
|
-
OpenStruct.new(metadata: {
|
177
|
-
example_group: example_group
|
178
|
-
})
|
179
|
-
end
|
178
|
+
let(:current_example) { double }
|
180
179
|
|
181
180
|
context 'when rspec split by test examples is disabled' do
|
182
181
|
before do
|
@@ -189,19 +188,18 @@ describe KnapsackPro::Adapters::RSpecAdapter do
|
|
189
188
|
allow(KnapsackPro).to receive(:tracker).and_return(tracker)
|
190
189
|
expect(tracker).to receive(:start_timer).ordered
|
191
190
|
|
192
|
-
expect(config).to receive(:around).with(:each).and_yield(
|
191
|
+
expect(config).to receive(:around).with(:each).and_yield(current_example)
|
193
192
|
expect(config).to receive(:append_after).with(:context).and_yield
|
194
193
|
expect(config).to receive(:after).with(:suite).and_yield
|
195
194
|
expect(::RSpec).to receive(:configure).and_yield(config)
|
196
195
|
|
197
196
|
expect(tracker).to receive(:stop_timer).ordered
|
198
197
|
|
199
|
-
expect(
|
200
|
-
expect(described_class).to receive(:test_path).with(example_group).and_return(test_path)
|
198
|
+
expect(described_class).to receive(:test_path).with(current_example).and_return(test_path)
|
201
199
|
|
202
200
|
expect(tracker).to receive(:current_test_path=).with(test_path).ordered
|
203
201
|
|
204
|
-
expect(
|
202
|
+
expect(current_example).to receive(:run)
|
205
203
|
|
206
204
|
expect(tracker).to receive(:stop_timer).ordered
|
207
205
|
|
@@ -226,26 +224,25 @@ describe KnapsackPro::Adapters::RSpecAdapter do
|
|
226
224
|
end
|
227
225
|
|
228
226
|
it 'records time for example.id' do
|
229
|
-
expect(
|
227
|
+
expect(current_example).to receive(:id).and_return(test_example_path)
|
230
228
|
|
231
229
|
expect(config).to receive(:prepend_before).with(:context).and_yield
|
232
230
|
|
233
231
|
allow(KnapsackPro).to receive(:tracker).and_return(tracker)
|
234
232
|
expect(tracker).to receive(:start_timer).ordered
|
235
233
|
|
236
|
-
expect(config).to receive(:around).with(:each).and_yield(
|
234
|
+
expect(config).to receive(:around).with(:each).and_yield(current_example)
|
237
235
|
expect(config).to receive(:append_after).with(:context).and_yield
|
238
236
|
expect(config).to receive(:after).with(:suite).and_yield
|
239
237
|
expect(::RSpec).to receive(:configure).and_yield(config)
|
240
238
|
|
241
239
|
expect(tracker).to receive(:stop_timer).ordered
|
242
240
|
|
243
|
-
expect(
|
244
|
-
expect(described_class).to receive(:test_path).with(example_group).and_return(test_path)
|
241
|
+
expect(described_class).to receive(:test_path).with(current_example).and_return(test_path)
|
245
242
|
|
246
243
|
expect(tracker).to receive(:current_test_path=).with(test_example_path).ordered
|
247
244
|
|
248
|
-
expect(
|
245
|
+
expect(current_example).to receive(:run)
|
249
246
|
|
250
247
|
expect(tracker).to receive(:stop_timer).ordered
|
251
248
|
|
@@ -268,19 +265,18 @@ describe KnapsackPro::Adapters::RSpecAdapter do
|
|
268
265
|
allow(KnapsackPro).to receive(:tracker).and_return(tracker)
|
269
266
|
expect(tracker).to receive(:start_timer).ordered
|
270
267
|
|
271
|
-
expect(config).to receive(:around).with(:each).and_yield(
|
268
|
+
expect(config).to receive(:around).with(:each).and_yield(current_example)
|
272
269
|
expect(config).to receive(:append_after).with(:context).and_yield
|
273
270
|
expect(config).to receive(:after).with(:suite).and_yield
|
274
271
|
expect(::RSpec).to receive(:configure).and_yield(config)
|
275
272
|
|
276
|
-
expect(
|
277
|
-
expect(described_class).to receive(:test_path).with(example_group).and_return(test_path)
|
273
|
+
expect(described_class).to receive(:test_path).with(current_example).and_return(test_path)
|
278
274
|
|
279
275
|
expect(tracker).to receive(:stop_timer).ordered
|
280
276
|
|
281
277
|
expect(tracker).to receive(:current_test_path=).with(test_path).ordered
|
282
278
|
|
283
|
-
expect(
|
279
|
+
expect(current_example).to receive(:run)
|
284
280
|
|
285
281
|
expect(tracker).to receive(:stop_timer).ordered
|
286
282
|
|
@@ -14,12 +14,17 @@ describe KnapsackPro::Runners::MinitestRunner do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
context 'when test files were returned by Knapsack Pro API' do
|
17
|
+
let(:test_file_paths) { ['test_fake/a_test.rb', 'test_fake/b_test.rb'] }
|
18
|
+
|
17
19
|
before do
|
18
20
|
expect(KnapsackPro::Adapters::MinitestAdapter).to receive(:verify_bind_method_called)
|
21
|
+
|
22
|
+
tracker = instance_double(KnapsackPro::Tracker)
|
23
|
+
expect(KnapsackPro).to receive(:tracker).and_return(tracker)
|
24
|
+
expect(tracker).to receive(:set_prerun_tests).with(test_file_paths)
|
19
25
|
end
|
20
26
|
|
21
27
|
it 'runs tests' do
|
22
|
-
test_file_paths = ['test_fake/a_test.rb', 'test_fake/b_test.rb']
|
23
28
|
runner = instance_double(described_class,
|
24
29
|
test_dir: 'test',
|
25
30
|
test_file_paths: test_file_paths,
|
@@ -13,10 +13,15 @@ describe KnapsackPro::Runners::TestUnitRunner do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
context 'when test files were returned by Knapsack Pro API' do
|
16
|
+
let(:test_file_paths) { ['test-unit_fake/a_test.rb', 'test-unit_fake/b_test.rb'] }
|
17
|
+
|
16
18
|
it 'runs tests' do
|
17
19
|
expect(KnapsackPro::Adapters::TestUnitAdapter).to receive(:verify_bind_method_called)
|
18
20
|
|
19
|
-
|
21
|
+
tracker = instance_double(KnapsackPro::Tracker)
|
22
|
+
expect(KnapsackPro).to receive(:tracker).and_return(tracker)
|
23
|
+
expect(tracker).to receive(:set_prerun_tests).with(test_file_paths)
|
24
|
+
|
20
25
|
runner = instance_double(described_class,
|
21
26
|
test_dir: 'test-unit_fake',
|
22
27
|
test_file_paths: test_file_paths,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knapsack_pro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ArturT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -45,9 +45,6 @@ dependencies:
|
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '3.0'
|
48
|
-
- - ">="
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: 2.10.0
|
51
48
|
type: :development
|
52
49
|
prerelease: false
|
53
50
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -55,9 +52,6 @@ dependencies:
|
|
55
52
|
- - "~>"
|
56
53
|
- !ruby/object:Gem::Version
|
57
54
|
version: '3.0'
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: 2.10.0
|
61
55
|
- !ruby/object:Gem::Dependency
|
62
56
|
name: rspec-its
|
63
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -409,7 +403,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
409
403
|
- !ruby/object:Gem::Version
|
410
404
|
version: '0'
|
411
405
|
requirements: []
|
412
|
-
rubygems_version: 3.2.
|
406
|
+
rubygems_version: 3.2.22
|
413
407
|
signing_key:
|
414
408
|
specification_version: 4
|
415
409
|
summary: Knapsack Pro splits tests across parallel CI nodes and ensures each parallel
|