knapsack 1.3.0 → 1.3.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 +8 -0
- data/README.md +4 -0
- data/lib/knapsack/config/tracker.rb +1 -1
- data/lib/knapsack/tracker.rb +0 -2
- data/lib/knapsack/version.rb +1 -1
- data/spec/knapsack/config/tracker_spec.rb +29 -2
- data/spec/knapsack/tracker_spec.rb +9 -18
- data/spec/support/env_helper.rb +13 -0
- data/spec/support/{mocks → fakes}/cucumber.rb +0 -0
- data/spec/support/{mocks → fakes}/minitest.rb +0 -0
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3792c60ac290034623012572800ec6f0785dca5
|
4
|
+
data.tar.gz: e5a54f8845f9461dabab4b6a5c4a58852c23b624
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d32a7b3290080f0e9fd3d33b8b9be720118773fd64aea1ddcd9f680894cc53cf33ef2b760772984b28698f5de7d554ec3af31fb78f6ea898b20e324b8a2f95cc
|
7
|
+
data.tar.gz: f04e7db28903d5aed5a88beed25db026c9fcfc03da9f769bde58c32bc797962073a28e7b61094e1423eadde5515d11f9a9ce2a62ab01a5bbd0bf72073127f491
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -179,6 +179,10 @@ Commit generated report `knapsack_rspec_report.json`, `knapsack_cucumber_report.
|
|
179
179
|
|
180
180
|
This report should be updated only after you add a lot of new slow tests or you change existing ones which causes a big time execution difference between CI nodes. Either way, you will get time offset warning at the end of the rspec/cucumber/minitest results which reminds you when it’s a good time to regenerate the knapsack report.
|
181
181
|
|
182
|
+
`KNAPSACK_GENERATE_REPORT` is truthy when `"true"` or `0`. All other values are falsy, though
|
183
|
+
[`"false"`, and `1` are semantically
|
184
|
+
preferrable](https://en.wikipedia.org/wiki/True_and_false_(commands)).
|
185
|
+
|
182
186
|
#### Adding or removing tests
|
183
187
|
|
184
188
|
There is no need to regenerate the report every time when you add/remove test file. If you remove a test file then Knapsack will ignore its entry in report. In case when you add a new file and it doesn't already exist in report, the test file will be assigned to one of the CI node.
|
data/lib/knapsack/tracker.rb
CHANGED
data/lib/knapsack/version.rb
CHANGED
@@ -13,8 +13,35 @@ describe Knapsack::Config::Tracker do
|
|
13
13
|
subject { described_class.generate_report }
|
14
14
|
|
15
15
|
context 'when ENV exists' do
|
16
|
-
|
17
|
-
|
16
|
+
it 'should be true when KNAPSACK_GENERATE_REPORT=true' do
|
17
|
+
with_env 'KNAPSACK_GENERATE_REPORT' => 'true' do
|
18
|
+
expect(subject).to eq(true)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should be true when KNAPSACK_GENERATE_REPORT=0' do
|
23
|
+
with_env 'KNAPSACK_GENERATE_REPORT' => '0' do
|
24
|
+
expect(subject).to eq(true)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should be false when KNAPSACK_GENERATE_REPORT is ""' do
|
29
|
+
with_env 'KNAPSACK_GENERATE_REPORT' => '' do
|
30
|
+
expect(subject).to eq(false)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should be false when KNAPSACK_GENERATE_REPORT is "false"' do
|
35
|
+
with_env 'KNAPSACK_GENERATE_REPORT' => 'false' do
|
36
|
+
expect(subject).to eq(false)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should be false when KNAPSACK_GENERATE_REPORT is not "true" or "0"' do
|
41
|
+
with_env 'KNAPSACK_GENERATE_REPORT' => '1' do
|
42
|
+
expect(subject).to eq(false)
|
43
|
+
end
|
44
|
+
end
|
18
45
|
end
|
19
46
|
|
20
47
|
context "when ENV doesn't exist" do
|
@@ -9,12 +9,8 @@ describe Knapsack::Tracker do
|
|
9
9
|
it_behaves_like 'default trakcer attributes'
|
10
10
|
|
11
11
|
describe '#config' do
|
12
|
-
before do
|
13
|
-
stub_const("ENV", { 'KNAPSACK_GENERATE_REPORT' => generate_report })
|
14
|
-
end
|
15
|
-
|
16
12
|
context 'when passed options' do
|
17
|
-
let(:generate_report) { true }
|
13
|
+
let(:generate_report) { 'true' }
|
18
14
|
let(:opts) do
|
19
15
|
{
|
20
16
|
enable_time_offset_warning: false,
|
@@ -23,12 +19,14 @@ describe Knapsack::Tracker do
|
|
23
19
|
end
|
24
20
|
|
25
21
|
it do
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
22
|
+
with_env 'KNAPSACK_GENERATE_REPORT' => generate_report do
|
23
|
+
expect(tracker.config(opts)).to eql({
|
24
|
+
enable_time_offset_warning: false,
|
25
|
+
time_offset_in_seconds: 30,
|
26
|
+
generate_report: true,
|
27
|
+
fake: true
|
28
|
+
})
|
29
|
+
end
|
32
30
|
end
|
33
31
|
end
|
34
32
|
|
@@ -121,13 +119,6 @@ describe Knapsack::Tracker do
|
|
121
119
|
let(:test_paths) { ['a_spec.rb', 'b_spec.rb'] }
|
122
120
|
let(:delta) { 0.02 }
|
123
121
|
|
124
|
-
shared_examples 'test tracker' do
|
125
|
-
it { expect(tracker.global_time).to be_within(delta).of(0.3) }
|
126
|
-
it { expect(tracker.test_files_with_time.keys.size).to eql 2 }
|
127
|
-
it { expect(tracker.test_files_with_time['a_spec.rb']).to be_within(delta).of(0.1) }
|
128
|
-
it { expect(tracker.test_files_with_time['b_spec.rb']).to be_within(delta).of(0.2) }
|
129
|
-
end
|
130
|
-
|
131
122
|
context 'without Timecop' do
|
132
123
|
before do
|
133
124
|
test_paths.each_with_index do |test_path, index|
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knapsack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ArturT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -202,8 +202,9 @@ files:
|
|
202
202
|
- spec/knapsack/tracker_spec.rb
|
203
203
|
- spec/knapsack_spec.rb
|
204
204
|
- spec/spec_helper.rb
|
205
|
-
- spec/support/
|
206
|
-
- spec/support/
|
205
|
+
- spec/support/env_helper.rb
|
206
|
+
- spec/support/fakes/cucumber.rb
|
207
|
+
- spec/support/fakes/minitest.rb
|
207
208
|
- spec/support/shared_examples/adapter.rb
|
208
209
|
- spec_examples/fast/1_spec.rb
|
209
210
|
- spec_examples/fast/2_spec.rb
|
@@ -243,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
243
244
|
version: '0'
|
244
245
|
requirements: []
|
245
246
|
rubyforge_project:
|
246
|
-
rubygems_version: 2.4.
|
247
|
+
rubygems_version: 2.4.5.1
|
247
248
|
signing_key:
|
248
249
|
specification_version: 4
|
249
250
|
summary: Knapsack splits tests across CI nodes and makes sure that tests will run
|
@@ -267,6 +268,7 @@ test_files:
|
|
267
268
|
- spec/knapsack/tracker_spec.rb
|
268
269
|
- spec/knapsack_spec.rb
|
269
270
|
- spec/spec_helper.rb
|
270
|
-
- spec/support/
|
271
|
-
- spec/support/
|
271
|
+
- spec/support/env_helper.rb
|
272
|
+
- spec/support/fakes/cucumber.rb
|
273
|
+
- spec/support/fakes/minitest.rb
|
272
274
|
- spec/support/shared_examples/adapter.rb
|