knapsack_pro 3.3.0 → 3.4.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
  SHA256:
3
- metadata.gz: '099f5615951240d49a1087c5ebbb89169f161a35bfc2f0dc4ea7de80f188e3f9'
4
- data.tar.gz: d4939ae9f79b358038147cd5f9a40dcee95760f1fa17d84314fc183cfad722a7
3
+ metadata.gz: 23f9763190e37db931c1457e71dccca8ef1f9d6fcd99fe50b28b1571366833cc
4
+ data.tar.gz: d93d4734cf560ecc77ae06959562c1fcf1ac61489671f374c3fc8a3e2f2e040a
5
5
  SHA512:
6
- metadata.gz: adfe023532b15509a4bc1cb993c3d259ffde7df5078c76cf7cf392ec5ce8b6f8eb322ca093e77eadf3ec0c8eba4748ccd0f5ccf6666fd3559eb3bd1a55c0893a
7
- data.tar.gz: 072f8d809aa4600ed5f4987f39946cd0030faac8e4ca9bae08cf38680c3aef24226744023d5c6a74aa53b76c2fe481c35692b2f33b98ba9a8d85d17ddeb990c6
6
+ metadata.gz: 254b42538b48ef6483e2479e4db2f5619389df83496443b6924a6953b2d49485563615888864cb0ec3696cb36e2f0338873294ffa559461076ba4033929134bc
7
+ data.tar.gz: 310f6d28741d8631bba32b205e0f4a86a47b775f0c8f732a272ecf1151c88b2ca46e1975657f5fa5dcaaefefbaa2b2668b9e65e876addf838aa4013e83770723
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Change Log
2
2
 
3
+ ### 3.4.0
4
+
5
+ * Update documentation and code because the encryption feature does not work with the RSpec split by examples feature
6
+
7
+ Update docs: https://github.com/KnapsackPro/knapsack_pro-ruby/pull/176
8
+
9
+ Update code: https://github.com/KnapsackPro/knapsack_pro-ruby/pull/177
10
+
11
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v3.3.1...v3.4.0
12
+
13
+ ### 3.3.1
14
+
15
+ * Skip loading a test file path for Minitest in Queue Mode when it does not exist on the disk
16
+
17
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/174
18
+
19
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v3.3.0...v3.3.1
20
+
3
21
  ### 3.3.0
4
22
 
5
23
  * Show a JSON report file content when RSpec fails during a dry run
