knapsack_pro 9.0.0 → 9.1.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.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/lib/knapsack_pro/adapters/minitest_adapter.rb +8 -13
  3. data/lib/knapsack_pro/client/connection.rb +1 -1
  4. data/lib/knapsack_pro/config/env.rb +1 -24
  5. data/lib/knapsack_pro/version.rb +1 -1
  6. metadata +2 -196
  7. data/.circleci/config.yml +0 -468
  8. data/.github/assets/install-button.png +0 -0
  9. data/.github/assets/knapsack-diamonds.png +0 -0
  10. data/.github/dependabot.yml +0 -11
  11. data/.github/pull_request_template.md +0 -11
  12. data/.gitignore +0 -39
  13. data/.rspec +0 -5
  14. data/CHANGELOG.md +0 -1995
  15. data/Gemfile +0 -13
  16. data/LICENSE +0 -22
  17. data/README.md +0 -90
  18. data/Rakefile +0 -2
  19. data/knapsack_pro.gemspec +0 -43
  20. data/spec/fixtures/test_file_list_source_file.txt +0 -6
  21. data/spec/fixtures/vcr_cassettes/api/v1/build_distributions/subset/invalid_test_suite_token.yml +0 -59
  22. data/spec/fixtures/vcr_cassettes/api/v1/build_distributions/subset/success.yml +0 -61
  23. data/spec/fixtures/vcr_cassettes/api/v1/build_subsets/create/invalid_test_suite_token.yml +0 -50
  24. data/spec/fixtures/vcr_cassettes/api/v1/build_subsets/create/success.yml +0 -50
  25. data/spec/integration/api/build_distributions_subset_spec.rb +0 -77
  26. data/spec/integration/api/build_subsets_create_spec.rb +0 -77
  27. data/spec/integration/runners/fallback_spec.rb +0 -131
  28. data/spec/integration/runners/queue/cucumber_runner_fallback_spec.rb +0 -129
  29. data/spec/integration/runners/queue/minitest_runner_fallback_spec.rb +0 -129
  30. data/spec/integration/runners/queue/rspec_runner.rb +0 -80
  31. data/spec/integration/runners/queue/rspec_runner_fallback_spec.rb +0 -137
  32. data/spec/integration/runners/queue/rspec_runner_spec.rb +0 -2672
  33. data/spec/knapsack_pro/adapters/base_adapter_spec.rb +0 -221
  34. data/spec/knapsack_pro/adapters/cucumber_adapter_spec.rb +0 -216
  35. data/spec/knapsack_pro/adapters/minitest_adapter_spec.rb +0 -189
  36. data/spec/knapsack_pro/adapters/rspec_adapter_spec.rb +0 -427
  37. data/spec/knapsack_pro/adapters/spinach_adapter_spec.rb +0 -61
  38. data/spec/knapsack_pro/adapters/test_unit_adapter_spec.rb +0 -86
  39. data/spec/knapsack_pro/base_allocator_builder_spec.rb +0 -102
  40. data/spec/knapsack_pro/build_distribution_fetcher_spec.rb +0 -89
  41. data/spec/knapsack_pro/client/api/action_spec.rb +0 -17
  42. data/spec/knapsack_pro/client/api/v1/base_spec.rb +0 -2
  43. data/spec/knapsack_pro/client/api/v1/build_distributions_spec.rb +0 -95
  44. data/spec/knapsack_pro/client/api/v1/build_subsets_spec.rb +0 -35
  45. data/spec/knapsack_pro/client/api/v1/queues_spec.rb +0 -83
  46. data/spec/knapsack_pro/client/connection_spec.rb +0 -581
  47. data/spec/knapsack_pro/config/ci/app_veyor_spec.rb +0 -87
  48. data/spec/knapsack_pro/config/ci/base_spec.rb +0 -10
  49. data/spec/knapsack_pro/config/ci/buildkite_spec.rb +0 -135
  50. data/spec/knapsack_pro/config/ci/circle_spec.rb +0 -122
  51. data/spec/knapsack_pro/config/ci/cirrus_ci_spec.rb +0 -87
  52. data/spec/knapsack_pro/config/ci/codefresh_spec.rb +0 -81
  53. data/spec/knapsack_pro/config/ci/codeship_spec.rb +0 -80
  54. data/spec/knapsack_pro/config/ci/github_actions_spec.rb +0 -140
  55. data/spec/knapsack_pro/config/ci/gitlab_ci_spec.rb +0 -137
  56. data/spec/knapsack_pro/config/ci/heroku_spec.rb +0 -87
  57. data/spec/knapsack_pro/config/ci/semaphore2_spec.rb +0 -133
  58. data/spec/knapsack_pro/config/ci/semaphore_spec.rb +0 -87
  59. data/spec/knapsack_pro/config/ci/travis_spec.rb +0 -73
  60. data/spec/knapsack_pro/config/env_generator_spec.rb +0 -52
  61. data/spec/knapsack_pro/config/env_spec.rb +0 -1291
  62. data/spec/knapsack_pro/config/temp_files_spec.rb +0 -25
  63. data/spec/knapsack_pro/crypto/branch_encryptor_spec.rb +0 -53
  64. data/spec/knapsack_pro/crypto/decryptor_spec.rb +0 -83
  65. data/spec/knapsack_pro/crypto/digestor_spec.rb +0 -13
  66. data/spec/knapsack_pro/crypto/encryptor_spec.rb +0 -58
  67. data/spec/knapsack_pro/formatters/time_tracker_fetcher_spec.rb +0 -27
  68. data/spec/knapsack_pro/formatters/time_tracker_spec.rb +0 -448
  69. data/spec/knapsack_pro/hooks/queue_spec.rb +0 -199
  70. data/spec/knapsack_pro/presenter_spec.rb +0 -57
  71. data/spec/knapsack_pro/pure/queue/rspec_pure_spec.rb +0 -248
  72. data/spec/knapsack_pro/queue_spec.rb +0 -35
  73. data/spec/knapsack_pro/report_spec.rb +0 -232
  74. data/spec/knapsack_pro/repository_adapter_initiator_spec.rb +0 -21
  75. data/spec/knapsack_pro/repository_adapters/base_adapter_spec.rb +0 -13
  76. data/spec/knapsack_pro/repository_adapters/env_adapter_spec.rb +0 -27
  77. data/spec/knapsack_pro/repository_adapters/git_adapter_spec.rb +0 -106
  78. data/spec/knapsack_pro/runners/base_runner_spec.rb +0 -87
  79. data/spec/knapsack_pro/runners/cucumber_runner_spec.rb +0 -92
  80. data/spec/knapsack_pro/runners/minitest_runner_spec.rb +0 -57
  81. data/spec/knapsack_pro/runners/queue/base_runner_spec.rb +0 -73
  82. data/spec/knapsack_pro/runners/queue/cucumber_runner_spec.rb +0 -209
  83. data/spec/knapsack_pro/runners/queue/minitest_runner_spec.rb +0 -203
  84. data/spec/knapsack_pro/runners/rspec_runner_spec.rb +0 -111
  85. data/spec/knapsack_pro/runners/spinach_runner_spec.rb +0 -56
  86. data/spec/knapsack_pro/runners/test_unit_runner_spec.rb +0 -62
  87. data/spec/knapsack_pro/slow_test_file_determiner_spec.rb +0 -119
  88. data/spec/knapsack_pro/slow_test_file_finder_spec.rb +0 -42
  89. data/spec/knapsack_pro/task_loader_spec.rb +0 -14
  90. data/spec/knapsack_pro/test_case_detectors/rspec_test_example_detector_spec.rb +0 -217
  91. data/spec/knapsack_pro/test_case_mergers/base_merger_spec.rb +0 -27
  92. data/spec/knapsack_pro/test_case_mergers/rspec_merger_spec.rb +0 -81
  93. data/spec/knapsack_pro/test_file_cleaner_spec.rb +0 -11
  94. data/spec/knapsack_pro/test_file_finder_spec.rb +0 -176
  95. data/spec/knapsack_pro/test_file_pattern_spec.rb +0 -49
  96. data/spec/knapsack_pro/test_file_presenter_spec.rb +0 -22
  97. data/spec/knapsack_pro/test_files_with_test_cases_composer_spec.rb +0 -41
  98. data/spec/knapsack_pro/test_flat_distributor_spec.rb +0 -60
  99. data/spec/knapsack_pro/tracker_spec.rb +0 -184
  100. data/spec/knapsack_pro/utils_spec.rb +0 -55
  101. data/spec/knapsack_pro_spec.rb +0 -116
  102. data/spec/spec_helper.rb +0 -47
  103. data/spec/support/.gitkeep +0 -0
  104. data/spec/support/fakes/cucumber.rb +0 -25
  105. data/spec/support/fakes/minitest.rb +0 -18
  106. data/spec/support/shared_examples/adapter.rb +0 -17
  107. data/spec_fake/controllers/users_controller_spec.rb +0 -0
  108. data/spec_fake/models/admin_spec.rb +0 -0
  109. data/spec_fake/models/user_spec.rb +0 -0
  110. data/spec_fake/spec_helper.rb +0 -0
  111. data/spec_time_tracker/spec_helper.rb +0 -29
  112. data/test_fake/a_test.rb +0 -0
  113. data/test_fake/b_test.rb +0 -0
@@ -1,89 +0,0 @@
1
- describe KnapsackPro::BuildDistributionFetcher do
2
- describe '.call' do
3
- subject { described_class.call }
4
-
5
- it do
6
- build_distribution_fetcher = instance_double(described_class)
7
- expect(described_class).to receive(:new).and_return(build_distribution_fetcher)
8
- result = double
9
- expect(build_distribution_fetcher).to receive(:call).and_return(result)
10
-
11
- expect(subject).to eq result
12
- end
13
- end
14
-
15
- describe '#call' do
16
- let(:ci_node_total) { double }
17
- let(:ci_node_index) { double }
18
- let(:repository_adapter) { instance_double(KnapsackPro::RepositoryAdapters::EnvAdapter, commit_hash: double, branch: double) }
19
-
20
- subject { described_class.new.call }
21
-
22
- before do
23
- expect(KnapsackPro::RepositoryAdapterInitiator).to receive(:call).and_return(repository_adapter)
24
-
25
- expect(KnapsackPro::Config::Env).to receive(:ci_node_total).and_return(ci_node_total)
26
- expect(KnapsackPro::Config::Env).to receive(:ci_node_index).and_return(ci_node_index)
27
-
28
- action = double
29
- expect(KnapsackPro::Client::API::V1::BuildDistributions).to receive(:last).with({
30
- commit_hash: repository_adapter.commit_hash,
31
- branch: repository_adapter.branch,
32
- node_total: ci_node_total,
33
- node_index: ci_node_index,
34
- }).and_return(action)
35
-
36
- connection = instance_double(KnapsackPro::Client::Connection,
37
- call: response,
38
- success?: success?,
39
- errors?: errors?)
40
- expect(KnapsackPro::Client::Connection).to receive(:new).with(action).and_return(connection)
41
- end
42
-
43
- context 'when successful request to API' do
44
- let(:success?) { true }
45
-
46
- context 'when response has errors' do
47
- let(:errors?) { true }
48
- let(:response) { 'fake error response' }
49
-
50
- it do
51
- expect { subject }.to raise_error(ArgumentError, response)
52
- end
53
- end
54
-
55
- context 'when response has no errors' do
56
- let(:errors?) { false }
57
- let(:response) do
58
- {
59
- 'build_distribution_id' => 'be2b95b1-1b8b-43a3-9d66-cabebbf135b8',
60
- 'time_execution' => 2.5,
61
- 'test_files' => [
62
- { 'path' => 'a_spec.rb', 'time_execution' => 1.5 },
63
- { 'path' => 'b_spec.rb', 'time_execution' => 1.0 },
64
- ]
65
- }
66
- end
67
-
68
- it { expect(subject).to be_a described_class::BuildDistributionEntity }
69
- it { expect(subject.time_execution).to eq 2.5 }
70
- it do
71
- expect(subject.test_files).to eq([
72
- { 'path' => 'a_spec.rb', 'time_execution' => 1.5 },
73
- { 'path' => 'b_spec.rb', 'time_execution' => 1.0 },
74
- ])
75
- end
76
- end
77
- end
78
-
79
- context 'when not successful request to API' do
80
- let(:success?) { false }
81
- let(:errors?) { false }
82
- let(:response) { double }
83
-
84
- it { expect(subject).to be_a described_class::BuildDistributionEntity }
85
- it { expect(subject.time_execution).to eq 0.0 }
86
- it { expect(subject.test_files).to eq([]) }
87
- end
88
- end
89
- end
@@ -1,17 +0,0 @@
1
- describe KnapsackPro::Client::API::Action do
2
- let(:endpoint_path) { double }
3
- let(:http_method) { double }
4
- let(:request_hash) { double }
5
-
6
- subject do
7
- described_class.new(
8
- endpoint_path: endpoint_path,
9
- http_method: http_method,
10
- request_hash: request_hash
11
- )
12
- end
13
-
14
- its(:endpoint_path) { should eq endpoint_path }
15
- its(:http_method) { should eq http_method }
16
- its(:request_hash) { should eq request_hash }
17
- end
@@ -1,2 +0,0 @@
1
- describe KnapsackPro::Client::API::V1::Base do
2
- end
@@ -1,95 +0,0 @@
1
- describe KnapsackPro::Client::API::V1::BuildDistributions do
2
- describe '.subset' do
3
- let(:fixed_test_suite_split) { double }
4
- let(:commit_hash) { double }
5
- let(:branch) { double }
6
- let(:node_total) { double }
7
- let(:node_index) { double }
8
- let(:ci_build_id) { double }
9
- let(:masked_user_seat) { double }
10
- let(:test_files) { double }
11
- let(:cache_read_attempt) { [false, true].sample }
12
-
13
- subject do
14
- described_class.subset(
15
- cache_read_attempt: cache_read_attempt,
16
- commit_hash: commit_hash,
17
- branch: branch,
18
- node_total: node_total,
19
- node_index: node_index,
20
- test_files: test_files
21
- )
22
- end
23
-
24
- before do
25
- expect(KnapsackPro::Config::Env).to receive(:fixed_test_suite_split).and_return(fixed_test_suite_split)
26
- expect(KnapsackPro::Config::Env).to receive(:ci_node_build_id).and_return(ci_build_id)
27
- expect(KnapsackPro::Config::Env).to receive(:masked_user_seat).and_return(masked_user_seat)
28
- end
29
-
30
- context 'when cache_read_attempt=true' do
31
- let(:cache_read_attempt) { true }
32
-
33
- it 'does not send test_files among other params' do
34
- action = double
35
- expect(KnapsackPro::Client::API::Action).to receive(:new).with(
36
- hash_including(request_hash: hash_excluding(:test_files))
37
- ).and_return(action)
38
- expect(subject).to eq action
39
- end
40
- end
41
-
42
- context 'when cache_read_attempt=false' do
43
- let(:cache_read_attempt) { false }
44
-
45
- it 'sends test_files among other params' do
46
- action = double
47
- expect(KnapsackPro::Client::API::Action).to receive(:new).with(
48
- hash_including(request_hash: hash_including(test_files: test_files))
49
- ).and_return(action)
50
- expect(subject).to eq action
51
- end
52
- end
53
-
54
- it "sends authors" do
55
- action = double
56
-
57
- expect(KnapsackPro::Client::API::Action).to receive(:new).with(
58
- hash_including(request_hash: hash_including(:build_author, :commit_authors))
59
- ).and_return(action)
60
-
61
- expect(subject).to eq action
62
- end
63
- end
64
-
65
- describe '.last' do
66
- let(:commit_hash) { double }
67
- let(:branch) { double }
68
- let(:node_total) { double }
69
- let(:node_index) { double }
70
-
71
- subject do
72
- described_class.last(
73
- commit_hash: commit_hash,
74
- branch: branch,
75
- node_total: node_total,
76
- node_index: node_index,
77
- )
78
- end
79
-
80
- it do
81
- action = double
82
- expect(KnapsackPro::Client::API::Action).to receive(:new).with({
83
- endpoint_path: '/v1/build_distributions/last',
84
- http_method: :get,
85
- request_hash: {
86
- commit_hash: commit_hash,
87
- branch: branch,
88
- node_total: node_total,
89
- node_index: node_index,
90
- }
91
- }).and_return(action)
92
- expect(subject).to eq action
93
- end
94
- end
95
- end
@@ -1,35 +0,0 @@
1
- describe KnapsackPro::Client::API::V1::BuildSubsets do
2
- describe '.create' do
3
- let(:commit_hash) { double }
4
- let(:branch) { double }
5
- let(:node_total) { double }
6
- let(:node_index) { double }
7
- let(:test_files) { double }
8
-
9
- subject do
10
- described_class.create(
11
- commit_hash: commit_hash,
12
- branch: branch,
13
- node_total: node_total,
14
- node_index: node_index,
15
- test_files: test_files
16
- )
17
- end
18
-
19
- it do
20
- action = double
21
- expect(KnapsackPro::Client::API::Action).to receive(:new).with({
22
- endpoint_path: '/v1/build_subsets',
23
- http_method: :post,
24
- request_hash: {
25
- commit_hash: commit_hash,
26
- branch: branch,
27
- node_total: node_total,
28
- node_index: node_index,
29
- test_files: test_files
30
- }
31
- }).and_return(action)
32
- expect(subject).to eq action
33
- end
34
- end
35
- end
@@ -1,83 +0,0 @@
1
- describe KnapsackPro::Client::API::V1::Queues do
2
- describe '.queue' do
3
- let(:fixed_queue_split) { double }
4
- let(:commit_hash) { double }
5
- let(:branch) { double }
6
- let(:node_total) { double }
7
- let(:node_index) { double }
8
- let(:test_files) { double }
9
- let(:node_build_id) { double }
10
- let(:masked_user_seat) { double }
11
- let(:can_initialize_queue) { [false, true].sample }
12
- let(:attempt_connect_to_queue) { [false, true].sample }
13
- let(:batch_uuid) { SecureRandom.uuid }
14
-
15
- subject do
16
- described_class.queue(
17
- can_initialize_queue: can_initialize_queue,
18
- attempt_connect_to_queue: attempt_connect_to_queue,
19
- commit_hash: commit_hash,
20
- branch: branch,
21
- node_total: node_total,
22
- node_index: node_index,
23
- test_files: test_files,
24
- batch_uuid: batch_uuid
25
- )
26
- end
27
-
28
- before do
29
- expect(KnapsackPro::Config::Env).to receive(:fixed_queue_split).and_return(fixed_queue_split)
30
- expect(KnapsackPro::Config::Env).to receive(:ci_node_build_id).and_return(node_build_id)
31
- expect(KnapsackPro::Config::Env).to receive(:masked_user_seat).and_return(masked_user_seat)
32
- end
33
-
34
- context 'when can_initialize_queue=true and attempt_connect_to_queue=true' do
35
- let(:can_initialize_queue) { true }
36
- let(:attempt_connect_to_queue) { true }
37
-
38
- it 'does not send test_files among other params' do
39
- action = double
40
- expect(KnapsackPro::Client::API::Action).to receive(:new).with(
41
- hash_including(request_hash: hash_excluding(:test_files))
42
- ).and_return(action)
43
- expect(subject).to eq action
44
- end
45
- end
46
-
47
- context 'when can_initialize_queue=true and attempt_connect_to_queue=false' do
48
- let(:can_initialize_queue) { true }
49
- let(:attempt_connect_to_queue) { false }
50
-
51
- it 'sends test_files among other params' do
52
- action = double
53
- expect(KnapsackPro::Client::API::Action).to receive(:new).with(
54
- hash_including(request_hash: hash_including(test_files: test_files))
55
- ).and_return(action)
56
- expect(subject).to eq action
57
- end
58
-
59
- it "sends authors" do
60
- action = double
61
-
62
- expect(KnapsackPro::Client::API::Action).to receive(:new).with(
63
- hash_including(request_hash: hash_including(:build_author, :commit_authors))
64
- ).and_return(action)
65
-
66
- expect(subject).to eq action
67
- end
68
- end
69
-
70
- context 'when can_initialize_queue=false and attempt_connect_to_queue=false' do
71
- let(:can_initialize_queue) { false }
72
- let(:attempt_connect_to_queue) { false }
73
-
74
- it 'does not send test_files among other params' do
75
- action = double
76
- expect(KnapsackPro::Client::API::Action).to receive(:new).with(
77
- hash_including(request_hash: hash_excluding(:test_files))
78
- ).and_return(action)
79
- expect(subject).to eq action
80
- end
81
- end
82
- end
83
- end