knapsack_pro 3.8.0 → 7.0.0
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/.circleci/config.yml +377 -23
- data/.github/dependabot.yml +11 -0
- data/.github/pull_request_template.md +22 -0
- data/.gitignore +4 -0
- data/CHANGELOG.md +325 -1
- data/Gemfile +9 -0
- data/README.md +3 -10
- data/bin/test +15 -0
- data/knapsack_pro.gemspec +7 -6
- data/lib/knapsack_pro/adapters/base_adapter.rb +17 -2
- data/lib/knapsack_pro/adapters/cucumber_adapter.rb +3 -3
- data/lib/knapsack_pro/adapters/minitest_adapter.rb +2 -0
- data/lib/knapsack_pro/adapters/rspec_adapter.rb +88 -49
- data/lib/knapsack_pro/adapters/spinach_adapter.rb +2 -0
- data/lib/knapsack_pro/adapters/test_unit_adapter.rb +2 -0
- data/lib/knapsack_pro/allocator.rb +2 -0
- data/lib/knapsack_pro/allocator_builder.rb +2 -0
- data/lib/knapsack_pro/base_allocator_builder.rb +8 -25
- data/lib/knapsack_pro/build_distribution_fetcher.rb +2 -0
- data/lib/knapsack_pro/client/api/action.rb +2 -0
- data/lib/knapsack_pro/client/api/v1/base.rb +2 -0
- data/lib/knapsack_pro/client/api/v1/build_distributions.rb +5 -0
- data/lib/knapsack_pro/client/api/v1/build_subsets.rb +2 -0
- data/lib/knapsack_pro/client/api/v1/queues.rb +6 -1
- data/lib/knapsack_pro/client/connection.rb +5 -6
- data/lib/knapsack_pro/config/ci/app_veyor.rb +18 -0
- data/lib/knapsack_pro/config/ci/base.rb +27 -0
- data/lib/knapsack_pro/config/ci/buildkite.rb +18 -0
- data/lib/knapsack_pro/config/ci/circle.rb +18 -0
- data/lib/knapsack_pro/config/ci/cirrus_ci.rb +18 -0
- data/lib/knapsack_pro/config/ci/codefresh.rb +18 -0
- data/lib/knapsack_pro/config/ci/codeship.rb +18 -0
- data/lib/knapsack_pro/config/ci/github_actions.rb +26 -0
- data/lib/knapsack_pro/config/ci/gitlab_ci.rb +20 -1
- data/lib/knapsack_pro/config/ci/heroku.rb +18 -0
- data/lib/knapsack_pro/config/ci/semaphore.rb +16 -0
- data/lib/knapsack_pro/config/ci/semaphore2.rb +19 -0
- data/lib/knapsack_pro/config/ci/travis.rb +18 -0
- data/lib/knapsack_pro/config/env.rb +46 -22
- data/lib/knapsack_pro/config/env_generator.rb +2 -0
- data/lib/knapsack_pro/config/temp_files.rb +8 -4
- data/lib/knapsack_pro/crypto/branch_encryptor.rb +2 -0
- data/lib/knapsack_pro/crypto/decryptor.rb +2 -0
- data/lib/knapsack_pro/crypto/digestor.rb +2 -0
- data/lib/knapsack_pro/crypto/encryptor.rb +2 -0
- data/lib/knapsack_pro/extensions/rspec_extension.rb +137 -0
- data/lib/knapsack_pro/formatters/rspec_json_formatter.rb +2 -0
- data/lib/knapsack_pro/formatters/time_tracker.rb +152 -0
- data/lib/knapsack_pro/formatters/time_tracker_fetcher.rb +20 -0
- data/lib/knapsack_pro/hooks/queue.rb +2 -0
- data/lib/knapsack_pro/logger_wrapper.rb +2 -0
- data/lib/knapsack_pro/mask_string.rb +9 -0
- data/lib/knapsack_pro/presenter.rb +6 -3
- data/lib/knapsack_pro/pure/queue/rspec_pure.rb +92 -0
- data/lib/knapsack_pro/queue_allocator.rb +2 -0
- data/lib/knapsack_pro/queue_allocator_builder.rb +2 -0
- data/lib/knapsack_pro/railtie.rb +2 -0
- data/lib/knapsack_pro/report.rb +15 -9
- data/lib/knapsack_pro/repository_adapter_initiator.rb +2 -0
- data/lib/knapsack_pro/repository_adapters/base_adapter.rb +2 -0
- data/lib/knapsack_pro/repository_adapters/env_adapter.rb +2 -0
- data/lib/knapsack_pro/repository_adapters/git_adapter.rb +50 -0
- data/lib/knapsack_pro/runners/base_runner.rb +2 -0
- data/lib/knapsack_pro/runners/cucumber_runner.rb +2 -0
- data/lib/knapsack_pro/runners/minitest_runner.rb +2 -0
- data/lib/knapsack_pro/runners/queue/base_runner.rb +29 -0
- data/lib/knapsack_pro/runners/queue/cucumber_runner.rb +9 -6
- data/lib/knapsack_pro/runners/queue/minitest_runner.rb +13 -6
- data/lib/knapsack_pro/runners/queue/rspec_runner.rb +128 -135
- data/lib/knapsack_pro/runners/rspec_runner.rb +22 -3
- data/lib/knapsack_pro/runners/spinach_runner.rb +2 -0
- data/lib/knapsack_pro/runners/test_unit_runner.rb +2 -0
- data/lib/knapsack_pro/slow_test_file_determiner.rb +2 -0
- data/lib/knapsack_pro/slow_test_file_finder.rb +2 -0
- data/lib/knapsack_pro/task_loader.rb +2 -0
- data/lib/knapsack_pro/test_case_detectors/rspec_test_example_detector.rb +2 -0
- data/lib/knapsack_pro/test_case_mergers/base_merger.rb +2 -0
- data/lib/knapsack_pro/test_case_mergers/rspec_merger.rb +2 -0
- data/lib/knapsack_pro/test_file_cleaner.rb +2 -0
- data/lib/knapsack_pro/test_file_finder.rb +2 -0
- data/lib/knapsack_pro/test_file_pattern.rb +2 -0
- data/lib/knapsack_pro/test_file_presenter.rb +2 -0
- data/lib/knapsack_pro/test_files_with_test_cases_composer.rb +2 -0
- data/lib/knapsack_pro/test_flat_distributor.rb +2 -0
- data/lib/knapsack_pro/tracker.rb +3 -3
- data/lib/knapsack_pro/urls.rb +4 -0
- data/lib/knapsack_pro/utils.rb +2 -0
- data/lib/knapsack_pro/version.rb +3 -1
- data/lib/knapsack_pro.rb +5 -3
- data/lib/tasks/cucumber.rake +2 -0
- data/lib/tasks/encrypted_branch_names.rake +2 -0
- data/lib/tasks/encrypted_test_file_names.rake +2 -0
- data/lib/tasks/minitest.rake +2 -0
- data/lib/tasks/queue/cucumber.rake +13 -0
- data/lib/tasks/queue/minitest.rake +13 -0
- data/lib/tasks/queue/rspec.rake +13 -0
- data/lib/tasks/rspec.rake +5 -0
- data/lib/tasks/salt.rake +2 -0
- data/lib/tasks/spinach.rake +2 -0
- data/lib/tasks/test_unit.rake +2 -0
- data/spec/integration/api/build_distributions_subset_spec.rb +1 -0
- data/spec/integration/runners/queue/rspec_runner.rb +80 -0
- data/spec/integration/runners/queue/rspec_runner_spec.rb +2232 -0
- data/spec/knapsack_pro/adapters/base_adapter_spec.rb +30 -11
- data/spec/knapsack_pro/adapters/cucumber_adapter_spec.rb +2 -5
- data/spec/knapsack_pro/adapters/rspec_adapter_spec.rb +146 -174
- data/spec/knapsack_pro/base_allocator_builder_spec.rb +22 -48
- data/spec/knapsack_pro/client/api/v1/build_distributions_spec.rb +19 -27
- data/spec/knapsack_pro/client/api/v1/queues_spec.rb +23 -43
- data/spec/knapsack_pro/client/connection_spec.rb +59 -7
- data/spec/knapsack_pro/config/ci/app_veyor_spec.rb +22 -8
- data/spec/knapsack_pro/config/ci/base_spec.rb +1 -0
- data/spec/knapsack_pro/config/ci/buildkite_spec.rb +51 -16
- data/spec/knapsack_pro/config/ci/circle_spec.rb +48 -13
- data/spec/knapsack_pro/config/ci/cirrus_ci_spec.rb +12 -12
- data/spec/knapsack_pro/config/ci/codefresh_spec.rb +21 -6
- data/spec/knapsack_pro/config/ci/codeship_spec.rb +20 -6
- data/spec/knapsack_pro/config/ci/github_actions_spec.rb +37 -10
- data/spec/knapsack_pro/config/ci/gitlab_ci_spec.rb +48 -13
- data/spec/knapsack_pro/config/ci/heroku_spec.rb +12 -12
- data/spec/knapsack_pro/config/ci/semaphore2_spec.rb +11 -11
- data/spec/knapsack_pro/config/ci/semaphore_spec.rb +12 -12
- data/spec/knapsack_pro/config/ci/travis_spec.rb +8 -8
- data/spec/knapsack_pro/config/env_spec.rb +204 -124
- data/spec/knapsack_pro/formatters/time_tracker_specs.rb +424 -0
- data/spec/knapsack_pro/hooks/queue_spec.rb +2 -2
- data/spec/knapsack_pro/presenter_spec.rb +1 -1
- data/spec/knapsack_pro/pure/queue/rspec_pure_spec.rb +224 -0
- data/spec/knapsack_pro/repository_adapters/git_adapter_spec.rb +72 -0
- data/spec/knapsack_pro/runners/queue/cucumber_runner_spec.rb +18 -16
- data/spec/knapsack_pro/runners/queue/minitest_runner_spec.rb +17 -14
- data/spec/knapsack_pro/runners/rspec_runner_spec.rb +40 -23
- data/spec/knapsack_pro/test_case_detectors/rspec_test_example_detector_spec.rb +1 -0
- data/spec/knapsack_pro/tracker_spec.rb +0 -4
- data/spec/knapsack_pro_spec.rb +3 -3
- data/spec/spec_helper.rb +0 -1
- metadata +26 -23
- data/lib/knapsack_pro/config/ci/snap_ci.rb +0 -35
- data/lib/knapsack_pro/config/ci/solano_ci.rb +0 -32
- data/lib/knapsack_pro/extensions/time.rb +0 -7
- data/lib/knapsack_pro/formatters/rspec_queue_profile_formatter_extension.rb +0 -56
- data/lib/knapsack_pro/formatters/rspec_queue_summary_formatter.rb +0 -112
- data/spec/knapsack_pro/config/ci/snap_ci_spec.rb +0 -104
- data/spec/knapsack_pro/config/ci/solano_ci_spec.rb +0 -73
- data/spec/knapsack_pro/extensions/time_spec.rb +0 -5
- 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
|
data/lib/knapsack_pro/railtie.rb
CHANGED
data/lib/knapsack_pro/report.rb
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module KnapsackPro
|
|
2
4
|
class Report
|
|
3
|
-
def self.save
|
|
4
|
-
|
|
5
|
+
def self.save(tests = nil)
|
|
6
|
+
if tests.nil?
|
|
7
|
+
tests = KnapsackPro.tracker.to_a
|
|
8
|
+
end
|
|
5
9
|
|
|
6
|
-
if
|
|
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(
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
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,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
|
-
|
|
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
|
-
|
|
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:
|
|
43
|
+
executed_test_files: node_test_file_paths
|
|
41
44
|
)
|
|
42
45
|
|
|
43
46
|
if test_file_paths.empty?
|
|
44
|
-
unless
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
54
|
+
executed_test_files: node_test_file_paths
|
|
48
55
|
)
|
|
49
56
|
|
|
50
57
|
if test_file_paths.empty?
|
|
51
|
-
unless
|
|
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
|
-
|
|
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
|
-
|
|
94
|
+
node_test_file_paths: node_test_file_paths,
|
|
88
95
|
}
|
|
89
96
|
end
|
|
90
97
|
end
|