knapsack_pro 7.5.1 → 7.6.1
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/CHANGELOG.md +49 -1
- data/knapsack_pro.gemspec +1 -1
- data/lib/knapsack_pro/formatters/time_tracker.rb +1 -1
- data/lib/knapsack_pro/tracker.rb +1 -1
- data/lib/knapsack_pro/utils.rb +8 -0
- data/lib/knapsack_pro/version.rb +1 -1
- data/lib/tasks/queue/cucumber.rake +1 -8
- data/lib/tasks/queue/minitest.rake +1 -8
- data/lib/tasks/queue/rspec.rake +1 -8
- data/spec/integration/runners/queue/rspec_runner_spec.rb +36 -6
- data/spec/knapsack_pro/utils_spec.rb +36 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11356d7eace33ba43c1dec527436091c103ac8b5d6c9bd2ae28851294854d4df
|
4
|
+
data.tar.gz: 15717cbb12d7d9143be84504464ecd32a25841bb984e70ec88ec6b3c05b0dcbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a12e300c1a6a7427836b2a62d71b7ccb35174c31d444ac77fdd19847a7b9b85fc805adb9bd966329d0c7e21e58c233230e63e8943b14bad6b9267236c69ee3a
|
7
|
+
data.tar.gz: 3ac187d311a35d343c5c6fd86c667049642638862d5dff4d68ecff91d63191b05a1206881d24efebd3163d92cbd69e08bd8d0a4b129f69bf45b348dde49662be
|
data/CHANGELOG.md
CHANGED
@@ -2,9 +2,29 @@
|
|
2
2
|
|
3
3
|
### UNRELEASED
|
4
4
|
|
5
|
+
### 7.6.1
|
6
|
+
|
7
|
+
* Add support for the Timecop 0.9.9 gem version so that we could track proper tests' execution time when `Process.clock_gettime` is mocked.
|
8
|
+
|
9
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/pull/262
|
10
|
+
|
11
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v7.6.0...v7.6.1
|
12
|
+
|
13
|
+
### 7.6.0
|
14
|
+
|
15
|
+
* Avoid starting an unnecessary process in Queue Mode.
|
16
|
+
* Fix: the terminal is returned to the user correctly (output looks good) when you use CTRL+C
|
17
|
+
* Improvement: the backtrace looks better when something fails (for example, the gem handles an OS signal)
|
18
|
+
|
19
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/pull/260
|
20
|
+
|
21
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v7.5.1...v7.6.0
|
22
|
+
|
5
23
|
### 7.5.1
|
6
24
|
|
7
|
-
Revert to 7.4.0.
|
25
|
+
* Revert to 7.4.0.
|
26
|
+
|
27
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v7.5.0...v7.5.1
|
8
28
|
|
9
29
|
### 7.5.0
|
10
30
|
|
@@ -233,6 +253,34 @@ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v6.0.4...v7.0.0
|
|
233
253
|
|
234
254
|
https://github.com/KnapsackPro/knapsack_pro-ruby/pull/236
|
235
255
|
|
256
|
+
__(breaking change)__ for SimpleCov and Minitest in Knapsack Pro Queue Mode users.
|
257
|
+
|
258
|
+
Please add the following to your configuration:
|
259
|
+
|
260
|
+
```ruby
|
261
|
+
KnapsackPro::Hooks::Queue.after_queue do
|
262
|
+
SimpleCov.result.format!
|
263
|
+
end
|
264
|
+
```
|
265
|
+
|
266
|
+
The full example:
|
267
|
+
|
268
|
+
```ruby
|
269
|
+
# test/test_helper.rb
|
270
|
+
require 'knapsack_pro'
|
271
|
+
require 'simplecov'
|
272
|
+
|
273
|
+
SimpleCov.start
|
274
|
+
|
275
|
+
KnapsackPro::Hooks::Queue.before_queue do |queue_id|
|
276
|
+
SimpleCov.command_name("minitest_ci_node_#{KnapsackPro::Config::Env.ci_node_index}")
|
277
|
+
end
|
278
|
+
|
279
|
+
KnapsackPro::Hooks::Queue.after_queue do
|
280
|
+
SimpleCov.result.format!
|
281
|
+
end
|
282
|
+
```
|
283
|
+
|
236
284
|
https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v6.0.3...v6.0.4
|
237
285
|
|
238
286
|
### 6.0.3
|
data/knapsack_pro.gemspec
CHANGED
@@ -38,5 +38,5 @@ Gem::Specification.new do |spec|
|
|
38
38
|
spec.add_development_dependency 'pry', '~> 0'
|
39
39
|
spec.add_development_dependency 'vcr', '>= 6.0'
|
40
40
|
spec.add_development_dependency 'webmock', '>= 3.13'
|
41
|
-
spec.add_development_dependency 'timecop', '>= 0.9.
|
41
|
+
spec.add_development_dependency 'timecop', '>= 0.9.9'
|
42
42
|
end
|
data/lib/knapsack_pro/tracker.rb
CHANGED
data/lib/knapsack_pro/utils.rb
CHANGED
@@ -5,5 +5,13 @@ module KnapsackPro
|
|
5
5
|
def self.unsymbolize(obj)
|
6
6
|
JSON.parse(obj.to_json)
|
7
7
|
end
|
8
|
+
|
9
|
+
def self.time_now
|
10
|
+
if defined?(Timecop) && Process.respond_to?(:clock_gettime_without_mock)
|
11
|
+
Process.clock_gettime_without_mock(Process::CLOCK_MONOTONIC)
|
12
|
+
else
|
13
|
+
Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
14
|
+
end
|
15
|
+
end
|
8
16
|
end
|
9
17
|
end
|
data/lib/knapsack_pro/version.rb
CHANGED
@@ -5,14 +5,7 @@ require 'knapsack_pro'
|
|
5
5
|
namespace :knapsack_pro do
|
6
6
|
namespace :queue do
|
7
7
|
task :cucumber, [:cucumber_args] do |_, args|
|
8
|
-
Kernel.
|
9
|
-
exitstatus = $?.exitstatus
|
10
|
-
if exitstatus.nil?
|
11
|
-
puts 'Something went wrong. Most likely, the process has been killed. Knapsack Pro has been terminated.'
|
12
|
-
Kernel.exit(1)
|
13
|
-
else
|
14
|
-
Kernel.exit(exitstatus)
|
15
|
-
end
|
8
|
+
Kernel.exec("RAILS_ENV=test RACK_ENV=test #{$PROGRAM_NAME} 'knapsack_pro:queue:cucumber_go[#{args[:cucumber_args]}]'")
|
16
9
|
end
|
17
10
|
|
18
11
|
task :cucumber_go, [:cucumber_args] do |_, args|
|
@@ -5,14 +5,7 @@ require 'knapsack_pro'
|
|
5
5
|
namespace :knapsack_pro do
|
6
6
|
namespace :queue do
|
7
7
|
task :minitest, [:minitest_args] do |_, args|
|
8
|
-
Kernel.
|
9
|
-
exitstatus = $?.exitstatus
|
10
|
-
if exitstatus.nil?
|
11
|
-
puts 'Something went wrong. Most likely, the process has been killed. Knapsack Pro has been terminated.'
|
12
|
-
Kernel.exit(1)
|
13
|
-
else
|
14
|
-
Kernel.exit(exitstatus)
|
15
|
-
end
|
8
|
+
Kernel.exec("RAILS_ENV=test RACK_ENV=test #{$PROGRAM_NAME} 'knapsack_pro:queue:minitest_go[#{args[:minitest_args]}]'")
|
16
9
|
end
|
17
10
|
|
18
11
|
task :minitest_go, [:minitest_args] do |_, args|
|
data/lib/tasks/queue/rspec.rake
CHANGED
@@ -5,14 +5,7 @@ require 'knapsack_pro'
|
|
5
5
|
namespace :knapsack_pro do
|
6
6
|
namespace :queue do
|
7
7
|
task :rspec, [:rspec_args] do |_, args|
|
8
|
-
Kernel.
|
9
|
-
exitstatus = $?.exitstatus
|
10
|
-
if exitstatus.nil?
|
11
|
-
puts 'Something went wrong. Most likely, the process has been killed. Knapsack Pro has been terminated.'
|
12
|
-
Kernel.exit(1)
|
13
|
-
else
|
14
|
-
Kernel.exit(exitstatus)
|
15
|
-
end
|
8
|
+
Kernel.exec("RAILS_ENV=test RACK_ENV=test #{$PROGRAM_NAME} 'knapsack_pro:queue:rspec_go[#{args[:rspec_args]}]'")
|
16
9
|
end
|
17
10
|
|
18
11
|
task :rspec_go, [:rspec_args] do |_, args|
|
@@ -18,18 +18,23 @@ describe "#{KnapsackPro::Runners::Queue::RSpecRunner} - Integration tests", :cle
|
|
18
18
|
# @param spec_batches Array[Array[String]]
|
19
19
|
def generate_specs(spec_helper, rspec_options, spec_batches)
|
20
20
|
ENV['TEST__RSPEC_OPTIONS'] = rspec_options
|
21
|
+
generate_spec_helper(spec_helper)
|
22
|
+
paths = generate_spec_files(spec_batches.flatten)
|
23
|
+
stub_spec_batches(
|
24
|
+
spec_batches.map { _1.map(&:path) }
|
25
|
+
)
|
26
|
+
end
|
21
27
|
|
28
|
+
def generate_spec_helper(spec_helper)
|
22
29
|
spec_helper_path = "#{SPEC_DIRECTORY}/spec_helper.rb"
|
23
30
|
File.open(spec_helper_path, 'w') { |file| file.write(spec_helper) }
|
31
|
+
end
|
24
32
|
|
25
|
-
|
33
|
+
def generate_spec_files(specs)
|
34
|
+
specs.map do |spec_item|
|
26
35
|
File.open(spec_item.path, 'w') { |file| file.write(spec_item.content) }
|
27
36
|
spec_item.path
|
28
37
|
end
|
29
|
-
|
30
|
-
stub_spec_batches(
|
31
|
-
spec_batches.map { _1.map(&:path) }
|
32
|
-
)
|
33
38
|
end
|
34
39
|
|
35
40
|
def create_rails_helper_file(rails_helper)
|
@@ -73,8 +78,9 @@ describe "#{KnapsackPro::Runners::Queue::RSpecRunner} - Integration tests", :cle
|
|
73
78
|
SPEC
|
74
79
|
end
|
75
80
|
|
81
|
+
let(:command) { 'ruby spec/integration/runners/queue/rspec_runner.rb' }
|
82
|
+
|
76
83
|
subject do
|
77
|
-
command = 'ruby spec/integration/runners/queue/rspec_runner.rb'
|
78
84
|
stdout, stderr, status = Open3.capture3(command)
|
79
85
|
log_command_result(stdout, stderr, status)
|
80
86
|
OpenStruct.new(stdout: stdout, stderr: stderr, exit_code: status.exitstatus)
|
@@ -2537,4 +2543,28 @@ describe "#{KnapsackPro::Runners::Queue::RSpecRunner} - Integration tests", :cle
|
|
2537
2543
|
expect(actual.exit_code).to eq 0
|
2538
2544
|
end
|
2539
2545
|
end
|
2546
|
+
|
2547
|
+
context 'when rspec is run without knapsack_pro' do
|
2548
|
+
let(:spec) { Spec.new('a_spec.rb', <<~SPEC) }
|
2549
|
+
require_relative "spec_helper.rb"
|
2550
|
+
|
2551
|
+
describe 'A_describe' do
|
2552
|
+
it 'A1 test example' do
|
2553
|
+
expect(1).to eq 1
|
2554
|
+
end
|
2555
|
+
end
|
2556
|
+
SPEC
|
2557
|
+
|
2558
|
+
let(:command) { "bundle exec rspec #{spec.path}" }
|
2559
|
+
|
2560
|
+
it 'runs successfully' do
|
2561
|
+
generate_spec_helper(spec_helper_with_knapsack)
|
2562
|
+
generate_spec_files([spec])
|
2563
|
+
|
2564
|
+
actual = subject
|
2565
|
+
|
2566
|
+
expect(actual.stdout).to include('1 example, 0 failures')
|
2567
|
+
expect(actual.exit_code).to eq 0
|
2568
|
+
end
|
2569
|
+
end
|
2540
2570
|
end
|
@@ -16,4 +16,40 @@ describe KnapsackPro::Utils do
|
|
16
16
|
])
|
17
17
|
end
|
18
18
|
end
|
19
|
+
|
20
|
+
describe '.time_now' do
|
21
|
+
subject { described_class.time_now }
|
22
|
+
|
23
|
+
context 'when Timecop does not mock the time' do
|
24
|
+
it do
|
25
|
+
now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
26
|
+
expect(subject).to be_within(0.001).of(now)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'when Timecop does mock the process clock' do
|
31
|
+
around(:example) do |ex|
|
32
|
+
unless Gem::Version.new(Timecop::VERSION) >= Gem::Version.new('0.9.9')
|
33
|
+
raise 'Timecop >= 0.9.9 is required to run this test. Please run: bundle update'
|
34
|
+
end
|
35
|
+
|
36
|
+
if Gem::Version.new(Timecop::VERSION) >= Gem::Version.new('0.9.10')
|
37
|
+
Timecop.mock_process_clock = true
|
38
|
+
ex.run
|
39
|
+
Timecop.mock_process_clock = false
|
40
|
+
else
|
41
|
+
ex.run
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
it do
|
46
|
+
now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
47
|
+
|
48
|
+
time = Time.local(2020, 1, 31)
|
49
|
+
Timecop.travel(time) do
|
50
|
+
expect(subject).to be_within(0.001).of(now)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
19
55
|
end
|
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: 7.
|
4
|
+
version: 7.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ArturT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -170,14 +170,14 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - ">="
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 0.9.
|
173
|
+
version: 0.9.9
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 0.9.
|
180
|
+
version: 0.9.9
|
181
181
|
description: Knapsack Pro wraps your current test runner(s) and works with your existing
|
182
182
|
CI infrastructure to parallelize tests optimally. It dynamically splits your tests
|
183
183
|
based on up-to-date test execution data. It's designed from the ground up for CI
|
@@ -415,7 +415,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
415
415
|
- !ruby/object:Gem::Version
|
416
416
|
version: '0'
|
417
417
|
requirements: []
|
418
|
-
rubygems_version: 3.
|
418
|
+
rubygems_version: 3.5.9
|
419
419
|
signing_key:
|
420
420
|
specification_version: 4
|
421
421
|
summary: Knapsack Pro splits tests across parallel CI nodes and ensures each parallel
|