knapsack_pro 0.24.0 → 0.25.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f5d89332f8fbd6085c892ff032cdc245ecf6002
4
- data.tar.gz: d6ed82a6b2a2a4db849ede047366261d558f2254
3
+ metadata.gz: 911de2285757ea2787d872ff9e595910331d0e2c
4
+ data.tar.gz: 990c07a1d06f884849eeb98a904f360e741a33f8
5
5
  SHA512:
6
- metadata.gz: deba77b348cb39a2acf95b538b11421969aa9833fff38209f4ca1be512d2a1f7d5a895dc0bbb177e8351ce876fb9c12f1204e813b3e999d8c9f7a48c9f72183e
7
- data.tar.gz: 255880b403bfa18d332b791d7baf7757d32f60a2b35b67918903c2edd88ee4a159ffc09ab8cf89bcffca95e741929236172935ce8ece69c9f867eb7bfeef6eb5
6
+ metadata.gz: 3830d979ef91be8c88baaa9d79e446750c83bbaea35974ab5331bceac8e02b5dbfd3f05b1ae1834acdeabb39b27d32051a46934da541660a012910eeee5b8511
7
+ data.tar.gz: bc7922ae770633bf1f23c0bbb501df18b5e29cd64b0ddcba51b36e56cea427143200d7ee6c8316edce3534f4950634b7097e4aa90936c2b7c04b3ddeba93e902
data/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  * TODO
4
4
 
5
+ ### 0.25.0
6
+
7
+ * Queue mode retry (remember queue split on retry CI node).
8
+
9
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/22
10
+
11
+ * Fix bug in queue mode with recording test files time execution data. Previously the same test files time execution data where multiple times send to Knapsack Pro API.
12
+
13
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/23
14
+
15
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v0.24.0...v0.25.0
16
+
5
17
  ### 0.24.0
6
18
 
7
19
  * Send client name and version in headers for each request to Knapsack Pro API.
