knapsack_pro 3.8.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +377 -23
  3. data/.github/dependabot.yml +11 -0
  4. data/.github/pull_request_template.md +22 -0
  5. data/.gitignore +4 -0
  6. data/CHANGELOG.md +325 -1
  7. data/Gemfile +9 -0
  8. data/README.md +3 -10
  9. data/bin/test +15 -0
  10. data/knapsack_pro.gemspec +7 -6
  11. data/lib/knapsack_pro/adapters/base_adapter.rb +17 -2
  12. data/lib/knapsack_pro/adapters/cucumber_adapter.rb +3 -3
  13. data/lib/knapsack_pro/adapters/minitest_adapter.rb +2 -0
  14. data/lib/knapsack_pro/adapters/rspec_adapter.rb +88 -49
  15. data/lib/knapsack_pro/adapters/spinach_adapter.rb +2 -0
  16. data/lib/knapsack_pro/adapters/test_unit_adapter.rb +2 -0
  17. data/lib/knapsack_pro/allocator.rb +2 -0
  18. data/lib/knapsack_pro/allocator_builder.rb +2 -0
  19. data/lib/knapsack_pro/base_allocator_builder.rb +8 -25
  20. data/lib/knapsack_pro/build_distribution_fetcher.rb +2 -0
  21. data/lib/knapsack_pro/client/api/action.rb +2 -0
  22. data/lib/knapsack_pro/client/api/v1/base.rb +2 -0
  23. data/lib/knapsack_pro/client/api/v1/build_distributions.rb +5 -0
  24. data/lib/knapsack_pro/client/api/v1/build_subsets.rb +2 -0
  25. data/lib/knapsack_pro/client/api/v1/queues.rb +6 -1
  26. data/lib/knapsack_pro/client/connection.rb +5 -6
  27. data/lib/knapsack_pro/config/ci/app_veyor.rb +18 -0
  28. data/lib/knapsack_pro/config/ci/base.rb +27 -0
  29. data/lib/knapsack_pro/config/ci/buildkite.rb +18 -0
  30. data/lib/knapsack_pro/config/ci/circle.rb +18 -0
  31. data/lib/knapsack_pro/config/ci/cirrus_ci.rb +18 -0
  32. data/lib/knapsack_pro/config/ci/codefresh.rb +18 -0
  33. data/lib/knapsack_pro/config/ci/codeship.rb +18 -0
  34. data/lib/knapsack_pro/config/ci/github_actions.rb +26 -0
  35. data/lib/knapsack_pro/config/ci/gitlab_ci.rb +20 -1
  36. data/lib/knapsack_pro/config/ci/heroku.rb +18 -0
  37. data/lib/knapsack_pro/config/ci/semaphore.rb +16 -0
  38. data/lib/knapsack_pro/config/ci/semaphore2.rb +19 -0
  39. data/lib/knapsack_pro/config/ci/travis.rb +18 -0
  40. data/lib/knapsack_pro/config/env.rb +46 -22
  41. data/lib/knapsack_pro/config/env_generator.rb +2 -0
  42. data/lib/knapsack_pro/config/temp_files.rb +8 -4
  43. data/lib/knapsack_pro/crypto/branch_encryptor.rb +2 -0
  44. data/lib/knapsack_pro/crypto/decryptor.rb +2 -0
  45. data/lib/knapsack_pro/crypto/digestor.rb +2 -0
  46. data/lib/knapsack_pro/crypto/encryptor.rb +2 -0
  47. data/lib/knapsack_pro/extensions/rspec_extension.rb +137 -0
  48. data/lib/knapsack_pro/formatters/rspec_json_formatter.rb +2 -0
  49. data/lib/knapsack_pro/formatters/time_tracker.rb +152 -0
  50. data/lib/knapsack_pro/formatters/time_tracker_fetcher.rb +20 -0
  51. data/lib/knapsack_pro/hooks/queue.rb +2 -0
  52. data/lib/knapsack_pro/logger_wrapper.rb +2 -0
  53. data/lib/knapsack_pro/mask_string.rb +9 -0
  54. data/lib/knapsack_pro/presenter.rb +6 -3
  55. data/lib/knapsack_pro/pure/queue/rspec_pure.rb +92 -0
  56. data/lib/knapsack_pro/queue_allocator.rb +2 -0
  57. data/lib/knapsack_pro/queue_allocator_builder.rb +2 -0
  58. data/lib/knapsack_pro/railtie.rb +2 -0
  59. data/lib/knapsack_pro/report.rb +15 -9
  60. data/lib/knapsack_pro/repository_adapter_initiator.rb +2 -0
  61. data/lib/knapsack_pro/repository_adapters/base_adapter.rb +2 -0
  62. data/lib/knapsack_pro/repository_adapters/env_adapter.rb +2 -0
  63. data/lib/knapsack_pro/repository_adapters/git_adapter.rb +50 -0
  64. data/lib/knapsack_pro/runners/base_runner.rb +2 -0
  65. data/lib/knapsack_pro/runners/cucumber_runner.rb +2 -0
  66. data/lib/knapsack_pro/runners/minitest_runner.rb +2 -0
  67. data/lib/knapsack_pro/runners/queue/base_runner.rb +29 -0
  68. data/lib/knapsack_pro/runners/queue/cucumber_runner.rb +9 -6
  69. data/lib/knapsack_pro/runners/queue/minitest_runner.rb +13 -6
  70. data/lib/knapsack_pro/runners/queue/rspec_runner.rb +128 -135
  71. data/lib/knapsack_pro/runners/rspec_runner.rb +22 -3
  72. data/lib/knapsack_pro/runners/spinach_runner.rb +2 -0
  73. data/lib/knapsack_pro/runners/test_unit_runner.rb +2 -0
  74. data/lib/knapsack_pro/slow_test_file_determiner.rb +2 -0
  75. data/lib/knapsack_pro/slow_test_file_finder.rb +2 -0
  76. data/lib/knapsack_pro/task_loader.rb +2 -0
  77. data/lib/knapsack_pro/test_case_detectors/rspec_test_example_detector.rb +2 -0
  78. data/lib/knapsack_pro/test_case_mergers/base_merger.rb +2 -0
  79. data/lib/knapsack_pro/test_case_mergers/rspec_merger.rb +2 -0
  80. data/lib/knapsack_pro/test_file_cleaner.rb +2 -0
  81. data/lib/knapsack_pro/test_file_finder.rb +2 -0
  82. data/lib/knapsack_pro/test_file_pattern.rb +2 -0
  83. data/lib/knapsack_pro/test_file_presenter.rb +2 -0
  84. data/lib/knapsack_pro/test_files_with_test_cases_composer.rb +2 -0
  85. data/lib/knapsack_pro/test_flat_distributor.rb +2 -0
  86. data/lib/knapsack_pro/tracker.rb +3 -3
  87. data/lib/knapsack_pro/urls.rb +4 -0
  88. data/lib/knapsack_pro/utils.rb +2 -0
  89. data/lib/knapsack_pro/version.rb +3 -1
  90. data/lib/knapsack_pro.rb +5 -3
  91. data/lib/tasks/cucumber.rake +2 -0
  92. data/lib/tasks/encrypted_branch_names.rake +2 -0
  93. data/lib/tasks/encrypted_test_file_names.rake +2 -0
  94. data/lib/tasks/minitest.rake +2 -0
  95. data/lib/tasks/queue/cucumber.rake +13 -0
  96. data/lib/tasks/queue/minitest.rake +13 -0
  97. data/lib/tasks/queue/rspec.rake +13 -0
  98. data/lib/tasks/rspec.rake +5 -0
  99. data/lib/tasks/salt.rake +2 -0
  100. data/lib/tasks/spinach.rake +2 -0
  101. data/lib/tasks/test_unit.rake +2 -0
  102. data/spec/integration/api/build_distributions_subset_spec.rb +1 -0
  103. data/spec/integration/runners/queue/rspec_runner.rb +80 -0
  104. data/spec/integration/runners/queue/rspec_runner_spec.rb +2232 -0
  105. data/spec/knapsack_pro/adapters/base_adapter_spec.rb +30 -11
  106. data/spec/knapsack_pro/adapters/cucumber_adapter_spec.rb +2 -5
  107. data/spec/knapsack_pro/adapters/rspec_adapter_spec.rb +146 -174
  108. data/spec/knapsack_pro/base_allocator_builder_spec.rb +22 -48
  109. data/spec/knapsack_pro/client/api/v1/build_distributions_spec.rb +19 -27
  110. data/spec/knapsack_pro/client/api/v1/queues_spec.rb +23 -43
  111. data/spec/knapsack_pro/client/connection_spec.rb +59 -7
  112. data/spec/knapsack_pro/config/ci/app_veyor_spec.rb +22 -8
  113. data/spec/knapsack_pro/config/ci/base_spec.rb +1 -0
  114. data/spec/knapsack_pro/config/ci/buildkite_spec.rb +51 -16
  115. data/spec/knapsack_pro/config/ci/circle_spec.rb +48 -13
  116. data/spec/knapsack_pro/config/ci/cirrus_ci_spec.rb +12 -12
  117. data/spec/knapsack_pro/config/ci/codefresh_spec.rb +21 -6
  118. data/spec/knapsack_pro/config/ci/codeship_spec.rb +20 -6
  119. data/spec/knapsack_pro/config/ci/github_actions_spec.rb +37 -10
  120. data/spec/knapsack_pro/config/ci/gitlab_ci_spec.rb +48 -13
  121. data/spec/knapsack_pro/config/ci/heroku_spec.rb +12 -12
  122. data/spec/knapsack_pro/config/ci/semaphore2_spec.rb +11 -11
  123. data/spec/knapsack_pro/config/ci/semaphore_spec.rb +12 -12
  124. data/spec/knapsack_pro/config/ci/travis_spec.rb +8 -8
  125. data/spec/knapsack_pro/config/env_spec.rb +204 -124
  126. data/spec/knapsack_pro/formatters/time_tracker_specs.rb +424 -0
  127. data/spec/knapsack_pro/hooks/queue_spec.rb +2 -2
  128. data/spec/knapsack_pro/presenter_spec.rb +1 -1
  129. data/spec/knapsack_pro/pure/queue/rspec_pure_spec.rb +224 -0
  130. data/spec/knapsack_pro/repository_adapters/git_adapter_spec.rb +72 -0
  131. data/spec/knapsack_pro/runners/queue/cucumber_runner_spec.rb +18 -16
  132. data/spec/knapsack_pro/runners/queue/minitest_runner_spec.rb +17 -14
  133. data/spec/knapsack_pro/runners/rspec_runner_spec.rb +40 -23
  134. data/spec/knapsack_pro/test_case_detectors/rspec_test_example_detector_spec.rb +1 -0
  135. data/spec/knapsack_pro/tracker_spec.rb +0 -4
  136. data/spec/knapsack_pro_spec.rb +3 -3
  137. data/spec/spec_helper.rb +0 -1
  138. metadata +26 -23
  139. data/lib/knapsack_pro/config/ci/snap_ci.rb +0 -35
  140. data/lib/knapsack_pro/config/ci/solano_ci.rb +0 -32
  141. data/lib/knapsack_pro/extensions/time.rb +0 -7
  142. data/lib/knapsack_pro/formatters/rspec_queue_profile_formatter_extension.rb +0 -56
  143. data/lib/knapsack_pro/formatters/rspec_queue_summary_formatter.rb +0 -112
  144. data/spec/knapsack_pro/config/ci/snap_ci_spec.rb +0 -104
  145. data/spec/knapsack_pro/config/ci/solano_ci_spec.rb +0 -73
  146. data/spec/knapsack_pro/extensions/time_spec.rb +0 -5
  147. data/spec/knapsack_pro/runners/queue/rspec_runner_spec.rb +0 -342
