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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c5d5612a2f5309c5b786c57f3b51388e0381bf71c7935282ebfb0f3d5bf3d77
4
- data.tar.gz: 94767bc5aee313347653df3658a3251dabb0897211dc7694cb148392cfe8e842
3
+ metadata.gz: 3f27ac674f611af638b9d0ea3dd1d3441a9e680e70296738ff5b93d5d18f9741
4
+ data.tar.gz: 79bdc380a1c882178b4a3cde626de7e2db1d30ae64ae1a301f023a5ff5d71623
5
5
  SHA512:
6
- metadata.gz: c67e3c33a86d27dc8fc79c2a31dab1a6b76dac8ea43002760bbcac3284f3e57af2f28b4fd91c0ee7469fd7a4e7dc5c32279fc89fa14afac806df4e395a0032ae
7
- data.tar.gz: c8da5c7bf455a7705daf0e012d84aeac078e7c800b7a5013806b188d41052a86f30c44e50dfd2ddf23d025fb690e173d68d0b6dddee3ede0666cdda21cc4b090
6
+ metadata.gz: 75bf722c575fce515b8a1a79f7e05ad5ed8ce6f69c05f4ff7cff8fdd570e5eb3e170cbf83765c66b2d1a187a5c076235637188ef9e7bd9d3d703fa37d1bf989c
7
+ data.tar.gz: 1a355724b69bd0d62b23dd32b6e995dbdd882d0fcb0299d5cddb42c3b4c0635a588839c7194cfb2af83504d91ba4db192a68cc393a8380713450b44971c682bf
data/.circleci/config.yml CHANGED
@@ -1,38 +1,392 @@
1
- # Ruby CircleCI 2.0 configuration file
2
- #
3
- # Check https://circleci.com/docs/2.0/language-ruby/ for more details
4
- #
5
- version: 2
1
+ version: 2.1
2
+
3
+ commands:
4
+ setup_knapsack_pro_ruby:
5
+ steps:
6
+ - checkout
7
+ - restore_cache:
8
+ keys:
9
+ - v1-bundler-ruby-{{ checksum "knapsack_pro.gemspec" }}
10
+ - v1-bundler-ruby-
11
+ - run:
12
+ command: |
13
+ bundle config set --local path './vendor/bundle'
14
+ bundle install --jobs=4 --retry=3
15
+ - save_cache:
16
+ paths:
17
+ - ./vendor/bundle
18
+ key: v1-bundler-ruby-{{ checksum "knapsack_pro.gemspec" }}
19
+
20
+ setup_rails_app_with_knapsack_pro:
21
+ parameters:
22
+ path:
23
+ type: string
24
+ ruby:
25
+ type: string
26
+ rspec:
27
+ type: string
28
+ default: ""
29
+ steps:
30
+ - run:
31
+ working_directory: << parameters.path >>
32
+ command: |
33
+ git clone --depth 1 --branch $CIRCLE_BRANCH --single-branch git@github.com:KnapsackPro/rails-app-with-knapsack_pro.git ./ || git clone --depth 1 git@github.com:KnapsackPro/rails-app-with-knapsack_pro.git ./
34
+ if [[ "<< parameters.rspec >>" != "" ]]; then
35
+ sed -i 's/.*gem.*rspec-core.*/gem "rspec-core", "<< parameters.rspec >>"/g' ./Gemfile
36
+ echo "Updated RSpec version in Gemfile"
37
+ fi
38
+ - restore_cache:
39
+ keys:
40
+ - v1-bundler-rails-{{ checksum "Gemfile.lock" }}-ruby-<< parameters.ruby >>-rspec-<< parameters.rspec >>
41
+ - v1-bundler-rails-{{ checksum "Gemfile.lock" }}-ruby-<< parameters.ruby >>-
42
+ - v1-bundler-rails-{{ checksum "Gemfile.lock" }}-
43
+ - v1-bundler-rails-
44
+ - run:
45
+ working_directory: << parameters.path >>
46
+ command: |
47
+ bundle config set --local path './vendor/bundle'
48
+ bundle install --jobs=4 --retry=3
49
+ - save_cache:
50
+ paths:
51
+ - << parameters.path >>/vendor/bundle
52
+ key: v1-bundler-rails-{{ checksum "Gemfile.lock" }}-ruby-<< parameters.ruby >>-rspec-<< parameters.rspec >>
53
+
6
54
  jobs:
7
- build:
55
+ unit:
8
56
  parallelism: 1
57
+ working_directory: ~/knapsack_pro-ruby
58
+ resource_class: small
9
59
  docker:
10
- # specify the version you desire here
11
- - image: circleci/ruby:3.0.2
12
- environment:
13
- CODECLIMATE_REPO_TOKEN: b6626e682a8e97e0c5978febc92c3526792a2d018b41b8e1b52689da37fb7d92
60
+ - image: cimg/ruby:3.3
61
+ steps:
62
+ - setup_knapsack_pro_ruby
63
+ - run: gem install rubocop
64
+ - run: rubocop --fail-level A --only Style/FrozenStringLiteralComment,Layout/EmptyLineAfterMagicComment lib/
65
+ - run: bundle exec rspec spec
66
+ - run: bundle exec ruby spec/knapsack_pro/formatters/time_tracker_specs.rb
14
67
 
68
+ integration-rspec:
69
+ parallelism: 1
15
70
  working_directory: ~/knapsack_pro-ruby
16
-
71
+ resource_class: small
72
+ parameters:
73
+ ruby:
74
+ type: string
75
+ rspec:
76
+ type: string
77
+ docker:
78
+ - image: cimg/ruby:<< parameters.ruby >>
17
79
  steps:
18
80
  - checkout
19
-
20
- # Download and cache dependencies
81
+ - run:
82
+ command: |
83
+ if [[ "<< parameters.rspec >>" != "" ]]; then
84
+ sed -i 's/.*gem.*rspec-core.*/gem "rspec-core", "<< parameters.rspec >>"/g' ./Gemfile
85
+ echo "Updated RSpec version in Gemfile"
86
+ fi
21
87
  - restore_cache:
22
88
  keys:
23
- - v2-dependencies-bundler-{{ checksum "knapsack_pro.gemspec" }}
24
- # fallback to using the latest cache if no exact match is found
25
- - v2-dependencies-bundler-
26
-
89
+ - v1-bundler-gem-{{ checksum "knapsack_pro.gemspec" }}-ruby-<< parameters.ruby >>-rspec-<< parameters.rspec >>
90
+ - v1-bundler-gem-{{ checksum "knapsack_pro.gemspec" }}-ruby-<< parameters.ruby >>-
91
+ - v1-bundler-gem-{{ checksum "knapsack_pro.gemspec" }}-
92
+ - v1-bundler-gem-
27
93
  - run:
28
- name: install ruby dependencies
29
94
  command: |
30
- bundle install --jobs=4 --retry=3 --path vendor/bundle
31
-
95
+ bundle config set --local path './vendor/bundle'
96
+ bundle install --jobs=4 --retry=3
32
97
  - save_cache:
33
98
  paths:
34
99
  - ./vendor/bundle
35
- key: v2-dependencies-bundler-{{ checksum "knapsack_pro.gemspec" }}
100
+ key: v1-bundler-gem-{{ checksum "knapsack_pro.gemspec" }}-ruby-<< parameters.ruby >>-rspec-<< parameters.rspec >>
101
+ - run:
102
+ command: |
103
+ ruby --version
104
+ bundle exec rspec --version
105
+ RSPEC=$(bundle exec rspec --version | grep rspec-core | head -n1 | cut -d " " -f5)
106
+ [ $RSPEC != << parameters.rspec >> ] && exit 1 || echo "Correct version of RSpec installed: $RSPEC"
107
+ - run: bundle exec rspec spec/integration/runners/queue/rspec_runner_spec.rb
36
108
 
37
- # run tests!
38
- - run: bundle exec rspec spec
109
+ e2e-regular-rspec:
110
+ parallelism: 2
111
+ working_directory: ~/knapsack_pro-ruby
112
+ resource_class: small
113
+ parameters:
114
+ ruby:
115
+ type: string
116
+ rspec:
117
+ type: string
118
+ docker:
119
+ - image: cimg/ruby:<< parameters.ruby >>-browsers
120
+ environment:
121
+ PGHOST: 127.0.0.1
122
+ PGUSER: rails-app-with-knapsack_pro
123
+ RAILS_ENV: test
124
+ RACK_ENV: test
125
+ KNAPSACK_PRO_ENDPOINT: https://api-staging.knapsackpro.com
126
+ KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: $KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC
127
+ EXTRA_TEST_FILES_DELAY: 10
128
+ - image: cimg/postgres:14.7
129
+ environment:
130
+ POSTGRES_DB: rails-app-with-knapsack_pro_test
131
+ POSTGRES_PASSWORD: password
132
+ POSTGRES_USER: rails-app-with-knapsack_pro
133
+ steps:
134
+ - setup_knapsack_pro_ruby
135
+ - setup_rails_app_with_knapsack_pro:
136
+ path: ~/rails-app-with-knapsack_pro
137
+ ruby: << parameters.ruby >>
138
+ rspec: << parameters.rspec >>
139
+ - run: dockerize -wait tcp://localhost:5432 -timeout 1m
140
+ - run:
141
+ working_directory: ~/rails-app-with-knapsack_pro
142
+ command: |
143
+ ruby --version
144
+ bundle exec rspec --version
145
+ RSPEC=$(bundle exec rspec --version | grep rspec-core | head -n1 | cut -d " " -f5)
146
+ [ $RSPEC != << parameters.rspec >> ] && exit 1 || echo "Correct version of RSpec installed: $RSPEC"
147
+ - run:
148
+ working_directory: ~/rails-app-with-knapsack_pro
149
+ command: bin/rails db:setup
150
+ - run:
151
+ working_directory: ~/rails-app-with-knapsack_pro
152
+ command: |
153
+ export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--regular"
154
+ bundle exec rake knapsack_pro:rspec
155
+ - run:
156
+ working_directory: ~/rails-app-with-knapsack_pro
157
+ command: |
158
+ # fallback ||
159
+ export KNAPSACK_PRO_ENDPOINT=https://api-fake.knapsackpro.com
160
+ export KNAPSACK_PRO_MAX_REQUEST_RETRIES=1
161
+ bundle exec rake knapsack_pro:rspec
162
+ - run:
163
+ working_directory: ~/rails-app-with-knapsack_pro
164
+ command: |
165
+ # split by test examples ||
166
+ export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--regular--split"
167
+ export KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES=true
168
+ bundle exec rake knapsack_pro:rspec
169
+ - run:
170
+ working_directory: ~/rails-app-with-knapsack_pro
171
+ command: |
172
+ # split custom files by test examples ||
173
+ export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--regular--split-custom-files"
174
+ export KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES=true
175
+ export KNAPSACK_PRO_SLOW_TEST_FILE_PATTERN="spec/features/calculator_spec.rb"
176
+ bundle exec rake knapsack_pro:rspec
177
+
178
+ e2e-queue-rspec:
179
+ parameters:
180
+ ruby:
181
+ type: string
182
+ rspec:
183
+ type: string
184
+ parallelism: 2
185
+ working_directory: ~/knapsack_pro-ruby
186
+ resource_class: small
187
+ docker:
188
+ - image: cimg/ruby:<< parameters.ruby >>-browsers
189
+ environment:
190
+ PGHOST: 127.0.0.1
191
+ PGUSER: rails-app-with-knapsack_pro
192
+ RAILS_ENV: test
193
+ RACK_ENV: test
194
+ KNAPSACK_PRO_ENDPOINT: https://api-staging.knapsackpro.com
195
+ KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: $KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC
196
+ EXTRA_TEST_FILES_DELAY: 10
197
+ - image: cimg/postgres:14.7
198
+ environment:
199
+ POSTGRES_DB: rails-app-with-knapsack_pro_test
200
+ POSTGRES_PASSWORD: password
201
+ POSTGRES_USER: rails-app-with-knapsack_pro
202
+ steps:
203
+ - setup_knapsack_pro_ruby
204
+ - setup_rails_app_with_knapsack_pro:
205
+ path: ~/rails-app-with-knapsack_pro
206
+ ruby: << parameters.ruby >>
207
+ rspec: << parameters.rspec >>
208
+ - run: dockerize -wait tcp://localhost:5432 -timeout 1m
209
+ - run:
210
+ working_directory: ~/rails-app-with-knapsack_pro
211
+ command: |
212
+ ruby --version
213
+ bundle exec rspec --version
214
+ RSPEC=$(bundle exec rspec --version | grep rspec-core | head -n1 | cut -d " " -f5)
215
+ [ $RSPEC != << parameters.rspec >> ] && exit 1 || echo "Correct version of RSpec installed: $RSPEC"
216
+ - run:
217
+ working_directory: ~/rails-app-with-knapsack_pro
218
+ command: bin/rails db:setup
219
+ - run:
220
+ working_directory: ~/rails-app-with-knapsack_pro
221
+ command: |
222
+ export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--queue"
223
+ bundle exec rake knapsack_pro:queue:rspec
224
+ - run:
225
+ working_directory: ~/rails-app-with-knapsack_pro
226
+ command: |
227
+ # run 0 tests as queue is consumed ||
228
+ export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--queue"
229
+ export KNAPSACK_PRO_FIXED_QUEUE_SPLIT=false
230
+ bundle exec rake knapsack_pro:queue:rspec
231
+ - run:
232
+ working_directory: ~/rails-app-with-knapsack_pro
233
+ command: |
234
+ # retry the same split ||
235
+ export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--queue"
236
+ export KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true
237
+ bundle exec rake knapsack_pro:queue:rspec
238
+ - run:
239
+ working_directory: ~/rails-app-with-knapsack_pro
240
+ command: |
241
+ # fallback ||
242
+ export KNAPSACK_PRO_ENDPOINT=https://api-fake.knapsackpro.com
243
+ export KNAPSACK_PRO_MAX_REQUEST_RETRIES=1
244
+ bundle exec rake knapsack_pro:queue:rspec
245
+ - run:
246
+ working_directory: ~/rails-app-with-knapsack_pro
247
+ command: |
248
+ # split by test examples ||
249
+ export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--queue--split"
250
+ export KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true
251
+ export KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES=true
252
+ bundle exec rake knapsack_pro:queue:rspec
253
+ - run:
254
+ working_directory: ~/rails-app-with-knapsack_pro
255
+ command: |
256
+ # turnip ||
257
+ export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--queue--turnip"
258
+ export KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true
259
+ export KNAPSACK_PRO_TEST_DIR=turnip
260
+ export KNAPSACK_PRO_TEST_FILE_PATTERN="turnip/**/*.feature"
261
+ bundle exec rake "knapsack_pro:queue:rspec[-r turnip/rspec]"
262
+ - run:
263
+ working_directory: ~/rails-app-with-knapsack_pro
264
+ command: |
265
+ # turnip retry ||
266
+ export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--queue--turnip"
267
+ export KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true
268
+ export KNAPSACK_PRO_TEST_DIR=turnip
269
+ export KNAPSACK_PRO_TEST_FILE_PATTERN="turnip/**/*.feature"
270
+ bundle exec rake "knapsack_pro:queue:rspec[-r turnip/rspec]"
271
+
272
+ e2e-regular-minitest:
273
+ parallelism: 2
274
+ working_directory: ~/knapsack_pro-ruby
275
+ resource_class: small
276
+ parameters:
277
+ ruby:
278
+ type: string
279
+ docker:
280
+ - image: cimg/ruby:<< parameters.ruby >>-browsers
281
+ environment:
282
+ PGHOST: 127.0.0.1
283
+ PGUSER: rails-app-with-knapsack_pro
284
+ RAILS_ENV: test
285
+ RACK_ENV: test
286
+ KNAPSACK_PRO_ENDPOINT: https://api-staging.knapsackpro.com
287
+ KNAPSACK_PRO_TEST_SUITE_TOKEN_MINITEST: $KNAPSACK_PRO_TEST_SUITE_TOKEN_MINITEST
288
+ EXTRA_TEST_FILES_DELAY: 10
289
+ - image: cimg/postgres:14.7
290
+ environment:
291
+ POSTGRES_DB: rails-app-with-knapsack_pro_test
292
+ POSTGRES_PASSWORD: password
293
+ POSTGRES_USER: rails-app-with-knapsack_pro
294
+ steps:
295
+ - setup_knapsack_pro_ruby
296
+ - setup_rails_app_with_knapsack_pro:
297
+ path: ~/rails-app-with-knapsack_pro
298
+ ruby: << parameters.ruby >>
299
+ - run: dockerize -wait tcp://localhost:5432 -timeout 1m
300
+ - run:
301
+ working_directory: ~/rails-app-with-knapsack_pro
302
+ command: ruby --version
303
+ - run:
304
+ working_directory: ~/rails-app-with-knapsack_pro
305
+ command: bin/rails db:setup
306
+ - run:
307
+ working_directory: ~/rails-app-with-knapsack_pro
308
+ command: |
309
+ export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--regular"
310
+ bundle exec rake knapsack_pro:minitest[--verbose]
311
+
312
+ e2e-queue-minitest:
313
+ parameters:
314
+ ruby:
315
+ type: string
316
+ parallelism: 2
317
+ working_directory: ~/knapsack_pro-ruby
318
+ resource_class: small
319
+ docker:
320
+ - image: cimg/ruby:<< parameters.ruby >>-browsers
321
+ environment:
322
+ PGHOST: 127.0.0.1
323
+ PGUSER: rails-app-with-knapsack_pro
324
+ RAILS_ENV: test
325
+ RACK_ENV: test
326
+ KNAPSACK_PRO_ENDPOINT: https://api-staging.knapsackpro.com
327
+ KNAPSACK_PRO_TEST_SUITE_TOKEN_MINITEST: $KNAPSACK_PRO_TEST_SUITE_TOKEN_MINITEST
328
+ EXTRA_TEST_FILES_DELAY: 10
329
+ - image: cimg/postgres:14.7
330
+ environment:
331
+ POSTGRES_DB: rails-app-with-knapsack_pro_test
332
+ POSTGRES_PASSWORD: password
333
+ POSTGRES_USER: rails-app-with-knapsack_pro
334
+ steps:
335
+ - setup_knapsack_pro_ruby
336
+ - setup_rails_app_with_knapsack_pro:
337
+ path: ~/rails-app-with-knapsack_pro
338
+ ruby: << parameters.ruby >>
339
+ - run: dockerize -wait tcp://localhost:5432 -timeout 1m
340
+ - run:
341
+ working_directory: ~/rails-app-with-knapsack_pro
342
+ command: ruby --version
343
+ - run:
344
+ working_directory: ~/rails-app-with-knapsack_pro
345
+ command: bin/rails db:setup
346
+ - run:
347
+ working_directory: ~/rails-app-with-knapsack_pro
348
+ command: |
349
+ # minitest ||
350
+ export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--queue--minitest"
351
+ export KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true
352
+ bundle exec rake knapsack_pro:queue:minitest[--verbose]
353
+ - run:
354
+ working_directory: ~/rails-app-with-knapsack_pro
355
+ command: |
356
+ # minitest retry ||
357
+ export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--queue--minitest"
358
+ export KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true
359
+ bundle exec rake knapsack_pro:queue:minitest[--verbose]
360
+
361
+ workflows:
362
+ tests:
363
+ jobs:
364
+ - unit
365
+ - integration-rspec:
366
+ name: integration__ruby-<< matrix.ruby >>__rspec-<< matrix.rspec >>
367
+ matrix:
368
+ parameters:
369
+ ruby: ["3.0", "3.1", "3.2", "3.3"]
370
+ rspec: ["3.10.2", "3.11.0", "3.12.2"]
371
+ - e2e-regular-rspec:
372
+ name: e2e-regular__ruby-<< matrix.ruby >>__rspec-<< matrix.rspec >>
373
+ matrix:
374
+ parameters:
375
+ ruby: ["3.0", "3.1", "3.2", "3.3"]
376
+ rspec: ["3.10.2", "3.11.0", "3.12.2"]
377
+ - e2e-queue-rspec:
378
+ name: e2e-queue__ruby-<< matrix.ruby >>__rspec-<< matrix.rspec >>
379
+ matrix:
380
+ parameters:
381
+ ruby: ["3.0", "3.1", "3.2", "3.3"]
382
+ rspec: ["3.10.2", "3.11.0", "3.12.2"]
383
+ - e2e-regular-minitest:
384
+ name: e2e-regular__ruby-<< matrix.ruby >>__minitest
385
+ matrix:
386
+ parameters:
387
+ ruby: ["3.0", "3.1", "3.2", "3.3"]
388
+ - e2e-queue-minitest:
389
+ name: e2e-queue__ruby-<< matrix.ruby >>__minitest
390
+ matrix:
391
+ parameters:
392
+ ruby: ["3.0", "3.1", "3.2", "3.3"]
@@ -0,0 +1,11 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "bundler"
9
+ directory: "/"
10
+ schedule:
11
+ interval: "weekly"
@@ -0,0 +1,22 @@
1
+ # Story
2
+
3
+ TODO: link to the internal story
4
+
5
+ ## Related
6
+
7
+ TODO: links to related PRs or issues
8
+
9
+ # Description
10
+
11
+ TODO
12
+
13
+ # Changes
14
+
15
+ TODO: changes introduced by this PR
16
+
17
+ # Checklist reminder
18
+
19
+ - [ ] You follow the architecture outlined below for RSpec in Queue Mode, which is a work in progress (feel free to propose changes):
20
+ - Pure: `lib/knapsack_pro/pure/queue/rspec_pure.rb` contains pure functions that are unit tested.
21
+ - Extension: `lib/knapsack_pro/extensions/rspec_extension.rb` encapsulates calls to RSpec internals and is integration and e2e tested.
22
+ - Runner: `lib/knapsack_pro/runners/queue/rspec_runner.rb` invokes the pure code and the extension to produce side effects, which are integration and e2e tested.
data/.gitignore CHANGED
@@ -34,3 +34,7 @@ Gemfile.lock
34
34
 
35
35
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
36
36
  .rvmrc
37
+
38
+ # dynamically generated specs
39
+ spec/knapsack_pro/formatters/time_tracker*_spec.rb
40
+ spec_integration/