data/README.md CHANGED
@@ -72,6 +72,8 @@ The knapsack_pro has also [queue mode](#queue-mode) to get most optimal test sui
72
72
  - [How queue mode works?](#how-queue-mode-works)
73
73
  - [How to use queue mode?](#how-to-use-queue-mode)
74
74
  - [Additional info about queue mode](#additional-info-about-queue-mode)
75
+ - [Extra configuration for Queue Mode](#extra-configuration-for-queue-mode)
76
+ - [KNAPSACK_PRO_FIXED_QUEUE_SPLIT (remember queue split on retry CI node)](#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node)
75
77
  - [Supported test runners in queue mode](#supported-test-runners-in-queue-mode)
76
78
  - [Extra configuration for CI server](#extra-configuration-for-ci-server)
77
79
  - [Info about ENV variables](#info-about-env-variables)
@@ -331,11 +333,38 @@ The second build should have better optimal test suite split.
331
333
 
332
334
  To avoid this you can specify unique `KNAPSACK_PRO_CI_NODE_BUILD_ID` environment variable for each CI build. This mean that each CI node that is part of particular CI build should have the same value for `KNAPSACK_PRO_CI_NODE_BUILD_ID`.
333
335
 
334
- * Note that in the queue mode you cannot retry the failed CI node with exactly the same subset of tests that were run on the CI node in the first place. It's possible only in regular mode ([read more](#knapsack_pro_fixed_test_suite_splite-test-suite-split-based-on-seed)).
336
+ * Note that in the Queue Mode by default you cannot retry the failed CI node with exactly the same subset of tests that were run on the CI node in the first place. It's possible in regular mode ([read more](#knapsack_pro_fixed_test_suite_splite-test-suite-split-based-on-seed)). If you want to have similar behavior in Queue Mode you need to explicitly [enable it](#knapsack_pro_fixed_queue_split-remember-queue-split-on-retry-ci-node).
335
337
 
336
- Let's say one of the CI nodes failed and you retry just this single CI node while other CI nodes are still running. The retried CI node will be connected to the queue consumed by running CI nodes.
338
+ By default the Queue Mode works this way:
337
339
 
338
- In the case when there are no running CI nodes then your retried CI node will initialize a new queue and it will run whole test suite from the queue because there will be no other CI nodes running connected to the queue. The order of tests on retried CI node will be different than on the first run.
340
+ * If you retry the failed build and your all CI nodes will start a new build then there will be a new dynamic test suite split across CI nodes.
341
+
342
+ * Let's say one of the CI nodes failed and you retry just this single CI node while other CI nodes are still running. The retried CI node will be connected to the queue consumed by still running CI nodes.
343
+
344
+ * In the case when there are no running CI nodes then your retried CI node will initialize a new queue and it will run whole test suite from the queue because there will be no other CI nodes running connected to the queue. The order of tests on retried CI node will be different than on the first run.
345
+
346
+ ### Extra configuration for Queue Mode
347
+
348
+ #### KNAPSACK_PRO_FIXED_QUEUE_SPLIT (remember queue split on retry CI node)
349
+
350
+ * `KNAPSACK_PRO_FIXED_QUEUE_SPLIT=false` (default)
351
+
352
+ By default, the fixed queue split is off. It means when you will run tests for the same commit hash and a total number of nodes and for the same branch then each time the queue will be generated dynamically and CI nodes will fetch from Knapsack Pro API the test files in a dynamic way. This is default because it gives the most optimal test suite split for the whole test build across all CI nodes even when you retry the same build on CI many times.
353
+
354
+ * `KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true`
355
+
356
+ You can enable fixed queue split in order to remember the test suite split across CI nodes when you used Queue Mode.
357
+
358
+ It means when you run test suite or just retry single CI node again for the same commit hash and a total number of nodes and for the same branch
359
+ then you will get exactly the same test suite split as it was when you run the build for the first time.
360
+
361
+ Thanks to that when tests on one of your node failed you can retry the node with exactly the same subset of tests that were run on the node in the first place.
362
+
363
+ Note when fixed queue split is enabled then you can run tests in a dynamic way only once for particular commit hash and a total number of nodes and for the same branch.
364
+
365
+ When Knapsack Pro API server has already information about previous queue split then the information will be used. You will see at the beginning of the knapsack command the log with info that queue name is nil because it was not generated this time. You will get the list of all test files that were executed on the particular CI node in the past.
366
+
367
+ [knapsack_pro] {"queue_name"=>nil, "test_files"=>[{"path"=>"spec/foo_spec.rb", "time_execution"=>1.23}]}
339
368
 
340
369
  ### Supported test runners in queue mode
341
370
 
@@ -9,6 +9,7 @@ module KnapsackPro
9
9
  endpoint_path: '/v1/queues/queue',
10
10
  http_method: :post,
11
11
  request_hash: {
12
+ :fixed_queue_split => KnapsackPro::Config::Env.fixed_queue_split,
12
13
  :can_initialize_queue => args.fetch(:can_initialize_queue),
13
14
  :commit_hash => args.fetch(:commit_hash),
14
15
  :branch => args.fetch(:branch),
@@ -99,6 +99,10 @@ module KnapsackPro
99
99
  ENV.fetch('KNAPSACK_PRO_FIXED_TEST_SUITE_SPLIT', true)
100
100
  end
101
101
 
102
+ def fixed_queue_split
103
+ ENV.fetch('KNAPSACK_PRO_FIXED_QUEUE_SPLIT', false)
104
+ end
105
+
102
106
  def test_suite_token
103
107
  required_env('KNAPSACK_PRO_TEST_SUITE_TOKEN')
104
108
  end
@@ -7,6 +7,8 @@ module KnapsackPro
7
7
 
8
8
  def self.save_subset_queue_to_file
9
9
  test_files = KnapsackPro.tracker.to_a
10
+ KnapsackPro.tracker.reset!
11
+
10
12
  subset_queue_id = KnapsackPro::Config::Env.subset_queue_id
11
13
 
12
14
  FileUtils.mkdir_p(queue_path)
@@ -11,4 +11,3 @@ module KnapsackPro
11
11
  end
12
12
  end
13
13
  end
14
-
@@ -1,3 +1,3 @@
1
1
  module KnapsackPro
2
- VERSION = '0.24.0'
2
+ VERSION = '0.25.0'
3
3
  end
@@ -1,5 +1,6 @@
1
1
  describe KnapsackPro::Client::API::V1::Queues do
2
2
  describe '.queue' do
3
+ let(:fixed_queue_split) { double }
3
4
  let(:can_initialize_queue) { double }
4
5
  let(:commit_hash) { double }
5
6
  let(:branch) { double }
@@ -18,6 +19,10 @@ describe KnapsackPro::Client::API::V1::Queues do
18
19
  )
19
20
  end
20
21
 
22
+ before do
23
+ expect(KnapsackPro::Config::Env).to receive(:fixed_queue_split).and_return(fixed_queue_split)
24
+ end
25
+
21
26
  it do
22
27
  node_build_id = double
23
28
  expect(KnapsackPro::Config::Env).to receive(:ci_node_build_id).and_return(node_build_id)
@@ -27,6 +32,7 @@ describe KnapsackPro::Client::API::V1::Queues do
27
32
  endpoint_path: '/v1/queues/queue',
28
33
  http_method: :post,
29
34
  request_hash: {
35
+ fixed_queue_split: fixed_queue_split,
30
36
  can_initialize_queue: can_initialize_queue,
31
37
  commit_hash: commit_hash,
32
38
  branch: branch,
@@ -373,6 +373,20 @@ describe KnapsackPro::Config::Env do
373
373
  end
374
374
  end
375
375
 
376
+ describe '.fixed_queue_split' do
377
+ subject { described_class.fixed_queue_split }
378
+
379
+ context 'when ENV exists' do
380
+ before { stub_const("ENV", { 'KNAPSACK_PRO_FIXED_QUEUE_SPLIT' => true }) }
381
+ it { should eq true }
382
+ end
383
+
384
+ context "when ENV doesn't exist" do
385
+ before { stub_const("ENV", {}) }
386
+ it { should be false }
387
+ end
388
+ end
389
+
376
390
  describe '.test_suite_token' do
377
391
  subject { described_class.test_suite_token }
378
392
 
@@ -20,7 +20,8 @@ describe KnapsackPro::Report do
20
20
  before do
21
21
  test_files = [{path: fake_path}]
22
22
  tracker = instance_double(KnapsackPro::Tracker, to_a: test_files)
23
- expect(KnapsackPro).to receive(:tracker).and_return(tracker)
23
+ expect(KnapsackPro).to receive(:tracker).twice.and_return(tracker)
24
+ expect(tracker).to receive(:reset!)
24
25
 
25
26
  subset_queue_id = 'fake-subset-queue-id'
26
27
  expect(KnapsackPro::Config::Env).to receive(:subset_queue_id).and_return(subset_queue_id)
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: 0.24.0
4
+ version: 0.25.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-28 00:00:00.000000000 Z
11
+ date: 2017-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake