knapsack_pro 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +5 -1
- data/lib/knapsack_pro/report.rb +8 -1
- data/lib/knapsack_pro/version.rb +1 -1
- data/spec/knapsack_pro/report_spec.rb +61 -45
- 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: c1b41d8fa8f1fbc4132753ff2bed7bd753fa5e70
|
4
|
+
data.tar.gz: 2274a0c7340c7095e1a118a232025df0f54d6995
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 767bf32a466b2049bdc802d4080da52c80387c375f6ad7c4162eb3042b40e6210f0cfd05543a984fc549c9d2f353c72191e4ef8554651da9a9d5676dd9db72d4
|
7
|
+
data.tar.gz: e16b193127919aa1132fc55746e7ae444b446d6dda38170d59bc8246a9a8f6d5f1d0965e0fca66093ef83aa72475638a195bd588f687d519a877dca0976fb350
|
data/CHANGELOG.md
CHANGED
@@ -2,10 +2,21 @@
|
|
2
2
|
|
3
3
|
* TODO
|
4
4
|
|
5
|
+
### 0.7.1
|
6
|
+
|
7
|
+
* Don't fail when there are no tests to run on a node
|
8
|
+
|
9
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/issues/7
|
10
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/pull/9
|
11
|
+
|
12
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v0.7.0...v0.7.1
|
13
|
+
|
5
14
|
### 0.7.0
|
6
15
|
|
7
16
|
* Add support for older cucumber versions than 1.3
|
8
17
|
|
18
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/issues/5
|
19
|
+
|
9
20
|
https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v0.6.1...v0.7.0
|
10
21
|
|
11
22
|
### 0.6.1
|
data/README.md
CHANGED
@@ -97,7 +97,7 @@ And then execute:
|
|
97
97
|
$ bundle
|
98
98
|
|
99
99
|
|
100
|
-
Add this
|
100
|
+
Add this lines at the bottom of `Rakefile` if your project has it:
|
101
101
|
|
102
102
|
```ruby
|
103
103
|
KnapsackPro.load_tasks if defined?(KnapsackPro)
|
@@ -106,9 +106,13 @@ KnapsackPro.load_tasks if defined?(KnapsackPro)
|
|
106
106
|
If you are using [VCR gem](https://github.com/vcr/vcr) then add Knapsack Pro API subdomain to [ignore hosts](https://www.relishapp.com/vcr/vcr/v/2-9-3/docs/configuration/ignore-request):
|
107
107
|
|
108
108
|
```ruby
|
109
|
+
# spec/spec_helper.rb or wherever is your VCR configuration
|
110
|
+
|
109
111
|
VCR.configure do |config|
|
110
112
|
config.ignore_hosts 'localhost', '127.0.0.1', '0.0.0.0', 'api.knapsackpro.com'
|
111
113
|
end
|
114
|
+
|
115
|
+
WebMock.disable_net_connect!(:allow => 'api.knapsackpro.com') if defined?(WebMock)
|
112
116
|
```
|
113
117
|
|
114
118
|
## How to set up
|
data/lib/knapsack_pro/report.rb
CHANGED
@@ -1,13 +1,20 @@
|
|
1
1
|
module KnapsackPro
|
2
2
|
class Report
|
3
3
|
def self.save
|
4
|
+
test_files = KnapsackPro.tracker.to_a
|
5
|
+
|
6
|
+
if test_files.empty?
|
7
|
+
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.")
|
8
|
+
return
|
9
|
+
end
|
10
|
+
|
4
11
|
repository_adapter = KnapsackPro::RepositoryAdapterInitiator.call
|
5
12
|
action = KnapsackPro::Client::API::V1::BuildSubsets.create(
|
6
13
|
commit_hash: repository_adapter.commit_hash,
|
7
14
|
branch: repository_adapter.branch,
|
8
15
|
node_total: KnapsackPro::Config::Env.ci_node_total,
|
9
16
|
node_index: KnapsackPro::Config::Env.ci_node_index,
|
10
|
-
test_files:
|
17
|
+
test_files: test_files,
|
11
18
|
)
|
12
19
|
connection = KnapsackPro::Client::Connection.new(action)
|
13
20
|
response = connection.call
|
data/lib/knapsack_pro/version.rb
CHANGED
@@ -3,66 +3,82 @@ describe KnapsackPro::Report do
|
|
3
3
|
subject { described_class.save }
|
4
4
|
|
5
5
|
before do
|
6
|
-
commit_hash = double
|
7
|
-
branch = double
|
8
|
-
repository_adapter = instance_double(KnapsackPro::RepositoryAdapters::EnvAdapter, commit_hash: commit_hash, branch: branch)
|
9
|
-
expect(KnapsackPro::RepositoryAdapterInitiator).to receive(:call).and_return(repository_adapter)
|
10
|
-
|
11
|
-
node_total = double
|
12
|
-
node_index = double
|
13
|
-
expect(KnapsackPro::Config::Env).to receive(:ci_node_total).and_return(node_total)
|
14
|
-
expect(KnapsackPro::Config::Env).to receive(:ci_node_index).and_return(node_index)
|
15
|
-
|
16
|
-
test_files = double
|
17
6
|
tracker = instance_double(KnapsackPro::Tracker, to_a: test_files)
|
18
7
|
expect(KnapsackPro).to receive(:tracker).and_return(tracker)
|
8
|
+
end
|
19
9
|
|
20
|
-
|
21
|
-
|
22
|
-
commit_hash: commit_hash,
|
23
|
-
branch: branch,
|
24
|
-
node_total: node_total,
|
25
|
-
node_index: node_index,
|
26
|
-
test_files: test_files,
|
27
|
-
}).and_return(action)
|
28
|
-
|
29
|
-
connection = instance_double(KnapsackPro::Client::Connection, success?: success?, errors?: errors?)
|
30
|
-
expect(KnapsackPro::Client::Connection).to receive(:new).with(action).and_return(connection).and_return(connection)
|
10
|
+
context "when test files doesn't exist" do
|
11
|
+
let(:test_files) { [] }
|
31
12
|
|
32
|
-
|
33
|
-
|
13
|
+
it do
|
14
|
+
logger = instance_double(Logger)
|
15
|
+
expect(KnapsackPro).to receive(:logger).and_return(logger)
|
16
|
+
expect(logger).to receive(:info).with("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.")
|
17
|
+
subject
|
18
|
+
end
|
34
19
|
end
|
35
20
|
|
36
|
-
context 'when
|
37
|
-
let(:
|
21
|
+
context 'when test files exists' do
|
22
|
+
let(:test_files) { [double] }
|
38
23
|
|
39
|
-
|
40
|
-
|
24
|
+
before do
|
25
|
+
commit_hash = double
|
26
|
+
branch = double
|
27
|
+
repository_adapter = instance_double(KnapsackPro::RepositoryAdapters::EnvAdapter, commit_hash: commit_hash, branch: branch)
|
28
|
+
expect(KnapsackPro::RepositoryAdapterInitiator).to receive(:call).and_return(repository_adapter)
|
41
29
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
30
|
+
node_total = double
|
31
|
+
node_index = double
|
32
|
+
expect(KnapsackPro::Config::Env).to receive(:ci_node_total).and_return(node_total)
|
33
|
+
expect(KnapsackPro::Config::Env).to receive(:ci_node_index).and_return(node_index)
|
34
|
+
|
35
|
+
action = double
|
36
|
+
expect(KnapsackPro::Client::API::V1::BuildSubsets).to receive(:create).with({
|
37
|
+
commit_hash: commit_hash,
|
38
|
+
branch: branch,
|
39
|
+
node_total: node_total,
|
40
|
+
node_index: node_index,
|
41
|
+
test_files: test_files,
|
42
|
+
}).and_return(action)
|
43
|
+
|
44
|
+
connection = instance_double(KnapsackPro::Client::Connection, success?: success?, errors?: errors?)
|
45
|
+
expect(KnapsackPro::Client::Connection).to receive(:new).with(action).and_return(connection).and_return(connection)
|
46
|
+
|
47
|
+
response = double
|
48
|
+
expect(connection).to receive(:call).and_return(response)
|
47
49
|
end
|
48
50
|
|
49
|
-
context 'when
|
50
|
-
let(:
|
51
|
+
context 'when success' do
|
52
|
+
let(:success?) { true }
|
53
|
+
|
54
|
+
context 'when response has errors' do
|
55
|
+
let(:errors?) { true }
|
56
|
+
|
57
|
+
it do
|
58
|
+
expect {
|
59
|
+
subject
|
60
|
+
}.to raise_error(ArgumentError)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context 'when response has no errors' do
|
65
|
+
let(:errors?) { false }
|
51
66
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
67
|
+
it do
|
68
|
+
logger = instance_double(Logger)
|
69
|
+
expect(KnapsackPro).to receive(:logger).and_return(logger)
|
70
|
+
expect(logger).to receive(:info).with('Saved time execution report on API server.')
|
71
|
+
subject
|
72
|
+
end
|
57
73
|
end
|
58
74
|
end
|
59
|
-
end
|
60
75
|
|
61
|
-
|
62
|
-
|
63
|
-
|
76
|
+
context 'when failure' do
|
77
|
+
let(:success?) { false }
|
78
|
+
let(:errors?) { nil }
|
64
79
|
|
65
|
-
|
80
|
+
it { subject }
|
81
|
+
end
|
66
82
|
end
|
67
83
|
end
|
68
84
|
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.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ArturT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|