@@ -0,0 +1,92 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KnapsackPro
4
+ module Pure
5
+ module Queue
6
+ class RSpecPure
7
+ FAILURE_EXIT_CODE = 1
8
+ FORMATTERS = [
9
+ 'KnapsackPro::Formatters::TimeTracker',
10
+ ]
11
+
12
+ def add_knapsack_pro_formatters_to(spec_opts)
13
+ return spec_opts unless spec_opts
14
+ return spec_opts if FORMATTERS.all? { |formatter| spec_opts.include?(formatter) }
15
+
16
+ FORMATTERS.each do |formatter|
17
+ next if spec_opts.include?(formatter)
18
+ spec_opts += " --format #{formatter}"
19
+ end
20
+
21
+ spec_opts
22
+ end
23
+
24
+ def error_exit_code(rspec_error_exit_code)
25
+ rspec_error_exit_code || FAILURE_EXIT_CODE
26
+ end
27
+
28
+ def args_with_seed_option_added_when_viable(order_option, seed, args)
29
+ return args if order_option && !order_option.include?('rand')
30
+ return args if order_option && order_option.to_s.split(':')[1]
31
+
32
+ return args unless seed.used?
33
+
34
+ args + ['--seed', seed.value]
35
+ end
36
+
37
+ def prepare_cli_args(args, has_format_option, test_dir)
38
+ (args || '').split
39
+ .yield_self { args_with_at_least_one_formatter(_1, has_format_option) }
40
+ .yield_self { args_with_default_options(_1, test_dir) }
41
+ end
42
+
43
+ def rspec_command(args, test_file_paths, scope)
44
+ messages = []
45
+ return messages if test_file_paths.empty?
46
+
47
+ case scope
48
+ when :batch_finished
49
+ messages << 'To retry the last batch of tests fetched from the Queue API, please run the following command on your machine:'
50
+ when :queue_finished
51
+ messages << 'To retry all the tests assigned to this CI node, please run the following command on your machine:'
52
+ end
53
+
54
+ stringified_cli_args = args.join(' ')
55
+ FORMATTERS.each do |formatter|
56
+ stringified_cli_args.sub!(" --format #{formatter}", '')
57
+ end
58
+
59
+ messages << "bundle exec rspec #{stringified_cli_args} " + KnapsackPro::TestFilePresenter.stringify_paths(test_file_paths)
60
+
61
+ messages
62
+ end
63
+
64
+ def exit_summary(unexecuted_test_files)
65
+ return if unexecuted_test_files.empty?
66
+
67
+ "Unexecuted tests on this CI node (including pending tests): #{unexecuted_test_files.join(' ')}"
68
+ end
69
+
70
+ private
71
+
72
+ def args_with_at_least_one_formatter(cli_args, has_format_option)
73
+ return cli_args if has_format_option
74
+
75
+ cli_args + ['--format', 'progress']
76
+ end
77
+
78
+ def args_with_default_options(cli_args, test_dir)
79
+ new_cli_args = cli_args + [
80
+ '--default-path', test_dir,
81
+ ]
82
+
83
+ FORMATTERS.each do |formatter|
84
+ new_cli_args += ['--format', formatter]
85
+ end
86
+
87
+ new_cli_args
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module KnapsackPro
2
4
  class QueueAllocator
