knapsack_pro 1.21.0 → 2.0.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: 59df1c0c620e9c92fb18e3963029fd02df6f04754ffe1b5c590cd7ca45159f55
4
- data.tar.gz: 5cf6b36b8f908d8dbb9788918f7586c3b0334ec91a3a79afd768fbde3a8088b2
3
+ metadata.gz: 575934b81520ce3bbf894d8cf643ae5af0279fd43b0529c62d8a4b71a595fbc8
4
+ data.tar.gz: dbebdb5c243e9a363a0f4737d4d78d9c2f1ff66f18e8087faafaece2299998eb
5
5
  SHA512:
6
- metadata.gz: ae228667bbd897ad31512140d6c6382aefe2fce977748f909b3da7cca7a39495731cde4e079cd8a0247bd2d332fe8809aecf69fe773c34f864e74febc0a4dbbc
7
- data.tar.gz: fc8255bc114f010a6a85a14aa98dab171767769e8476c3c422fd92e17198588e767f08bdb1072ca36c5038aef23af4396a8b44fa271b720845f26bd16fbae32b
6
+ metadata.gz: e636160f7c6793f371840b481154a7bcb6a5215580f5d5a92cd4be21242a544bc3c6bbf6c64d92da66fb2228e20f1ccf3836408405881c460c85472b0f3fbcb4
7
+ data.tar.gz: 41375edcb7f40c0044bacba75a89f0e43766261db0c148b525a565580592ad08df3cc9f37843fd056bc29ef79e0e3437266512cbdb6ddc7ce81219ee5ba92edf
@@ -1,5 +1,54 @@
1
1
  # Change Log
2
2
 
3
+ ### 2.0.0
4
+
5
+ * Add support for CI build ID for Github Actions
6
+
7
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/116
8
+
9
+ __Migration path for Github Actions users - required__
10
+
11
+ If you use Github Actions and Knapsack Pro Queue Mode then you must set in Github Actions environment variable: `KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true`. Thanks to that when you retry CI build then tests will run based on previously recorded tests. This solves problem mentioned in the [PR](https://github.com/KnapsackPro/knapsack_pro-ruby/pull/116).
12
+
13
+ __Migration path for other users__ - just update `knapsack_pro` gem. Nothing to change in your code :)
14
+
15
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v1.22.3...v2.0.0
16
+
17
+ ### 1.22.3
18
+
19
+ * Support for non-delimited formatting params of RSpec like `-fMyCustomFormatter`
20
+
21
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/115
22
+
23
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v1.22.2...v1.22.3
24
+
25
+ ### 1.22.2
26
+
27
+ * Log when next retry request to Knapsack Pro API happens before starting Fallback Mode
28
+
29
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/114
30
+
31
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v1.22.1...v1.22.2
32
+
33
+ ### 1.22.1
34
+
35
+ * Fix for an auto split of slow RSpec test files by test examples when using `KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES=true` and `parallel_tests` gem. Save the JSON reports with unique file names with the CI node index in the name to avoid accidentally overriding the files on the same disk.
36
+
37
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/113
38
+
39
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v1.22.0...v1.22.1
40
+
41
+ ### 1.22.0
42
+
43
+ * Increase request retry timebox from 4s to 8s to not flood Knapsack Pro API with too many requests in a short period of time and to give time for API server to autoscale and add additional machines to serve traffic
44
+ * When Fallback Mode is disabled with env `KNAPSACK_PRO_FALLBACK_MODE_ENABLED=false` then retry the request to Knapsack Pro API for 6 times instead of only 3 times.
45
+
46
+ Here is related [info why some users want to disable Fallback Mode](https://github.com/KnapsackPro/knapsack_pro-ruby#required-ci-configuration-if-you-use-retry-single-failed-ci-node-feature-on-your-ci-server-when-knapsack_pro_fixed_queue_splittrue-in-queue-mode-or-knapsack_pro_fixed_test_suite_splittrue-in-regular-mode).
47
+
48
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/112
49
+
50
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v1.21.0...v1.22.0
51
+
3
52
  ### 1.21.0
4
53
 
5
54
  * Automatically detect slow test files for RSpec and split them by test examples when `KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES=true`
data/README.md CHANGED
@@ -711,7 +711,7 @@ Read below required configuration step if you use Queue Mode and you set [`KNAPS
711
711
 
712
712
  If you use other CI server you need to manually configure your CI server to set `KNAPSACK_PRO_CI_NODE_RETRY_COUNT=1` only during retry CI node attempt. If `KNAPSACK_PRO_CI_NODE_RETRY_COUNT > 0` then knapsack_pro won't allow starting running tests in Fallback Mode and instead will raise error so a user can manually retry CI node later when a connection to Knapsack Pro API can be established.
713
713
 
714
- If you cannot set `KNAPSACK_PRO_CI_NODE_RETRY_COUNT` only for retried CI node or it is not possible for your CI server then you can disable Fallback Mode completely `KNAPSACK_PRO_FALLBACK_MODE_ENABLED=false`.
714
+ If you cannot set `KNAPSACK_PRO_CI_NODE_RETRY_COUNT` only for retried CI node or it is not possible for your CI server then you can disable Fallback Mode completely `KNAPSACK_PRO_FALLBACK_MODE_ENABLED=false`. When Fallback Mode is disabled then knapsack_pro gem will try to connect to Knapsack Pro API 6 times instead of only 3 times to ensure there is a low chance of failing your CI node due to lost connection with the API.
715
715
 
716
716
  ### Passing arguments to rake task
717
717
 
@@ -991,19 +991,28 @@ You can parallelize your builds across virtual machines with [travis matrix feat
991
991
 
992
992
  ```yaml
993
993
  script:
994
- # Step for RSpec
994
+ # Step for RSpec in Regular Mode
995
995
  - "bundle exec rake knapsack_pro:rspec"
996
996
 
997
- # Step for Cucumber
997
+ # Step for RSpec in Queue Mode
998
+ - "bundle exec rake knapsack_pro:queue:rspec"
999
+
1000
+ # Step for Cucumber in Regular Mode
998
1001
  - "bundle exec rake knapsack_pro:cucumber"
999
1002
 
1000
- # Step for Minitest
1003
+ # Step for Cucumber in Queue Mode
1004
+ - "bundle exec rake knapsack_pro:queue:cucumber"
1005
+
1006
+ # Step for Minitest in Regular Mode
1001
1007
  - "bundle exec rake knapsack_pro:minitest"
1002
1008
 
1003
- # Step for test-unit
1009
+ # Step for Minitest in Queue Mode
1010
+ - "bundle exec rake knapsack_pro:queue:minitest"
1011
+
1012
+ # Step for test-unit in Regular Mode
1004
1013
  - "bundle exec rake knapsack_pro:test_unit"
1005
1014
 
1006
- # Step for Spinach
1015
+ # Step for Spinach in Regular Mode
1007
1016
  - "bundle exec rake knapsack_pro:spinach"
1008
1017
 
1009
1018
  env:
@@ -1015,6 +1024,10 @@ env:
1015
1024
  - KNAPSACK_PRO_TEST_SUITE_TOKEN_TEST_UNIT=test-unit-token
1016
1025
  - KNAPSACK_PRO_TEST_SUITE_TOKEN_SPINACH=spinach-token
1017
1026
 
1027
+ # if you use Knapsack Pro Queue Mode you must set below env variable
1028
+ # to be able to retry single failed parallel job from Travis UI
1029
+ - KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true
1030
+
1018
1031
  - KNAPSACK_PRO_CI_NODE_TOTAL=2
1019
1032
  jobs:
1020
1033
  - KNAPSACK_PRO_CI_NODE_INDEX=0
@@ -1626,6 +1639,9 @@ jobs:
1626
1639
  KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }}
1627
1640
  KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }}
1628
1641
  KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }}
1642
+ # if you use Knapsack Pro Queue Mode you must set below env variable
1643
+ # to be able to retry CI build and run previously recorded tests
1644
+ KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true
1629
1645
  run: |
1630
1646
  # run tests in Knapsack Pro Regular Mode
1631
1647
  bundle exec rake knapsack_pro:rspec
@@ -4,8 +4,8 @@ module KnapsackPro
4
4
  class ServerError < StandardError; end
5
5
 
6
6
  TIMEOUT = 15
7
- MAX_RETRY = 3
8
- REQUEST_RETRY_TIMEBOX = 4
7
+ MAX_RETRY = -> { KnapsackPro::Config::Env.fallback_mode_enabled? ? 3 : 6 }
8
+ REQUEST_RETRY_TIMEBOX = 8
9
9
 
10
10
  def initialize(action)
11
11
  @action = action
@@ -118,10 +118,14 @@ module KnapsackPro
118
118
  rescue ServerError, Errno::ECONNREFUSED, Errno::ETIMEDOUT, Errno::EPIPE, EOFError, SocketError, Net::OpenTimeout, Net::ReadTimeout, OpenSSL::SSL::SSLError => e
119
119
  logger.warn(e.inspect)
120
120
  retries += 1
121
- if retries < MAX_RETRY
121
+ if retries < MAX_RETRY.call
122
122
  wait = retries * REQUEST_RETRY_TIMEBOX
123
123
  logger.warn("Wait #{wait}s and retry request to Knapsack Pro API.")
124
- Kernel.sleep(wait)
124
+ print_every = 2 # seconds
125
+ (wait / print_every).ceil.times do |i|
126
+ logger.warn("Next request in #{wait - i * print_every}s...")
127
+ Kernel.sleep(print_every)
128
+ end
125
129
  retry
126
130
  else
127
131
  response_body
@@ -1,4 +1,4 @@
1
- # https://help.github.com/en/articles/virtual-environments-for-github-actions#environment-variables
1
+ # https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables
2
2
  module KnapsackPro
3
3
  module Config
4
4
  module CI
@@ -12,7 +12,8 @@ module KnapsackPro
12
12
  end
13
13
 
14
14
  def node_build_id
15
- # not provided
15
+ # A unique number for each run within a repository. This number does not change if you re-run the workflow run.
16
+ ENV['GITHUB_RUN_ID']
16
17
  end
17
18
 
18
19
  def commit_hash
@@ -16,7 +16,7 @@ module KnapsackPro
16
16
  cli_args = (args || '').split
17
17
  # if user didn't provide the format then use explicitly default progress formatter
18
18
  # in order to avoid KnapsackPro::Formatters::RSpecQueueSummaryFormatter being the only default formatter
19
- if !cli_args.include?('--format') && !cli_args.include?('-f')
19
+ if !cli_args.any? { |arg| arg.start_with?('-f') || arg.start_with?('--format')}
20
20
  cli_args += ['--format', 'progress']
21
21
  end
22
22
  cli_args += [
@@ -2,7 +2,6 @@ module KnapsackPro
2
2
  class SlowTestFileDeterminer
3
3
  TIME_THRESHOLD_PER_CI_NODE = 0.7 # 70%
4
4
  REPORT_DIR = 'tmp/knapsack_pro/slow_test_file_determiner'
5
- REPORT_PATH = "#{REPORT_DIR}/slow_test_files.json"
6
5
 
7
6
  # test_files: { 'path' => 'a_spec.rb', 'time_execution' => 0.0 }
8
7
  # time_execution: of build distribution (total time of CI build run)
@@ -16,13 +15,19 @@ module KnapsackPro
16
15
 
17
16
  def self.save_to_json_report(test_files)
18
17
  FileUtils.mkdir_p(REPORT_DIR)
19
- File.write(REPORT_PATH, test_files.to_json)
18
+ File.write(report_path, test_files.to_json)
20
19
  end
21
20
 
22
21
  def self.read_from_json_report
23
- raise 'Report with slow test files was not generated yet. If you have enabled split by test cases https://github.com/KnapsackPro/knapsack_pro-ruby#split-test-files-by-test-cases and you see this error it means that your tests accidentally cleaned up tmp/knapsack_pro directory. Please do not remove this directory during tests runtime!' unless File.exists?(REPORT_PATH)
24
- slow_test_files_json_report = File.read(REPORT_PATH)
22
+ raise 'Report with slow test files was not generated yet. If you have enabled split by test cases https://github.com/KnapsackPro/knapsack_pro-ruby#split-test-files-by-test-cases and you see this error it means that your tests accidentally cleaned up tmp/knapsack_pro directory. Please do not remove this directory during tests runtime!' unless File.exists?(report_path)
23
+ slow_test_files_json_report = File.read(report_path)
25
24
  JSON.parse(slow_test_files_json_report)
26
25
  end
26
+
27
+ private
28
+
29
+ def self.report_path
30
+ "#{REPORT_DIR}/slow_test_files_node_#{KnapsackPro::Config::Env.ci_node_index}.json"
31
+ end
27
32
  end
28
33
  end
@@ -2,7 +2,6 @@ module KnapsackPro
2
2
  module TestCaseDetectors
3
3
  class RSpecTestExampleDetector
4
4
  REPORT_DIR = 'tmp/knapsack_pro/test_case_detectors/rspec'
5
- REPORT_PATH = "#{REPORT_DIR}/rspec_dry_run_json_report.json"
6
5
 
7
6
  def generate_json_report
8
7
  require 'rspec/core'
@@ -22,13 +21,13 @@ module KnapsackPro
22
21
 
23
22
  if test_file_entities.empty?
24
23
  no_examples_json = { examples: [] }.to_json
25
- File.write(REPORT_PATH, no_examples_json)
24
+ File.write(report_path, no_examples_json)
26
25
  return
27
26
  end
28
27
 
29
28
  cli_args = cli_format + [
30
29
  '--dry-run',
31
- '--out', REPORT_PATH,
30
+ '--out', report_path,
32
31
  '--default-path', test_dir,
33
32
  ] + KnapsackPro::TestFilePresenter.paths(test_file_entities)
34
33
  options = RSpec::Core::ConfigurationOptions.new(cli_args)
@@ -39,9 +38,9 @@ module KnapsackPro
39
38
  end
40
39
 
41
40
  def test_file_example_paths
42
- raise "No report found at #{REPORT_PATH}" unless File.exists?(REPORT_PATH)
41
+ raise "No report found at #{report_path}" unless File.exists?(report_path)
43
42
 
44
- json_report = File.read(REPORT_PATH)
43
+ json_report = File.read(report_path)
45
44
  hash_report = JSON.parse(json_report)
46
45
  hash_report
47
46
  .fetch('examples')
@@ -61,6 +60,10 @@ module KnapsackPro
61
60
 
62
61
  private
63
62
 
63
+ def report_path
64
+ "#{REPORT_DIR}/rspec_dry_run_json_report_node_#{KnapsackPro::Config::Env.ci_node_index}.json"
65
+ end
66
+
64
67
  def adapter_class
65
68
  KnapsackPro::Adapters::RSpecAdapter
66
69
  end
@@ -78,7 +81,7 @@ module KnapsackPro
78
81
  end
79
82
 
80
83
  def remove_old_json_report
81
- File.delete(REPORT_PATH) if File.exists?(REPORT_PATH)
84
+ File.delete(report_path) if File.exists?(report_path)
82
85
  end
83
86
 
84
87
  def test_file_hash_for(test_file_path)
@@ -1,3 +1,3 @@
1
1
  module KnapsackPro
2
- VERSION = '1.21.0'
2
+ VERSION = '2.0.0'
3
3
  end
@@ -72,12 +72,13 @@ shared_examples 'when retry request' do
72
72
 
73
73
  before do
74
74
  expect(KnapsackPro).to receive(:logger).at_least(1).and_return(logger)
75
+ end
76
+
77
+ it do
75
78
  expect(logger).to receive(:debug).exactly(3).with("#{expected_http_method} http://api.knapsackpro.test:3000/v1/fake_endpoint")
76
79
  expect(logger).to receive(:debug).exactly(3).with('API request UUID: fake-uuid')
77
80
  expect(logger).to receive(:debug).exactly(3).with('API response:')
78
- end
79
81
 
80
- it do
81
82
  parsed_response = { 'error' => 'Internal Server Error' }
82
83
 
83
84
  expect(logger).to receive(:error).exactly(3).with(parsed_response)
@@ -85,16 +86,84 @@ shared_examples 'when retry request' do
85
86
  server_error = described_class::ServerError.new(parsed_response)
86
87
  expect(logger).to receive(:warn).exactly(3).with(server_error.inspect)
87
88
 
88
- expect(logger).to receive(:warn).with("Wait 4s and retry request to Knapsack Pro API.")
89
89
  expect(logger).to receive(:warn).with("Wait 8s and retry request to Knapsack Pro API.")
90
- expect(Kernel).to receive(:sleep).with(4)
91
- expect(Kernel).to receive(:sleep).with(8)
90
+ expect(logger).to receive(:warn).with("Next request in 8s...")
91
+ expect(logger).to receive(:warn).with("Next request in 6s...")
92
+ expect(logger).to receive(:warn).with("Next request in 4s...")
93
+ expect(logger).to receive(:warn).with("Next request in 2s...")
94
+ expect(logger).to receive(:warn).with("Wait 16s and retry request to Knapsack Pro API.")
95
+ expect(logger).to receive(:warn).with("Next request in 16s...")
96
+ expect(logger).to receive(:warn).with("Next request in 14s...")
97
+ expect(logger).to receive(:warn).with("Next request in 12s...")
98
+ expect(logger).to receive(:warn).with("Next request in 10s...")
99
+ expect(logger).to receive(:warn).with("Next request in 8s...")
100
+ expect(logger).to receive(:warn).with("Next request in 6s...")
101
+ expect(logger).to receive(:warn).with("Next request in 4s...")
102
+ expect(logger).to receive(:warn).with("Next request in 2s...")
103
+ expect(Kernel).to receive(:sleep).exactly(12).with(2)
92
104
 
93
105
  expect(subject).to eq(parsed_response)
94
106
 
95
107
  expect(connection.success?).to be false
96
108
  expect(connection.errors?).to be true
97
109
  end
110
+
111
+ context 'when Fallback Mode is disabled' do
112
+ before do
113
+ expect(KnapsackPro::Config::Env).to receive(:fallback_mode_enabled?).at_least(1).and_return(false)
114
+ end
115
+
116
+ it do
117
+ expect(logger).to receive(:debug).exactly(6).with("#{expected_http_method} http://api.knapsackpro.test:3000/v1/fake_endpoint")
118
+ expect(logger).to receive(:debug).exactly(6).with('API request UUID: fake-uuid')
119
+ expect(logger).to receive(:debug).exactly(6).with('API response:')
120
+
121
+ parsed_response = { 'error' => 'Internal Server Error' }
122
+
123
+ expect(logger).to receive(:error).exactly(6).with(parsed_response)
124
+
125
+ server_error = described_class::ServerError.new(parsed_response)
126
+ expect(logger).to receive(:warn).exactly(6).with(server_error.inspect)
127
+
128
+ expect(logger).to receive(:warn).with("Wait 8s and retry request to Knapsack Pro API.")
129
+ expect(logger).to receive(:warn).with("Next request in 8s...")
130
+ expect(logger).to receive(:warn).with("Next request in 6s...")
131
+ expect(logger).to receive(:warn).with("Next request in 4s...")
132
+ expect(logger).to receive(:warn).with("Next request in 2s...")
133
+
134
+ expect(logger).to receive(:warn).with("Wait 16s and retry request to Knapsack Pro API.")
135
+ expect(logger).to receive(:warn).with("Next request in 16s...")
136
+ expect(logger).to receive(:warn).with("Next request in 14s...")
137
+ expect(logger).to receive(:warn).with("Next request in 12s...")
138
+ expect(logger).to receive(:warn).with("Next request in 10s...")
139
+ expect(logger).to receive(:warn).with("Next request in 8s...")
140
+ expect(logger).to receive(:warn).with("Next request in 6s...")
141
+ expect(logger).to receive(:warn).with("Next request in 4s...")
142
+ expect(logger).to receive(:warn).with("Next request in 2s...")
143
+
144
+ expect(logger).to receive(:warn).with("Wait 24s and retry request to Knapsack Pro API.")
145
+ 12.times do |i|
146
+ expect(logger).to receive(:warn).with("Next request in #{(i+1)*2}s...")
147
+ end
148
+
149
+ expect(logger).to receive(:warn).with("Wait 32s and retry request to Knapsack Pro API.")
150
+ 16.times do |i|
151
+ expect(logger).to receive(:warn).with("Next request in #{(i+1)*2}s...")
152
+ end
153
+
154
+ expect(logger).to receive(:warn).with("Wait 40s and retry request to Knapsack Pro API.")
155
+ 20.times do |i|
156
+ expect(logger).to receive(:warn).with("Next request in #{(i+1)*2}s...")
157
+ end
158
+
159
+ expect(Kernel).to receive(:sleep).exactly(60).with(2)
160
+
161
+ expect(subject).to eq(parsed_response)
162
+
163
+ expect(connection.success?).to be false
164
+ expect(connection.errors?).to be true
165
+ end
166
+ end
98
167
  end
99
168
  end
100
169
 
@@ -186,7 +255,7 @@ describe KnapsackPro::Client::Connection do
186
255
  let(:http_method) { :post }
187
256
 
188
257
  before do
189
- expect(http).to receive(:post).exactly(3).with(
258
+ expect(http).to receive(:post).at_least(3).with(
190
259
  endpoint_path,
191
260
  request_hash.to_json,
192
261
  {
@@ -210,7 +279,7 @@ describe KnapsackPro::Client::Connection do
210
279
  before do
211
280
  uri = URI.parse("http://api.knapsackpro.test:3000#{endpoint_path}")
212
281
  uri.query = URI.encode_www_form(request_hash)
213
- expect(http).to receive(:get).exactly(3).with(
282
+ expect(http).to receive(:get).at_least(3).with(
214
283
  uri,
215
284
  {
216
285
  'Content-Type' => 'application/json',
@@ -22,7 +22,14 @@ describe KnapsackPro::Config::CI::GithubActions do
22
22
  describe '#node_build_id' do
23
23
  subject { described_class.new.node_build_id }
24
24
 
25
- it { should be nil }
25
+ context 'when environment exists' do
26
+ let(:env) { { 'GITHUB_RUN_ID' => 2706 } }
27
+ it { should eql 2706 }
28
+ end
29
+
30
+ context "when environment doesn't exist" do
31
+ it { should be nil }
32
+ end
26
33
  end
27
34
 
28
35
  describe '#commit_hash' do
@@ -104,6 +104,31 @@ describe KnapsackPro::Runners::Queue::RSpecRunner do
104
104
  subject
105
105
  end
106
106
  end
107
+
108
+ context 'when format param is provided without a delimiter' do
109
+ let(:args) { '-fMyCustomFormatter' }
110
+
111
+ it 'uses provided format param instead of default formatter progress' do
112
+ expected_exitstatus = 0
113
+ expected_accumulator = {
114
+ status: :completed,
115
+ exitstatus: expected_exitstatus
116
+ }
117
+ accumulator = {
118
+ status: :next,
119
+ runner: runner,
120
+ can_initialize_queue: true,
121
+ args: ['-fMyCustomFormatter', '--format', 'KnapsackPro::Formatters::RSpecQueueSummaryFormatter', '--default-path', 'fake-test-dir'],
122
+ exitstatus: 0,
123
+ all_test_file_paths: [],
124
+ }
125
+ expect(described_class).to receive(:run_tests).with(accumulator).and_return(expected_accumulator)
126
+
127
+ expect(Kernel).to receive(:exit).with(expected_exitstatus)
128
+
129
+ subject
130
+ end
131
+ end
107
132
  end
108
133
 
109
134
  context 'when args not provided' do
@@ -27,7 +27,7 @@ describe KnapsackPro::SlowTestFileDeterminer do
27
27
  end
28
28
 
29
29
  describe '.save_to_json_report', :clear_tmp do
30
- let(:json_report_path) { 'tmp/knapsack_pro/slow_test_file_determiner/slow_test_files.json' }
30
+ let(:json_report_path) { 'tmp/knapsack_pro/slow_test_file_determiner/slow_test_files_node_0.json' }
31
31
  let(:test_files) do
32
32
  [
33
33
  { 'path' => 'a_spec.rb', 'time_execution' => 1.0 },
@@ -1,6 +1,6 @@
1
1
  describe KnapsackPro::TestCaseDetectors::RSpecTestExampleDetector do
2
2
  let(:report_dir) { 'tmp/knapsack_pro/test_case_detectors/rspec' }
3
- let(:report_path) { 'tmp/knapsack_pro/test_case_detectors/rspec/rspec_dry_run_json_report.json' }
3
+ let(:report_path) { 'tmp/knapsack_pro/test_case_detectors/rspec/rspec_dry_run_json_report_node_0.json' }
4
4
  let(:rspec_test_example_detector) { described_class.new }
5
5
 
6
6
  describe '#generate_json_report' do
@@ -116,7 +116,7 @@ describe KnapsackPro::TestCaseDetectors::RSpecTestExampleDetector do
116
116
  it do
117
117
  expect(File).to receive(:exists?).with(report_path).and_return(false)
118
118
 
119
- expect { subject }.to raise_error(RuntimeError, 'No report found at tmp/knapsack_pro/test_case_detectors/rspec/rspec_dry_run_json_report.json')
119
+ expect { subject }.to raise_error(RuntimeError, 'No report found at tmp/knapsack_pro/test_case_detectors/rspec/rspec_dry_run_json_report_node_0.json')
120
120
  end
121
121
  end
122
122
  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: 1.21.0
4
+ version: 2.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: 2020-05-06 00:00:00.000000000 Z
11
+ date: 2020-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake