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
data/Gemfile DELETED
@@ -1,13 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in knapsack.gemspec
4
- gemspec
5
-
6
- group :test do
7
- gem 'rspec_junit_formatter', require: false
8
- gem 'nokogiri', require: false
9
- gem 'simplecov', require: false
10
-
11
- # This line is going to be replaced on CI to test different RSpec versions.
12
- # gem 'rspec-core', 'x.x.x'
13
- end
data/LICENSE DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2017 Artur Trzop https://knapsackpro.com
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md DELETED
@@ -1,90 +0,0 @@
1
- # `knapsack_pro` ruby gem
2
-
3
- <p align="center">
4
- <a href="https://knapsackpro.com?utm_source=github&utm_medium=readme&utm_campaign=knapsack_pro-ruby_gem&utm_content=hero_logo">
5
- <img alt="Knapsack Pro" src="./.github/assets/knapsack-diamonds.png" width="300" height="300" style="max-width: 100%;" />
6
- </a>
7
- </p>
8
-
9
- <h3 align="center">Speed up your tests</h3>
10
- <p align="center">Run your 1-hour test suite in 2 minutes with optimal parallelisation on your existing CI infrastructure</p>
11
-
12
- ---
13
-
14
- <div align="center">
15
- <a href="https://circleci.com/gh/KnapsackPro/knapsack_pro-ruby">
16
- <img alt="Circle CI" src="https://circleci.com/gh/KnapsackPro/knapsack_pro-ruby.svg" />
17
- </a>
18
- <a href="https://rubygems.org/gems/knapsack_pro">
19
- <img alt="Gem Version" src="https://badge.fury.io/rb/knapsack_pro.svg" />
20
- </a>
21
- </div>
22
-
23
- <br />
24
- <br />
25
-
26
- Knapsack Pro wraps your current test runner(s) and works with your existing CI infrastructure to parallelize tests optimally:
27
-
28
- - Dynamically splits your tests based on up-to-date test execution data
29
- - Is designed from the ground up for CI and supports all of them
30
- - Tracks your CI builds to detect bottlenecks
31
- - Does not have access to your source code and collects minimal test data (with opt-in encryption)
32
- - Enables you to export historical metrics about your CI builds
33
- - Supports out-of-the-box any Ruby test runners, Cypress, Jest (and provides both SDK and API to integrate with any other language)
34
- - Replaces local dependencies like Redis with an API and runs your tests regardless of network problems
35
-
36
- The `knapsack_pro` gem supports all CIs and the following test runners:
37
-
38
- - RSpec
39
- - Cucumber
40
- - Minitest
41
- - test-unit
42
- - Spinach
43
- - Turnip
44
-
45
- ## Installation
46
-
47
- The [Installation Guide](https://docs.knapsackpro.com/knapsack_pro-ruby/guide/?utm_source=github&utm_medium=readme&utm_campaign=knapsack_pro-ruby_gem&utm_content=installation_guide) will ask you a few questions and generate instruction steps for your project:
48
-
49
- <div align="center">
50
- <a href="https://docs.knapsackpro.com/knapsack_pro-ruby/guide/?utm_source=github&utm_medium=readme&utm_campaign=knapsack_pro-ruby_gem&utm_content=installation_guide">
51
- <img alt="Install button" src="./.github/assets/install-button.png" width="116" height="50" />
52
- </a>
53
- </div>
54
-
55
- ## Upgrade
56
-
57
- Knapsack Pro follows semantic versioning, but make sure to check the [changelog](CHANGELOG.md) before updating gem with:
58
-
59
- ```bash
60
- bundle update knapsack_pro
61
- ```
62
-
63
- ## Contributing
64
-
65
- ### Testing
66
-
67
- RSpec:
68
-
69
- ```bash
70
- bundle exec rspec
71
- ```
72
-
73
- Scripted tests can be found in the [Rails App With Knapsack Pro repository](https://github.com/KnapsackPro/rails-app-with-knapsack_pro/blob/master/bin/knapsack_pro_all.rb).
74
-
75
- ### Publishing
76
-
77
- 1. Move the changes listed in the `UNRELEASED` section of the `CHANGELOG.md` to the proper version
78
-
79
- 2. Update the gem version in `lib/knapsack_pro/version.rb`
80
-
81
- 3. `git commit -am "Bump version x.x.x"`
82
-
83
- 4. Build, tag, push, release: `bundle exec rake release`
84
-
85
- 5. Update the latest available gem version in `TestSuiteClientVersionChecker` for the Knapsack Pro API repository.
86
-
87
- 6. Update the `knapsack_pro` gem version in:
88
-
89
- - [Rails App With Knapsack Pro repository](https://github.com/KnapsackPro/rails-app-with-knapsack_pro)
90
- - Knapsack Pro API internal repository
data/Rakefile DELETED
@@ -1,2 +0,0 @@
1
- require 'bundler/gem_tasks'
2
- require 'knapsack_pro'
data/knapsack_pro.gemspec DELETED
@@ -1,43 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'knapsack_pro/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = 'knapsack_pro'
8
- spec.version = KnapsackPro::VERSION
9
- spec.required_ruby_version = '>= 3.0.0'
10
- spec.authors = ['ArturT']
11
- spec.email = ['support@knapsackpro.com']
12
- spec.summary = %q{Knapsack Pro splits tests across parallel CI nodes and ensures each parallel job finish work at a similar time.}
13
- spec.description = %q{Knapsack Pro wraps your current test runner(s) and works with your existing CI infrastructure to parallelize tests optimally. It dynamically splits your tests based on up-to-date test execution data. It's designed from the ground up for CI and supports all of them.}
14
- spec.homepage = 'https://knapsackpro.com'
15
- spec.license = 'MIT'
16
- spec.metadata = {
17
- 'bug_tracker_uri' => 'https://github.com/KnapsackPro/knapsack_pro-ruby/issues',
18
- 'changelog_uri' => 'https://github.com/KnapsackPro/knapsack_pro-ruby/blob/main/CHANGELOG.md',
19
- 'documentation_uri' => 'https://docs.knapsackpro.com/knapsack_pro-ruby/guide/',
20
- 'homepage_uri' => 'https://knapsackpro.com',
21
- 'source_code_uri' => 'https://github.com/KnapsackPro/knapsack_pro-ruby'
22
- }
23
-
24
- spec.files = `git ls-files -z`.split("\x0")
25
- spec.executables = ['knapsack_pro']
26
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
27
- spec.require_paths = ['lib']
28
-
29
- spec.add_dependency 'rake', '>= 0'
30
-
31
- spec.add_development_dependency 'bundler', '>= 1.6'
32
- spec.add_development_dependency 'cucumber', '>= 0'
33
- spec.add_development_dependency 'minitest', '>= 5.0.0'
34
- spec.add_development_dependency 'ostruct', '>= 0.6.0'
35
- spec.add_development_dependency 'pry', '~> 0'
36
- spec.add_development_dependency 'rspec', '~> 3.0'
37
- spec.add_development_dependency 'rspec-its', '~> 1.3'
38
- spec.add_development_dependency 'spinach', '>= 0.8'
39
- spec.add_development_dependency 'test-unit', '>= 3.0.0'
40
- spec.add_development_dependency 'timecop', '>= 0.9.9'
41
- spec.add_development_dependency 'vcr', '>= 6.0'
42
- spec.add_development_dependency 'webmock', '>= 3.13'
43
- end
@@ -1,6 +0,0 @@
1
- ./spec/test1_spec.rb
2
- spec/test2_spec.rb[1]
3
- ./spec/test3_spec.rb[1:2:3:4]
4
- ./spec/test4_spec.rb:4
5
- ./spec/test4_spec.rb:5
6
-
@@ -1,59 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: http://api.knapsackpro.test:3000/v1/build_distributions/subset
6
- body:
7
- encoding: UTF-8
8
- string: '{"fixed_test_suite_split":true,"cache_read_attempt":true,"commit_hash":"abcdefg","branch":"main","node_total":"2","node_index":"1","ci_build_id":"missing-build-id"}'
9
- headers:
10
- Content-Type:
11
- - application/json
12
- Accept:
13
- - application/json
14
- Knapsack-Pro-Client-Name:
15
- - knapsack_pro-ruby
16
- Knapsack-Pro-Client-Version:
17
- - 3.5.0
18
- Knapsack-Pro-Test-Suite-Token:
19
- - fake
20
- Accept-Encoding:
21
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
22
- User-Agent:
23
- - Ruby
24
- response:
25
- status:
26
- code: 403
27
- message: Forbidden
28
- headers:
29
- X-Frame-Options:
30
- - SAMEORIGIN
31
- X-Xss-Protection:
32
- - '0'
33
- X-Content-Type-Options:
34
- - nosniff
35
- X-Download-Options:
36
- - noopen
37
- X-Permitted-Cross-Domain-Policies:
38
- - none
39
- Referrer-Policy:
40
- - strict-origin-when-cross-origin
41
- Content-Type:
42
- - application/json; charset=utf-8
43
- Cache-Control:
44
- - no-cache
45
- X-Request-Id:
46
- - a5ffe97f-4558-426b-9475-166eb89ab7cb
47
- X-Runtime:
48
- - '0.231483'
49
- Server-Timing:
50
- - sql.active_record;dur=24.31, start_processing.action_controller;dur=0.00,
51
- instantiation.active_record;dur=0.02, halted_callback.action_controller;dur=0.00,
52
- process_action.action_controller;dur=15.10
53
- Transfer-Encoding:
54
- - chunked
55
- body:
56
- encoding: UTF-8
57
- string: '{"errors":["invalid test suite token"]}'
58
- recorded_at: Thu, 08 Dec 2022 23:27:10 GMT
59
- recorded_with: VCR 6.1.0
@@ -1,61 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: http://api.knapsackpro.test:3000/v1/build_distributions/subset
6
- body:
7
- encoding: UTF-8
8
- string: '{"fixed_test_suite_split":true,"cache_read_attempt":true,"commit_hash":"abcdefg","branch":"main","node_total":"2","node_index":"1","ci_build_id":"missing-build-id"}'
9
- headers:
10
- Content-Type:
11
- - application/json
12
- Accept:
13
- - application/json
14
- Knapsack-Pro-Client-Name:
15
- - knapsack_pro-ruby
16
- Knapsack-Pro-Client-Version:
17
- - 3.5.0
18
- Knapsack-Pro-Test-Suite-Token:
19
- - 3fa64859337f6e56409d49f865d13fd7
20
- Accept-Encoding:
21
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
22
- User-Agent:
23
- - Ruby
24
- response:
25
- status:
26
- code: 200
27
- message: OK
28
- headers:
29
- X-Frame-Options:
30
- - SAMEORIGIN
31
- X-Xss-Protection:
32
- - '0'
33
- X-Content-Type-Options:
34
- - nosniff
35
- X-Download-Options:
36
- - noopen
37
- X-Permitted-Cross-Domain-Policies:
38
- - none
39
- Referrer-Policy:
40
- - strict-origin-when-cross-origin
41
- Content-Type:
42
- - application/json; charset=utf-8
43
- Etag:
44
- - W/"1f643e3528e8ff45d9d2d67ab7e32be1"
45
- Cache-Control:
46
- - max-age=0, private, must-revalidate
47
- X-Request-Id:
48
- - 9b378323-c960-4868-894e-5ae0cdab8840
49
- X-Runtime:
50
- - '0.273775'
51
- Server-Timing:
52
- - sql.active_record;dur=55.90, start_processing.action_controller;dur=0.00,
53
- unpermitted_parameters.action_controller;dur=0.01, instantiation.active_record;dur=10.69,
54
- process_action.action_controller;dur=92.24
55
- Transfer-Encoding:
56
- - chunked
57
- body:
58
- encoding: UTF-8
59
- string: '{"code":"TEST_SUITE_SPLIT_CACHE_MISS"}'
60
- recorded_at: Thu, 08 Dec 2022 23:27:07 GMT
61
- recorded_with: VCR 6.1.0
@@ -1,50 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: http://api.knapsackpro.test:3000/v1/build_subsets
6
- body:
7
- encoding: UTF-8
8
- string: '{"commit_hash":"abcdefg","branch":"main","node_total":"2","node_index":"1","test_files":[{"path":"a_spec.rb","time_execution":1.2},{"path":"b_spec.rb","time_execution":0.3}]}'
9
- headers:
10
- Content-Type:
11
- - application/json
12
- Accept:
13
- - application/json
14
- Accept-Encoding:
15
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
- User-Agent:
17
- - Ruby
18
- response:
19
- status:
20
- code: 403
21
- message: 'Forbidden '
22
- headers:
23
- X-Frame-Options:
24
- - SAMEORIGIN
25
- X-Xss-Protection:
26
- - 1; mode=block
27
- X-Content-Type-Options:
28
- - nosniff
29
- Content-Type:
30
- - application/json; charset=utf-8
31
- Cache-Control:
32
- - no-cache
33
- X-Request-Id:
34
- - 5288d830-4498-4a36-adae-9f4230289de3
35
- X-Runtime:
36
- - '0.065296'
37
- Server:
38
- - WEBrick/1.3.1 (Ruby/2.2.2/2015-04-13)
39
- Date:
40
- - Fri, 31 Jul 2015 16:18:27 GMT
41
- Content-Length:
42
- - '39'
43
- Connection:
44
- - Keep-Alive
45
- body:
46
- encoding: UTF-8
47
- string: '{"errors":["invalid test suite token"]}'
48
- http_version:
49
- recorded_at: Fri, 31 Jul 2015 16:18:27 GMT
50
- recorded_with: VCR 2.9.3
@@ -1,50 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: http://api.knapsackpro.test:3000/v1/build_subsets
6
- body:
7
- encoding: UTF-8
8
- string: '{"commit_hash":"abcdefg","branch":"main","node_total":"2","node_index":"1","test_files":[{"path":"a_spec.rb","time_execution":1.2},{"path":"b_spec.rb","time_execution":0.3}]}'
9
- headers:
10
- Content-Type:
11
- - application/json
12
- Accept:
13
- - application/json
14
- Accept-Encoding:
15
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
- User-Agent:
17
- - Ruby
18
- response:
19
- status:
20
- code: 201
21
- message: 'Created '
22
- headers:
23
- X-Frame-Options:
24
- - SAMEORIGIN
25
- X-Xss-Protection:
26
- - 1; mode=block
27
- X-Content-Type-Options:
28
- - nosniff
29
- Content-Type:
30
- - text/plain; charset=utf-8
31
- Cache-Control:
32
- - no-cache
33
- X-Request-Id:
34
- - 3f9741b6-36b2-43e9-8346-d94732a0841e
35
- X-Runtime:
36
- - '0.060958'
37
- Server:
38
- - WEBrick/1.3.1 (Ruby/2.2.2/2015-04-13)
39
- Date:
40
- - Fri, 31 Jul 2015 16:18:27 GMT
41
- Content-Length:
42
- - '0'
43
- Connection:
44
- - Keep-Alive
45
- body:
46
- encoding: UTF-8
47
- string: ''
48
- http_version:
49
- recorded_at: Fri, 31 Jul 2015 16:18:27 GMT
50
- recorded_with: VCR 2.9.3
@@ -1,77 +0,0 @@
1
- describe 'Request API /v1/build_distributions/subset' do
2
- let(:valid_endpoint) { 'http://api.knapsackpro.test:3000' }
3
- let(:invalid_endpoint) { 'http://api.fake-knapsackpro.test:3000' }
4
- let(:valid_test_suite_token) { '3fa64859337f6e56409d49f865d13fd7' }
5
- let(:invalid_test_suite_token) { 'fake' }
6
-
7
- let(:action) do
8
- KnapsackPro::Client::API::V1::BuildDistributions.subset(
9
- cache_read_attempt: true,
10
- commit_hash: 'abcdefg',
11
- branch: 'main',
12
- node_total: '2',
13
- node_index: '1',
14
- test_files: [
15
- {
16
- 'path' => 'a_spec.rb'
17
- },
18
- {
19
- 'path' => 'b_spec.rb'
20
- }
21
- ],
22
- )
23
- end
24
- let(:connection) { KnapsackPro::Client::Connection.new(action) }
25
- let(:endpoint) { valid_endpoint }
26
- let(:test_suite_token) { valid_test_suite_token }
27
-
28
- before do
29
- stub_const('ENV', {
30
- 'KNAPSACK_PRO_ENDPOINT' => endpoint,
31
- 'KNAPSACK_PRO_TEST_SUITE_TOKEN' => test_suite_token,
32
- 'KNAPSACK_PRO_CI_NODE_BUILD_ID' => 'some-build-id',
33
- })
34
- end
35
-
36
- context 'when success' do
37
- it do
38
- VCR.use_cassette('api/v1/build_distributions/subset/success') do
39
- response = connection.call
40
- puts response
41
- end
42
-
43
- expect(connection.errors?).to be false
44
- expect(connection.success?).to be true
45
- end
46
- end
47
-
48
- context 'when invalid test suite token' do
49
- let(:test_suite_token) { invalid_test_suite_token }
50
-
51
- it do
52
- VCR.use_cassette('api/v1/build_distributions/subset/invalid_test_suite_token') do
53
- response = connection.call
54
- puts response
55
- end
56
-
57
- expect(connection.errors?).to be true
58
- expect(connection.success?).to be true
59
- end
60
- end
61
-
62
- context 'when timeout' do
63
- let(:endpoint) { invalid_endpoint }
64
-
65
- it do
66
- stub_const('KnapsackPro::Client::Connection::TIMEOUT', 0.01)
67
- stub_const('KnapsackPro::Client::Connection::REQUEST_RETRY_TIMEBOX', 0.01)
68
- VCR.use_cassette('api/v1/build_distributions/subset/timeout') do
69
- response = connection.call
70
- puts response
71
- end
72
-
73
- expect(connection.errors?).to be false
74
- expect(connection.success?).to be false
75
- end
76
- end
77
- end
@@ -1,77 +0,0 @@
1
- describe 'Request API /v1/build_subsets' do
2
- let(:valid_endpoint) { 'http://api.knapsackpro.test:3000' }
3
- let(:invalid_endpoint) { 'http://api.fake-knapsackpro.test:3000' }
4
- let(:valid_test_suite_token) { '3fa64859337f6e56409d49f865d13fd7' }
5
- let(:invalid_test_suite_token) { 'fake' }
6
-
7
- let(:action) do
8
- KnapsackPro::Client::API::V1::BuildSubsets.create(
9
- commit_hash: 'abcdefg',
10
- branch: 'main',
11
- node_total: '2',
12
- node_index: '1',
13
- test_files: [
14
- {
15
- 'path' => 'a_spec.rb',
16
- 'time_execution' => 1.2,
17
- },
18
- {
19
- 'path' => 'b_spec.rb',
20
- 'time_execution' => 0.3,
21
- }
22
- ],
23
- )
24
- end
25
- let(:connection) { KnapsackPro::Client::Connection.new(action) }
26
- let(:endpoint) { valid_endpoint }
27
- let(:test_suite_token) { valid_test_suite_token }
28
-
29
- before do
30
- stub_const('ENV', {
31
- 'KNAPSACK_PRO_ENDPOINT' => endpoint,
32
- 'KNAPSACK_PRO_TEST_SUITE_TOKEN' => test_suite_token,
33
- })
34
- end
35
-
36
- context 'when success' do
37
- it do
38
- VCR.use_cassette('api/v1/build_subsets/create/success') do
39
- response = connection.call
40
- puts response
41
- end
42
-
43
- expect(connection.errors?).to be false
44
- expect(connection.success?).to be true
45
- end
46
- end
47
-
48
- context 'when invalid test suite token' do
49
- let(:test_suite_token) { invalid_test_suite_token }
50
-
51
- it do
52
- VCR.use_cassette('api/v1/build_subsets/create/invalid_test_suite_token') do
53
- response = connection.call
54
- puts response
55
- end
56
-
57
- expect(connection.errors?).to be true
58
- expect(connection.success?).to be true
59
- end
60
- end
61
-
62
- context 'when timeout' do
63
- let(:endpoint) { invalid_endpoint }
64
-
65
- it do
66
- stub_const('KnapsackPro::Client::Connection::TIMEOUT', 0.01)
67
- stub_const('KnapsackPro::Client::Connection::REQUEST_RETRY_TIMEBOX', 0.01)
68
- VCR.use_cassette('api/v1/build_subsets/create/timeout') do
69
- response = connection.call
70
- puts response
71
- end
72
-
73
- expect(connection.errors?).to be false
74
- expect(connection.success?).to be false
75
- end
76
- end
77
- end