knapsack_pro 1.22.0 → 1.22.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c1620234d6399fb4f66840cc101d290f70e9b8c6bbb6c7f2df7b2f2fa16062a
4
- data.tar.gz: f0d3b9c93244b37baa1817bb2b910d1e4e1f3a84e13482f90755a528a04c8a5a
3
+ metadata.gz: 1ff5e0f88a008abb13c1ca010f4b430be290ecf4e349719cac39611eebc575a4
4
+ data.tar.gz: 83650913e5d6cd21201ebce5ae48c731d61a0bc27bb37f566fcdc3d96a9b0598
5
5
  SHA512:
6
- metadata.gz: 5bfe8f48e23514d4dc3c9dd957fbaa5d14d39fae4b9c6eb5c9426eeaae9a57007fb379d6a00860ea30b4cb9766444678e55bf306bba742cf80d470387e22c9a7
7
- data.tar.gz: 171de7e1e9c7dbf18b291ffd0f183459e0b9a41b0c60ff2c15de4867db6c07caefcae8e3d57718a001e04c49320878cc022656cfc82709b948e48770dafb2b5c
6
+ metadata.gz: 3b3d2dc24c6592040f559f77f59168502bb949b135406a06f59c836494902412e202a28bc781760e0862f416ccaa2d2c9a246269fee87e9fd3d9120ba803f4ab
7
+ data.tar.gz: 9d4005922f963d765b494ab2b35642fa3be85787a6deb8b490ed3e1f64e5055d474d4cdae5b1bba4d4668b4c63fd59d9063102baf7036830e53d409ba8cf016a
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ### 1.22.1
4
+
5
+ * 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.
6
+
7
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/113
8
+
9
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v1.22.0...v1.22.1
10
+
3
11
  ### 1.22.0
4
12
 
5
13
  * 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
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
@@ -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.22.0'
2
+ VERSION = '1.22.1'
3
3
  end
@@ -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.22.0
4
+ version: 1.22.1
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-20 00:00:00.000000000 Z
11
+ date: 2020-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake