knapsack_pro 0.26.0 → 0.27.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +19 -1
- data/circle.yml +1 -1
- data/lib/knapsack_pro/report.rb +9 -5
- data/lib/knapsack_pro/version.rb +1 -1
- data/spec/knapsack_pro/report_spec.rb +45 -46
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aeedb148388f2fda48884dbd34b294419fb55711
|
4
|
+
data.tar.gz: 43a1a930c3e5a6703719d38a7dfff0ac3131fed8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf278d4eecf850091463ad6ae7591e91c6993e7e82aa0a0d5b0f21beb6c0b25ef03ec742bb9e116b0b89861e52fa40be64aafd8d6e403459294ffae6cc7aec03
|
7
|
+
data.tar.gz: 7cf8746554c01f34b7a6570f7d952574bcd819cae080244596d99d29df5133468874071310be3018b834a6d052a9683c48bea5d111cef162d682843b0fa2c41c
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
* TODO
|
4
4
|
|
5
|
+
### 0.27.0
|
6
|
+
|
7
|
+
* Save build subset to API even when no test files were executed on CI node. Add warnings to notify why the test files were not executed on CI node in particular mode: regular or queue mode.
|
8
|
+
|
9
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v0.26.0...v0.27.0
|
10
|
+
|
5
11
|
### 0.26.0
|
6
12
|
|
7
13
|
* Add info how to allow FakeWeb to connect with Knapsack Pro API in install rake task.
|
data/README.md
CHANGED
@@ -108,6 +108,8 @@ The knapsack_pro has also [queue mode](#queue-mode) to get most optimal test sui
|
|
108
108
|
- [What data is sent to your servers?](#what-data-is-sent-to-your-servers)
|
109
109
|
- [How is that data secured?](#how-is-that-data-secured)
|
110
110
|
- [Who has access to the data?](#who-has-access-to-the-data)
|
111
|
+
- [Why when I use Queue Mode for RSpec and test fails then I see multiple times info about failed test in RSpec result?](#why-when-i-use-queue-mode-for-rspec-and-test-fails-then-i-see-multiple-times-info-about-failed-test-in-rspec-result)
|
112
|
+
- [Does in Queue Mode the RSpec is initialized many times that causes Rails load over and over again?](#does-in-queue-mode-the-rspec-is-initialized-many-times-that-causes-rails-load-over-and-over-again)
|
111
113
|
- [Gem tests](#gem-tests)
|
112
114
|
- [Spec](#spec)
|
113
115
|
- [Contributing](#contributing)
|
@@ -325,7 +327,9 @@ that should be executed. Thanks to that each CI node will finish tests at the sa
|
|
325
327
|
|
326
328
|
### How to use queue mode?
|
327
329
|
|
328
|
-
Please use
|
330
|
+
Please use different API token for queue mode than for regular mode.
|
331
|
+
|
332
|
+
Use this command to run queue mode:
|
329
333
|
|
330
334
|
bundle exec rake knapsack_pro:queue:rspec
|
331
335
|
|
@@ -338,6 +342,9 @@ The second build should have better optimal test suite split.
|
|
338
342
|
|
339
343
|
### Additional info about queue mode
|
340
344
|
|
345
|
+
* You should use different API token for queue mode than for regular mode to avoid problem with test suite split in case you would like to go back to regular mode.
|
346
|
+
There might be some cached test suite splits for git commits you run in past for API token you used in queue mode because of the [flag `KNAPSACK_PRO_FIXED_TEST_SUITE_SPLIT=true` for regular mode which is default](#knapsack_pro_fixed_test_suite_splite-test-suite-split-based-on-seed).
|
347
|
+
|
341
348
|
* If you are not using one of [supported CI providers](#supported-ci-providers) then please note that knapsack_pro gem doesn't know what is CI build ID in order to generated queue for particular CI build. This may result in two different CI builds taking tests from the same queue when CI builds are running at the same time against the same git commit.
|
342
349
|
|
343
350
|
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`.
|
@@ -820,6 +827,17 @@ I’m the only admin so I can preview data in case you need help with debugging
|
|
820
827
|
When you sign in to your user dashboard then you can preview data for recent 100 builds on CI. If the test file paths are encrypted then you only see hashes for test file paths.
|
821
828
|
You need to [decrypt](#how-to-debug-test-file-names) them locally on your machine to find out what each test file hash is.
|
822
829
|
|
830
|
+
### Why when I use Queue Mode for RSpec and test fails then I see multiple times info about failed test in RSpec result?
|
831
|
+
|
832
|
+
RSpec collects information about failed tests and presents it at the end of RSpec result.
|
833
|
+
When you use Queue Mode then knapack_pro does multiple requests to Knapsack Pro API and fetches a few test files to execute.
|
834
|
+
This means RSpec will remember failed tests so far and it will present them at the end of each executed test subset.
|
835
|
+
You can see the list of all failed test files at the end of knapack_pro queue mode command.
|
836
|
+
|
837
|
+
### Does in Queue Mode the RSpec is initialized many times that causes Rails load over and over again?
|
838
|
+
|
839
|
+
No. In Queue Mode the RSpec configuration is updated every time when knapsack_pro gem gets a new set of test files from the Knapsack Pro API and it looks in knapsack_pro output like RSpec was loaded many times but in fact, it loads your project environment only once.
|
840
|
+
|
823
841
|
## Gem tests
|
824
842
|
|
825
843
|
### Spec
|
data/circle.yml
CHANGED
data/lib/knapsack_pro/report.rb
CHANGED
@@ -2,6 +2,11 @@ module KnapsackPro
|
|
2
2
|
class Report
|
3
3
|
def self.save
|
4
4
|
test_files = KnapsackPro.tracker.to_a
|
5
|
+
|
6
|
+
if test_files.empty?
|
7
|
+
KnapsackPro.logger.info("No test files were executed on this CI node. When you use knapsack_pro regular mode then probably reason might be very narrowed tests list - you run only tests with specified tag and there are fewer test files with the tag than node total number.")
|
8
|
+
end
|
9
|
+
|
5
10
|
create_build_subset(test_files)
|
6
11
|
end
|
7
12
|
|
@@ -29,15 +34,14 @@ module KnapsackPro
|
|
29
34
|
test_files += report
|
30
35
|
end
|
31
36
|
|
37
|
+
if test_files.empty?
|
38
|
+
KnapsackPro.logger.info("No test files were executed on this CI node. When you use knapsack_pro queue mode then probably reason might be that CI node was started after the test files from the queue were already executed by other CI nodes. That is why this CI node has no test files to execute.")
|
39
|
+
end
|
40
|
+
|
32
41
|
create_build_subset(test_files)
|
33
42
|
end
|
34
43
|
|
35
44
|
def self.create_build_subset(test_files)
|
36
|
-
if test_files.empty?
|
37
|
-
KnapsackPro.logger.info("Didn't save time execution report on API server because there are no test files matching criteria on this node. Probably reason might be very narrowed tests list - you run only tests with specified tag and there are fewer test files with the tag than node total number.")
|
38
|
-
return
|
39
|
-
end
|
40
|
-
|
41
45
|
repository_adapter = KnapsackPro::RepositoryAdapterInitiator.call
|
42
46
|
test_files = KnapsackPro::Utils.unsymbolize(test_files)
|
43
47
|
encrypted_test_files = KnapsackPro::Crypto::Encryptor.call(test_files)
|
data/lib/knapsack_pro/version.rb
CHANGED
@@ -3,7 +3,7 @@ describe KnapsackPro::Report do
|
|
3
3
|
subject { described_class.save }
|
4
4
|
|
5
5
|
it do
|
6
|
-
test_files = double
|
6
|
+
test_files = [double]
|
7
7
|
tracker = instance_double(KnapsackPro::Tracker, to_a: test_files)
|
8
8
|
expect(KnapsackPro).to receive(:tracker).and_return(tracker)
|
9
9
|
expect(described_class).to receive(:create_build_subset).with(test_files)
|
@@ -77,53 +77,40 @@ describe KnapsackPro::Report do
|
|
77
77
|
describe '.create_build_subset' do
|
78
78
|
subject { described_class.create_build_subset(test_files) }
|
79
79
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
80
|
+
before do
|
81
|
+
commit_hash = double
|
82
|
+
branch = double
|
83
|
+
repository_adapter = instance_double(KnapsackPro::RepositoryAdapters::EnvAdapter, commit_hash: commit_hash, branch: branch)
|
84
|
+
expect(KnapsackPro::RepositoryAdapterInitiator).to receive(:call).and_return(repository_adapter)
|
85
|
+
|
86
|
+
unsymbolize_test_files = double
|
87
|
+
expect(KnapsackPro::Utils).to receive(:unsymbolize).with(test_files).and_return(unsymbolize_test_files)
|
88
|
+
|
89
|
+
encrypted_test_files = double
|
90
|
+
expect(KnapsackPro::Crypto::Encryptor).to receive(:call).with(unsymbolize_test_files).and_return(encrypted_test_files)
|
91
|
+
|
92
|
+
node_total = double
|
93
|
+
node_index = double
|
94
|
+
expect(KnapsackPro::Config::Env).to receive(:ci_node_total).and_return(node_total)
|
95
|
+
expect(KnapsackPro::Config::Env).to receive(:ci_node_index).and_return(node_index)
|
96
|
+
|
97
|
+
action = double
|
98
|
+
expect(KnapsackPro::Client::API::V1::BuildSubsets).to receive(:create).with({
|
99
|
+
commit_hash: commit_hash,
|
100
|
+
branch: branch,
|
101
|
+
node_total: node_total,
|
102
|
+
node_index: node_index,
|
103
|
+
test_files: encrypted_test_files,
|
104
|
+
}).and_return(action)
|
105
|
+
|
106
|
+
connection = instance_double(KnapsackPro::Client::Connection, success?: success?, errors?: errors?)
|
107
|
+
expect(KnapsackPro::Client::Connection).to receive(:new).with(action).and_return(connection).and_return(connection)
|
108
|
+
|
109
|
+
response = double
|
110
|
+
expect(connection).to receive(:call).and_return(response)
|
89
111
|
end
|
90
112
|
|
91
|
-
|
92
|
-
let(:test_files) { [double] }
|
93
|
-
|
94
|
-
before do
|
95
|
-
commit_hash = double
|
96
|
-
branch = double
|
97
|
-
repository_adapter = instance_double(KnapsackPro::RepositoryAdapters::EnvAdapter, commit_hash: commit_hash, branch: branch)
|
98
|
-
expect(KnapsackPro::RepositoryAdapterInitiator).to receive(:call).and_return(repository_adapter)
|
99
|
-
|
100
|
-
unsymbolize_test_files = double
|
101
|
-
expect(KnapsackPro::Utils).to receive(:unsymbolize).with(test_files).and_return(unsymbolize_test_files)
|
102
|
-
|
103
|
-
encrypted_test_files = double
|
104
|
-
expect(KnapsackPro::Crypto::Encryptor).to receive(:call).with(unsymbolize_test_files).and_return(encrypted_test_files)
|
105
|
-
|
106
|
-
node_total = double
|
107
|
-
node_index = double
|
108
|
-
expect(KnapsackPro::Config::Env).to receive(:ci_node_total).and_return(node_total)
|
109
|
-
expect(KnapsackPro::Config::Env).to receive(:ci_node_index).and_return(node_index)
|
110
|
-
|
111
|
-
action = double
|
112
|
-
expect(KnapsackPro::Client::API::V1::BuildSubsets).to receive(:create).with({
|
113
|
-
commit_hash: commit_hash,
|
114
|
-
branch: branch,
|
115
|
-
node_total: node_total,
|
116
|
-
node_index: node_index,
|
117
|
-
test_files: encrypted_test_files,
|
118
|
-
}).and_return(action)
|
119
|
-
|
120
|
-
connection = instance_double(KnapsackPro::Client::Connection, success?: success?, errors?: errors?)
|
121
|
-
expect(KnapsackPro::Client::Connection).to receive(:new).with(action).and_return(connection).and_return(connection)
|
122
|
-
|
123
|
-
response = double
|
124
|
-
expect(connection).to receive(:call).and_return(response)
|
125
|
-
end
|
126
|
-
|
113
|
+
shared_examples_for 'create_build_subset method' do
|
127
114
|
context 'when success' do
|
128
115
|
let(:success?) { true }
|
129
116
|
|
@@ -156,5 +143,17 @@ describe KnapsackPro::Report do
|
|
156
143
|
it { subject }
|
157
144
|
end
|
158
145
|
end
|
146
|
+
|
147
|
+
context "when test files doesn't exist" do
|
148
|
+
let(:test_files) { [] }
|
149
|
+
|
150
|
+
it_behaves_like 'create_build_subset method'
|
151
|
+
end
|
152
|
+
|
153
|
+
context 'when test files exists' do
|
154
|
+
let(:test_files) { [double] }
|
155
|
+
|
156
|
+
it_behaves_like 'create_build_subset method'
|
157
|
+
end
|
159
158
|
end
|
160
159
|
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: 0.
|
4
|
+
version: 0.27.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-02-
|
11
|
+
date: 2017-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|