3
5
  def initialize(args)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module KnapsackPro
2
4
  class QueueAllocatorBuilder < BaseAllocatorBuilder
3
5
  def allocator
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rails'
2
4
  require 'knapsack_pro'
3
5
 
@@ -1,14 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module KnapsackPro
2
4
  class Report
3
- def self.save
4
- test_files = KnapsackPro.tracker.to_a
5
+ def self.save(tests = nil)
6
+ if tests.nil?
7
+ tests = KnapsackPro.tracker.to_a
8
+ end
5
9
 
6
- if test_files.empty?
10
+ if tests.empty?
7
11
  KnapsackPro.logger.warn("No test files were executed on this CI node.")
8
12
  KnapsackPro.logger.debug("When you use knapsack_pro Regular Mode, the reason for no tests executing might be a very narrow tests list. Most likely, you run only tests with a specified tag, and there were fewer test files with the tag than parallel CI nodes.")
9
13
  end
10
14
 
11
- create_build_subset(test_files)
15
+ create_build_subset(tests)
12
16
  end
13
17
 
14
18
  def self.save_subset_queue_to_file
@@ -28,11 +32,13 @@ module KnapsackPro
28
32
  end
29
33
  end
30
34
 
31
- def self.save_node_queue_to_api
32
- test_files = []
33
- Dir.glob("#{queue_path}/*.json").each do |file|
34
- report = JSON.parse(File.read(file))
35
- test_files += report
35
+ def self.save_node_queue_to_api(test_files = nil)
36
+ if test_files.nil?
37
+ test_files = []
38
+ Dir.glob("#{queue_path}/*.json").each do |file|
39
+ report = JSON.parse(File.read(file))
40
+ test_files += report
41
+ end
36
42
  end
37
43
 
38
44
  if test_files.empty?
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module KnapsackPro
2
4
  class RepositoryAdapterInitiator
3
5
  def self.call
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module KnapsackPro
2
4
  module RepositoryAdapters
3
5
  class BaseAdapter
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module KnapsackPro
2
4
  module RepositoryAdapters
3
5
  class EnvAdapter < BaseAdapter
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module KnapsackPro
2
4
  module RepositoryAdapters
3
5
  class GitAdapter < BaseAdapter
@@ -14,8 +16,56 @@ module KnapsackPro
14
16
  str_branches.split("\n")
15
17
  end
16
18
 
19
+ def commit_authors
20
+ authors = git_commit_authors
21
+ .split("\n")
22
+ .map { |line| line.strip }
23
+ .map { |line| line.split("\t") }
24
+ .map do |commits, author|
25
+ { commits: commits.to_i, author: KnapsackPro::MaskString.call(author) }
26
+ end
27
+
28
+ raise if authors.empty?
29
+
30
+ authors
31
+ rescue Exception
32
+ []
33
+ end
34
+
35
+ def build_author
36
+ author = KnapsackPro::MaskString.call(git_build_author.strip)
37
+ raise if author.empty?
38
+ author
39
+ rescue Exception
40
+ "no git <no.git@example.com>"
41
+ end
42
+
17
43
  private
18
44
 
45
+ def git_commit_authors
46
+ if KnapsackPro::Config::Env.ci? && shallow_repository?
47
+ command = 'git fetch --shallow-since "one month ago" --quiet 2>/dev/null'
48
+ begin
49
+ Timeout.timeout(5) do
50
+ `#{command}`
51
+ end
52
+ rescue Timeout::Error
53
+ KnapsackPro.logger.debug("Skip the `#{command}` command because it took too long.")
54
+ end
55
+ end
56
+
57
+ `git log --since "one month ago" 2>/dev/null | git shortlog --summary --email 2>/dev/null`
58
+ end
59
+
60
+ def git_build_author
61
+ `git log --format="%aN <%aE>" -1 2>/dev/null`
62
+ end
63
+
64
+ def shallow_repository?
65
+ result = `git rev-parse --is-shallow-repository 2>/dev/null`
66
+ result.strip == 'true'
67
+ end
68
+
19
69
  def working_dir
20
70
  dir = KnapsackPro::Config::Env.project_dir
21
71
  File.expand_path(dir)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module KnapsackPro
2
4
  module Runners
3
5
  class BaseRunner
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module KnapsackPro
2
4
  module Runners
3
5
  class CucumberRunner < BaseRunner
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module KnapsackPro
2
4
  module Runners
3
5
  class MinitestRunner < BaseRunner
@@ -1,7 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module KnapsackPro
2
4
  module Runners
3
5
  module Queue
4
6
  class BaseRunner
7
+ TerminationError = Class.new(StandardError)
8
+ TERMINATION_SIGNALS = %w(HUP INT TERM ABRT QUIT USR1 USR2)
9
+
10
+ @@terminate_process = false
11
+
5
12
  def self.run(args)
6
13
  raise NotImplementedError
7
14
  end
@@ -13,6 +20,7 @@ module KnapsackPro
13
20
  def initialize(adapter_class)
14
21
  @allocator_builder = KnapsackPro::QueueAllocatorBuilder.new(adapter_class)
15
22
  @allocator = allocator_builder.allocator
23
+ trap_signals
16
24
  end
17
25
 
18
26
  def test_file_paths(args)
@@ -33,6 +41,27 @@ module KnapsackPro
33
41
  def self.child_status
34
42
  $?
35
43
  end
44
+
45
+ def self.handle_signal!
46
+ raise TerminationError.new('Knapsack Pro process was terminated!') if @@terminate_process
47
+ end
48
+
49
+ def self.set_terminate_process
50
+ @@terminate_process = true
51
+ end
52
+
53
+ def set_terminate_process
54
+ self.class.set_terminate_process
55
+ end
56
+
57
+ def trap_signals
58
+ TERMINATION_SIGNALS.each do |signal|
59
+ Signal.trap(signal) {
60
+ puts "#{signal} signal has been received. Terminating Knapsack Pro..."
61
+ @@terminate_process = true
62
+ }
63
+ end
64
+ end
36
65
  end
37
66
  end
38
67
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module KnapsackPro
2
4
  module Runners
3
5
  module Queue
@@ -19,9 +21,10 @@ module KnapsackPro
19
21
  can_initialize_queue: true,
20
22
  args: args,
21
23
  exitstatus: 0,
22
- all_test_file_paths: [],
24
+ node_test_file_paths: [],
23
25
  }
24
26
  while accumulator[:status] == :next
27
+ handle_signal!
25
28
  accumulator = run_tests(accumulator)
26
29
  end
27
30
 
@@ -33,15 +36,15 @@ module KnapsackPro
33
36
  can_initialize_queue = accumulator.fetch(:can_initialize_queue)
34
37
  args = accumulator.fetch(:args)
35
38
  exitstatus = accumulator.fetch(:exitstatus)
36
- all_test_file_paths = accumulator.fetch(:all_test_file_paths)
39
+ node_test_file_paths = accumulator.fetch(:node_test_file_paths)
37
40
 
38
41
  test_file_paths = runner.test_file_paths(
39
42
  can_initialize_queue: can_initialize_queue,
40
- executed_test_files: all_test_file_paths
43
+ executed_test_files: node_test_file_paths
41
44
  )
42
45
 
43
46
  if test_file_paths.empty?
44
- unless all_test_file_paths.empty?
47
+ unless node_test_file_paths.empty?
45
48
  KnapsackPro::Adapters::CucumberAdapter.verify_bind_method_called
46
49
  end
47
50
 
@@ -62,7 +65,7 @@ module KnapsackPro
62
65
 
63
66
  KnapsackPro::Hooks::Queue.call_before_subset_queue
64
67
 
65
- all_test_file_paths += test_file_paths
68
+ node_test_file_paths += test_file_paths
66
69
 
67
70
  result_exitstatus = cucumber_run(runner, test_file_paths, args)
68
71
  exitstatus = result_exitstatus if result_exitstatus != 0
@@ -77,7 +80,7 @@ module KnapsackPro
77
80
  can_initialize_queue: false,
78
81
  args: args,
79
82
  exitstatus: exitstatus,
80
- all_test_file_paths: all_test_file_paths,
83
+ node_test_file_paths: node_test_file_paths,
81
84
  }
82
85
  end
83
86
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module KnapsackPro
2
4
  module Runners
3
5
  module Queue
@@ -5,6 +7,10 @@ module KnapsackPro
5
7
  def self.run(args)
6
8
  require 'minitest'
7
9
 
10
+ # Avoid installing `at_exit` since we are calling `Minitest.run` ourselves.
11
+ # Without this, Minitest would run again (autorun) after `Minitest.run`.
12
+ ::Minitest.class_variable_set('@@installed_at_exit', true)
13
+
8
14
  ENV['KNAPSACK_PRO_TEST_SUITE_TOKEN'] = KnapsackPro::Config::Env.test_suite_token_minitest
9
15
  ENV['KNAPSACK_PRO_QUEUE_RECORDING_ENABLED'] = 'true'
10
16
  ENV['KNAPSACK_PRO_QUEUE_ID'] = KnapsackPro::Config::EnvGenerator.set_queue_id
@@ -26,9 +32,10 @@ module KnapsackPro
26
32
  can_initialize_queue: true,
27
33
  args: cli_args,
28
34
  exitstatus: 0,
29
- all_test_file_paths: [],
35
+ node_test_file_paths: [],
30
36
  }
31
37
  while accumulator[:status] == :next
38
+ handle_signal!
32
39
  accumulator = run_tests(accumulator)
33
40
  end
34
41
 
@@ -40,15 +47,15 @@ module KnapsackPro
40
47
  can_initialize_queue = accumulator.fetch(:can_initialize_queue)
41
48
  args = accumulator.fetch(:args)
42
49
  exitstatus = accumulator.fetch(:exitstatus)
43
- all_test_file_paths = accumulator.fetch(:all_test_file_paths)
50
+ node_test_file_paths = accumulator.fetch(:node_test_file_paths)
44
51
 
45
52
  test_file_paths = runner.test_file_paths(
46
53
  can_initialize_queue: can_initialize_queue,
47
- executed_test_files: all_test_file_paths
54
+ executed_test_files: node_test_file_paths
48
55
  )
49
56
 
50
57
  if test_file_paths.empty?
51
- unless all_test_file_paths.empty?
58
+ unless node_test_file_paths.empty?
52
59
  KnapsackPro::Adapters::MinitestAdapter.verify_bind_method_called
53
60
  end
54
61
 
@@ -69,7 +76,7 @@ module KnapsackPro
69
76
 
70
77
  KnapsackPro::Hooks::Queue.call_before_subset_queue
71
78
 
72
- all_test_file_paths += test_file_paths
79
+ node_test_file_paths += test_file_paths
73
80
 
74
81
  result = minitest_run(runner, test_file_paths, args)
75
82
  exitstatus = 1 unless result
@@ -84,7 +91,7 @@ module KnapsackPro
84
91
  can_initialize_queue: false,
85
92
  args: args,
86
93
  exitstatus: exitstatus,
87
- all_test_file_paths: all_test_file_paths,
94
+ node_test_file_paths: node_test_file_paths,
88
95
  }
89
96
  end
90
97
  end