data/README.md CHANGED
@@ -97,7 +97,6 @@ The knapsack_pro has also [queue mode](#queue-mode) to get an optimal test suite
97
97
  - [Test file names encryption](#test-file-names-encryption)
98
98
  - [How to enable test file names encryption?](#how-to-enable-test-file-names-encryption)
99
99
  - [How to debug test file names?](#how-to-debug-test-file-names)
100
- - [Preview encrypted RSpec test example paths?](#preview-encrypted-rspec-test-example-paths)
101
100
  - [How to enable branch names encryption?](#how-to-enable-branch-names-encryption)
102
101
  - [How to debug branch names?](#how-to-debug-branch-names)
103
102
  - [Supported CI providers](#supported-ci-providers)
@@ -719,72 +718,61 @@ This is optional way of using knapsack_pro when you don't want to add it to `Gem
719
718
 
720
719
  ### Test file names encryption
721
720
 
722
- knapsack_pro gem collects information about you test file names and time execution. Those data are stored on KnapsackPro.com server.
723
- If your test file names or branch names are sensitive data then you can encrypt the names before sending them to KnapsackPro.com API.
721
+ The knapsack_pro gem collects information about your test file names, branch names, and execution times. The data are stored on the KnapsackPro.com server.
722
+ If your test file names or branch names are considered sensitive data, then you can encrypt the data before sending it to the KnapsackPro.com API.
724
723
 
725
- By default, encryption is disabled because knapsack_pro can use your test files names to prepare better test suite split when the time execution data are not yet collected on KnapsackPro.com server.
726
- When you will enable test file names encryption then your first test suite split may be less optimal than it could be.
724
+ Encryption is disabled by default because the knapsack_pro gem uses your test file names to prepare a better test suite split when the execution time data are not collected on the KnapsackPro.com server yet.
725
+ When you enable the encryption, then your first test suite split may not be optimal.
727
726
 
728
- Each test file name is generated with `Digest::SHA2.hexdigest` method and 64 chars salt.
727
+ Each test file name is generated with the `Digest::SHA2.hexdigest` method and 64 chars salt.
729
728
 
730
- Before you enable test file encryption please ensure you are using fresh API key. You should not use the same API key for encrypted and non encrypted test suite.
731
- You can generate API key for your test suite in [your dashboard](https://knapsackpro.com).
729
+ Before you enable encryption, please ensure you are using a fresh API token. Do not use the same API token for the encrypted and non-encrypted test suite. You can generate an API token for your test suite in the [user dashboard](https://knapsackpro.com/dashboard).
732
730
 
733
- Next step is to generate salt which will be used to encrypt test files or branch names.
731
+ The next step is to generate a salt to encrypt test files or branch names with it.
734
732
 
735
733
  ```bash
736
734
  bundle exec rake knapsack_pro:salt
737
735
  ```
738
736
 
739
- Add to your CI server generated environment variable `KNAPSACK_PRO_SALT`.
737
+ Add the salt to your CI server as the `KNAPSACK_PRO_SALT` environment variable.
740
738
 
741
739
  #### How to enable test file names encryption?
742
740
 
743
- You need to add environment variable `KNAPSACK_PRO_TEST_FILES_ENCRYPTED=true` to your CI server.
741
+ You need to add the `KNAPSACK_PRO_TEST_FILES_ENCRYPTED=true` environment variable to your CI server.
744
742
 
745
743
  #### How to debug test file names?
746
744
 
747
- If you need to check what is the encryption hash for particular test file you can check that with the rake task:
745
+ If you need to check what is the hash value for a particular test file you can check that with the rake task:
748
746
 
749
747
  ```bash
750
- KNAPSACK_PRO_SALT=xxx bundle exec rake knapsack_pro:encrypted_test_file_names[rspec]
748
+ KNAPSACK_PRO_SALT=xxx bundle exec rake "knapsack_pro:encrypted_test_file_names[rspec]"
751
749
  ```
752
750
 
753
- You can pass the name of test runner like `rspec`, `minitest`, `test_unit`, `cucumber`, `spinach` as argument to rake task.
754
-
755
- ##### Preview encrypted RSpec test example paths?
756
-
757
- If you split RSpec tests by test examples (by individual `it`) you can preview encrypted test example paths this way:
758
-
759
- ```bash
760
- KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES=true \
761
- KNAPSACK_PRO_SALT=xxx \
762
- bundle exec rake knapsack_pro:encrypted_test_file_names[rspec]
763
- ```
751
+ You can pass the name of a test runner like `rspec`, `minitest`, `test_unit`, `cucumber`, `spinach` as an argument to the rake task.
764
752
 
765
753
  #### How to enable branch names encryption?
766
754
 
767
- You need to add environment variable `KNAPSACK_PRO_BRANCH_ENCRYPTED=true` to your CI server.
755
+ You need to add the `KNAPSACK_PRO_BRANCH_ENCRYPTED=true` environment variable to your CI server.
768
756
 
769
- Note: there are a few branch names that won't be encrypted because we use them as fallback branches on Knapsack Pro API side to determine time execution for test files during split for newly created branches.
757
+ Note a few branch names won't be encrypted because we use them as fallback branches on the Knapsack Pro API side to determine time execution for test files during split for newly created branches.
770
758
 
771
759
  * develop
772
760
  * development
773
761
  * dev
774
762
  * master
775
763
  * staging
776
- * [see full list of encryption excluded branch names](https://github.com/KnapsackPro/knapsack_pro-ruby/blob/master/lib/knapsack_pro/crypto/branch_encryptor.rb#L4)
764
+ * [see the full list of excluded branch names from encryption](https://github.com/KnapsackPro/knapsack_pro-ruby/blob/master/lib/knapsack_pro/crypto/branch_encryptor.rb#L4)
777
765
 
778
766
  #### How to debug branch names?
779
767
 
780
- If you need to check what is the encryption hash for particular branch then use the rake task:
768
+ If you need to check what is the hash for a particular branch, then use the rake task:
781
769
 
782
770
  ```bash
783
771
  # show all local branches and respective hashes
784
772
  $ KNAPSACK_PRO_SALT=xxx bundle exec rake knapsack_pro:encrypted_branch_names
785
773
 
786
- # show hash for branch provided as argument to rake task
787
- $ KNAPSACK_PRO_SALT=xxx bundle exec rake knapsack_pro:encrypted_branch_names[not-encrypted-branch-name]
774
+ # show the hash for a branch name passed as an argument to the rake task
775
+ $ KNAPSACK_PRO_SALT=xxx bundle exec rake "knapsack_pro:encrypted_branch_names[not-encrypted-branch-name]"
788
776
  ```
789
777
 
790
778
  ### Supported CI providers
@@ -91,7 +91,13 @@ module KnapsackPro
91
91
 
92
92
  def self.minitest_run(runner, test_file_paths, args)
93
93
  test_file_paths.each do |test_file_path|
94
- require "./#{test_file_path}"
94
+ relative_test_file_path = "./#{test_file_path}"
95
+
96
+ if File.exist?(relative_test_file_path)
97
+ require relative_test_file_path
98
+ else
99
+ KnapsackPro.logger.warn("Skip loading the #{relative_test_file_path} test file path because it does not exist on the disk. Most likely, the test file path should not be loaded. The test file path could have been recorded during the previous CI build when the knapsack_pro gem could not attribute the execution time of a test to a correct test file path. For instance, you have shared examples in your test suite, and the knapsack_pro gem could not correctly determine for which test file path they were executed. In such a case, the test file path should not be loaded because the actual test cases will be executed by loading a correct test file path. You can ignore this warning.")
100
+ end
95
101
  end
96
102
 
97
103
  # duplicate args because Minitest modifies args
@@ -1,3 +1,3 @@
1
1
  module KnapsackPro
2
- VERSION = '3.3.0'
2
+ VERSION = '3.4.0'
3
3
  end
@@ -19,15 +19,8 @@ namespace :knapsack_pro do
19
19
  raise('Provide adapter name like rspec, minitest, test_unit, cucumber, spinach')
20
20
  end
21
21
 
22
- test_files =
23
- if adapter_class == KnapsackPro::Adapters::RSpecAdapter && KnapsackPro::Config::Env.rspec_split_by_test_examples?
24
- detector = KnapsackPro::TestCaseDetectors::RSpecTestExampleDetector.new
25
- detector.generate_json_report
26
- detector.test_file_example_paths
27
- else
28
- test_file_pattern = KnapsackPro::TestFilePattern.call(adapter_class)
29
- KnapsackPro::TestFileFinder.call(test_file_pattern)
30
- end
22
+ test_file_pattern = KnapsackPro::TestFilePattern.call(adapter_class)
23
+ test_files = KnapsackPro::TestFileFinder.call(test_file_pattern)
31
24
 
32
25
  test_file_names = []
33
26
  test_files.each do |t|
@@ -100,7 +100,7 @@ describe KnapsackPro::Runners::Queue::MinitestRunner do
100
100
  end
101
101
 
102
102
  context 'when test files exist' do
103
- let(:test_file_paths) { ['a_test.rb', 'b_test.rb'] }
103
+ let(:test_file_paths) { ['a_test.rb', 'b_test.rb', 'fake_path_test.rb'] }
104
104
 
105
105
  before do
106
106
  subset_queue_id = 'fake-subset-queue-id'
@@ -114,8 +114,12 @@ describe KnapsackPro::Runners::Queue::MinitestRunner do
114
114
  expect(tracker).to receive(:set_prerun_tests).with(test_file_paths)
115
115
 
116
116
  # .minitest_run
117
+ expect(File).to receive(:exist?).with('./a_test.rb').and_return(true)
118
+ expect(File).to receive(:exist?).with('./b_test.rb').and_return(true)
119
+ expect(File).to receive(:exist?).with('./fake_path_test.rb').and_return(false)
117
120
  expect(described_class).to receive(:require).with('./a_test.rb')
118
121
  expect(described_class).to receive(:require).with('./b_test.rb')
122
+ expect(described_class).to_not receive(:require).with('./fake_path_test.rb')
119
123
 
120
124
  expect(Minitest).to receive(:run).with(args).and_return(is_tests_green)
121
125
 
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: 3.3.0
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-11 00:00:00.000000000 Z
11
+ date: 2022-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake