knapsack_pro 2.6.0 → 2.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4167b51e7f0af27a7d1482efb7a6c019f9aa99dd849f9488e47c4a33b5bd943
4
- data.tar.gz: fff1d5e557813cd2829298c422d4ffae857e047d27aa001cf746a516270d9259
3
+ metadata.gz: e72536de9d4d9ec4a02e935742375b9d8023522f9c21ac8340a991bfdc7982cb
4
+ data.tar.gz: b7694088ff854a5579ec160fbb08c3219986a95512c2feea15ac6a359dc7aff5
5
5
  SHA512:
6
- metadata.gz: fd9b442c01b5b58b295e6fc36d3879ddbf97b8770d4f96243f594f225ef3f73e23e75555cfba7adb6439dd5afa39a38ea756e5758628eed54c9305a12bd8b716
7
- data.tar.gz: 7401c76f35ce8485a7dc8dc5742514803c8a045d7f431899b32aaa4795433b723b68e554386b7670abb367b1f9dfde2be9e4bc8b661ead354dbab366b56c1705
6
+ metadata.gz: 408aaada7954066b2a3266897aa9b145ce53f2f7409f99f4c8915e122c5deef0818bc14503da59cab1f20c1376a4b205466089c14eaa8c9cd1943699298f8d86
7
+ data.tar.gz: 85eef879c155557825347ede8671f1b65d9832a8e8b379e94efaf61573cbd676082d43d6219099a35cad008266ef8e16cd719553397c5b71f775ad0ab76f7e79
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ### 2.7.0
4
+
5
+ * Add support for env var `KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE` to allow accepting file containing test files to run
6
+
7
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/129
8
+
9
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v2.6.0...v2.7.0
10
+
3
11
  ### 2.6.0
4
12
 
5
13
  * Improve logger to show failed requests URL and when retry will happen
data/README.md CHANGED
@@ -3082,7 +3082,9 @@ The test file pattern and exclude pattern support any glob pattern handled by [`
3082
3082
 
3083
3083
  #### How to run a specific list of test files or only some tests from test file?
3084
3084
 
3085
- :information_source: If you don't want to use the pattern [`KNAPSACK_PRO_TEST_FILE_PATTERN`](#how-can-i-run-tests-from-multiple-directories) to define a list of tests to run then read below.
3085
+ :information_source: If you don't want to use the pattern [`KNAPSACK_PRO_TEST_FILE_PATTERN`](#how-can-i-run-tests-from-multiple-directories) to define a list of tests to run then read below two options.
3086
+
3087
+ **Option 1:**
3086
3088
 
3087
3089
  If you want to run a specific list of test files that are explicitly defined by you or auto-generated by some kind of script you created then please use:
3088
3090
 
@@ -3090,7 +3092,24 @@ If you want to run a specific list of test files that are explicitly defined by
3090
3092
 
3091
3093
  Note `KNAPSACK_PRO_TEST_FILE_LIST` must be a list of test files comma separated. You can provide line number for tests inside of spec file in case of RSpec (this way you can run only one test or a group of tests from RSpec spec file). You can provide the same file a few times with different test line number.
3092
3094
 
3093
- Note when you set `KNAPSACK_PRO_TEST_FILE_LIST` then below environment variables are ignored:
3095
+ **Option 2:**
3096
+
3097
+ Similarly, you can also provide a source file containing the test files that you would like to run. For example:
3098
+ `KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE=spec/fixtures/test_file_list_source_file.txt`
3099
+ And the content of the source file can be any of the format below:
3100
+
3101
+ ```
3102
+ ./spec/test1_spec.rb
3103
+ spec/test2_spec.rb[1]
3104
+ ./spec/test3_spec.rb[1:2:3:4]
3105
+ ./spec/test4_spec.rb:4
3106
+ ./spec/test4_spec.rb:5
3107
+ ```
3108
+
3109
+ > Note that each of the line must be ending with `\n` the new line.
3110
+
3111
+ Note when you set `KNAPSACK_PRO_TEST_FILE_LIST` or `KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE` then below environment variables are ignored:
3112
+
3094
3113
  * `KNAPSACK_PRO_TEST_FILE_PATTERN`
3095
3114
  * `KNAPSACK_PRO_TEST_FILE_EXCLUDE_PATTERN`
3096
3115
 
@@ -74,6 +74,10 @@ module KnapsackPro
74
74
  ENV['KNAPSACK_PRO_TEST_FILE_LIST']
75
75
  end
76
76
 
77
+ def test_file_list_source_file
78
+ ENV['KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE']
79
+ end
80
+
77
81
  def test_dir
78
82
  ENV['KNAPSACK_PRO_TEST_DIR']
79
83
  end
@@ -63,6 +63,10 @@ module KnapsackPro
63
63
  return KnapsackPro::Config::Env.test_file_list.split(',').map(&:strip)
64
64
  end
65
65
 
66
+ if test_file_list_enabled && KnapsackPro::Config::Env.test_file_list_source_file
67
+ return File.read(KnapsackPro::Config::Env.test_file_list_source_file).split(/\n/)
68
+ end
69
+
66
70
  test_file_paths = Dir.glob(test_file_pattern).uniq
67
71
 
68
72
  excluded_test_file_paths =
@@ -1,3 +1,3 @@
1
1
  module KnapsackPro
2
- VERSION = '2.6.0'
2
+ VERSION = '2.7.0'
3
3
  end
@@ -0,0 +1,6 @@
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
+
@@ -238,6 +238,20 @@ describe KnapsackPro::Config::Env do
238
238
  end
239
239
  end
240
240
 
241
+ describe '.test_file_list_source_file' do
242
+ subject { described_class.test_file_list_source_file }
243
+
244
+ context 'when ENV exists' do
245
+ let(:test_file_list_source_file) { 'spec/fixtures/test_file_list_source_file.txt' }
246
+ before { stub_const("ENV", { 'KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE' => test_file_list_source_file }) }
247
+ it { should eq test_file_list_source_file }
248
+ end
249
+
250
+ context "when ENV doesn't exist" do
251
+ it { should be_nil }
252
+ end
253
+ end
254
+
241
255
  describe '.test_dir' do
242
256
  subject { described_class.test_dir }
243
257
 
@@ -154,5 +154,23 @@ describe KnapsackPro::TestFileFinder do
154
154
  end
155
155
  end
156
156
  end
157
+
158
+ context 'when KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE is defined' do
159
+ let(:test_file_list_source_file) { 'spec/fixtures/test_file_list_source_file.txt' }
160
+
161
+ before do
162
+ stub_const("ENV", { 'KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE' => test_file_list_source_file })
163
+ end
164
+
165
+ it do
166
+ expect(subject).to eq([
167
+ { 'path' => 'spec/test1_spec.rb' },
168
+ { 'path' => 'spec/test2_spec.rb[1]' },
169
+ { 'path' => 'spec/test3_spec.rb[1:2:3:4]' },
170
+ { 'path' => 'spec/test4_spec.rb:4' },
171
+ { 'path' => 'spec/test4_spec.rb:5' },
172
+ ])
173
+ end
174
+ end
157
175
  end
158
176
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knapsack_pro
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.0
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-23 00:00:00.000000000 Z
11
+ date: 2020-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -308,6 +308,7 @@ files:
308
308
  - lib/tasks/salt.rake
309
309
  - lib/tasks/spinach.rake
310
310
  - lib/tasks/test_unit.rake
311
+ - spec/fixtures/test_file_list_source_file.txt
311
312
  - spec/fixtures/vcr_cassettes/api/v1/build_distributions/subset/invalid_test_suite_token.yml
312
313
  - spec/fixtures/vcr_cassettes/api/v1/build_distributions/subset/success.yml
313
314
  - spec/fixtures/vcr_cassettes/api/v1/build_subsets/create/invalid_test_suite_token.yml
@@ -428,6 +429,7 @@ specification_version: 4
428
429
  summary: Knapsack Pro splits tests across parallel CI nodes and ensures each parallel
429
430
  job finish work at a similar time.
430
431
  test_files:
432
+ - spec/fixtures/test_file_list_source_file.txt
431
433
  - spec/fixtures/vcr_cassettes/api/v1/build_distributions/subset/invalid_test_suite_token.yml
432
434
  - spec/fixtures/vcr_cassettes/api/v1/build_distributions/subset/success.yml
433
435
  - spec/fixtures/vcr_cassettes/api/v1/build_subsets/create/invalid_test_suite_token.yml