knapsack_pro 1.0.1 → 1.0.2
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/lib/knapsack_pro/adapters/base_adapter.rb +0 -10
- data/lib/knapsack_pro/adapters/rspec_adapter.rb +0 -16
- data/lib/knapsack_pro/runners/queue/minitest_runner.rb +1 -0
- data/lib/knapsack_pro/runners/queue/rspec_runner.rb +5 -0
- data/lib/knapsack_pro/tracker.rb +10 -0
- data/lib/knapsack_pro/version.rb +1 -1
- data/spec/knapsack_pro/adapters/base_adapter_spec.rb +0 -22
- data/spec/knapsack_pro/adapters/rspec_adapter_spec.rb +0 -24
- data/spec/knapsack_pro/runners/queue/minitest_runner_spec.rb +4 -1
- data/spec/knapsack_pro/runners/queue/rspec_runner_spec.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8608ce6cc56baf7be7b0be2a09c8ecbb0e4f5aa2e0e80ce796284aba9d2fc9bf
|
4
|
+
data.tar.gz: b249d1169e73ecf370d055169189e158b0d0b2cee526540a07eb13b92bb12f6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5868feda23ff81b692ba3053876c3036379e373f77e9004460b29691f18beb35ccbccd32175434f2b98ca8bb973a321f28cd4ac096f346e034a664534b82ccb1
|
7
|
+
data.tar.gz: 76efa329752999c325af61c9479f5b496719b84aac9e0b0de2b8ab4838ebd2303a3ba05951e54adcf1f5eb32d552fb482ac2b9e6a836d0a8780ff1687f9d3384
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
|
3
3
|
* TODO
|
4
4
|
|
5
|
+
### 1.0.2
|
6
|
+
|
7
|
+
* Track time execution of all tests assigned to CI node in Queue Mode even when they did not run due syntax error or being pending/empty in test run.
|
8
|
+
|
9
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/pull/71
|
10
|
+
|
11
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v1.0.1...v1.0.2
|
12
|
+
|
5
13
|
### 1.0.1
|
6
14
|
|
7
15
|
* Fix bug with not being able to set log level via logger wrapper.
|
@@ -31,23 +31,13 @@ module KnapsackPro
|
|
31
31
|
raise NotImplementedError
|
32
32
|
end
|
33
33
|
|
34
|
-
def bind_save_queue_report
|
35
|
-
raise NotImplementedError
|
36
|
-
end
|
37
|
-
|
38
|
-
def bind_tracker_reset
|
39
|
-
raise NotImplementedError
|
40
|
-
end
|
41
|
-
|
42
34
|
def bind_before_queue_hook
|
43
35
|
raise NotImplementedError
|
44
36
|
end
|
45
37
|
|
46
38
|
def bind_queue_mode
|
47
|
-
bind_tracker_reset
|
48
39
|
bind_before_queue_hook
|
49
40
|
bind_time_tracker
|
50
|
-
bind_save_queue_report
|
51
41
|
end
|
52
42
|
end
|
53
43
|
end
|
@@ -51,22 +51,6 @@ module KnapsackPro
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
def bind_save_queue_report
|
55
|
-
::RSpec.configure do |config|
|
56
|
-
config.after(:suite) do
|
57
|
-
KnapsackPro::Report.save_subset_queue_to_file
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def bind_tracker_reset
|
63
|
-
::RSpec.configure do |config|
|
64
|
-
config.before(:suite) do
|
65
|
-
KnapsackPro.tracker.reset!
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
54
|
def bind_before_queue_hook
|
71
55
|
::RSpec.configure do |config|
|
72
56
|
config.before(:suite) do
|
@@ -69,6 +69,9 @@ module KnapsackPro
|
|
69
69
|
subset_queue_id = KnapsackPro::Config::EnvGenerator.set_subset_queue_id
|
70
70
|
ENV['KNAPSACK_PRO_SUBSET_QUEUE_ID'] = subset_queue_id
|
71
71
|
|
72
|
+
KnapsackPro.tracker.reset!
|
73
|
+
KnapsackPro.tracker.set_prerun_tests(test_file_paths)
|
74
|
+
|
72
75
|
all_test_file_paths += test_file_paths
|
73
76
|
cli_args = args + test_file_paths
|
74
77
|
|
@@ -82,6 +85,8 @@ module KnapsackPro
|
|
82
85
|
|
83
86
|
KnapsackPro::Hooks::Queue.call_after_subset_queue
|
84
87
|
|
88
|
+
KnapsackPro::Report.save_subset_queue_to_file
|
89
|
+
|
85
90
|
return {
|
86
91
|
status: :next,
|
87
92
|
runner: runner,
|
data/lib/knapsack_pro/tracker.rb
CHANGED
@@ -30,6 +30,16 @@ module KnapsackPro
|
|
30
30
|
@current_test_path.sub(/^\.\//, '')
|
31
31
|
end
|
32
32
|
|
33
|
+
def set_prerun_tests(test_file_paths)
|
34
|
+
test_file_paths.each do |test_file_path|
|
35
|
+
# Set a default time for test file
|
36
|
+
# in case when the test file will not be run
|
37
|
+
# due syntax error or being pending.
|
38
|
+
# The time is required by Knapsack Pro API.
|
39
|
+
@test_files_with_time[test_file_path] = 0.1
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
33
43
|
def to_a
|
34
44
|
test_files = []
|
35
45
|
@test_files_with_time.each do |path, time_execution|
|
data/lib/knapsack_pro/version.rb
CHANGED
@@ -48,10 +48,8 @@ describe KnapsackPro::Adapters::BaseAdapter do
|
|
48
48
|
let(:queue_recording_enabled?) { true }
|
49
49
|
|
50
50
|
before do
|
51
|
-
allow(subject).to receive(:bind_tracker_reset)
|
52
51
|
allow(subject).to receive(:bind_before_queue_hook)
|
53
52
|
allow(subject).to receive(:bind_time_tracker)
|
54
|
-
allow(subject).to receive(:bind_save_queue_report)
|
55
53
|
end
|
56
54
|
|
57
55
|
it do
|
@@ -59,17 +57,13 @@ describe KnapsackPro::Adapters::BaseAdapter do
|
|
59
57
|
expect(KnapsackPro).to receive(:logger).and_return(logger)
|
60
58
|
expect(logger).to receive(:debug).with('Test suite time execution queue recording enabled.')
|
61
59
|
end
|
62
|
-
it { expect(subject).to receive(:bind_tracker_reset) }
|
63
60
|
it { expect(subject).to receive(:bind_before_queue_hook) }
|
64
61
|
it { expect(subject).to receive(:bind_time_tracker) }
|
65
|
-
it { expect(subject).to receive(:bind_save_queue_report) }
|
66
62
|
end
|
67
63
|
|
68
64
|
context 'when recording disabled' do
|
69
|
-
it { expect(subject).not_to receive(:bind_tracker_reset) }
|
70
65
|
it { expect(subject).not_to receive(:bind_time_tracker) }
|
71
66
|
it { expect(subject).not_to receive(:bind_save_report) }
|
72
|
-
it { expect(subject).not_to receive(:bind_save_queue_report) }
|
73
67
|
it { expect(subject).not_to receive(:bind_before_queue_hook) }
|
74
68
|
end
|
75
69
|
end
|
@@ -90,22 +84,6 @@ describe KnapsackPro::Adapters::BaseAdapter do
|
|
90
84
|
end
|
91
85
|
end
|
92
86
|
|
93
|
-
describe '#bind_save_queue_report' do
|
94
|
-
it do
|
95
|
-
expect {
|
96
|
-
subject.bind_save_queue_report
|
97
|
-
}.to raise_error(NotImplementedError)
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
describe '#bind_tracker_reset' do
|
102
|
-
it do
|
103
|
-
expect {
|
104
|
-
subject.bind_tracker_reset
|
105
|
-
}.to raise_error(NotImplementedError)
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
87
|
describe '#bind_before_queue_hook' do
|
110
88
|
it do
|
111
89
|
expect {
|
@@ -115,30 +115,6 @@ describe KnapsackPro::Adapters::RSpecAdapter do
|
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
|
-
describe '#bind_save_queue_report' do
|
119
|
-
it do
|
120
|
-
expect(config).to receive(:after).with(:suite).and_yield
|
121
|
-
expect(::RSpec).to receive(:configure).and_yield(config)
|
122
|
-
|
123
|
-
expect(KnapsackPro::Report).to receive(:save_subset_queue_to_file)
|
124
|
-
|
125
|
-
subject.bind_save_queue_report
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
describe '#bind_tracker_reset' do
|
130
|
-
it do
|
131
|
-
expect(config).to receive(:before).with(:suite).and_yield
|
132
|
-
expect(::RSpec).to receive(:configure).and_yield(config)
|
133
|
-
|
134
|
-
tracker = instance_double(KnapsackPro::Tracker)
|
135
|
-
expect(KnapsackPro).to receive(:tracker).and_return(tracker)
|
136
|
-
expect(tracker).to receive(:reset!)
|
137
|
-
|
138
|
-
subject.bind_tracker_reset
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
118
|
describe '#bind_before_queue_hook' do
|
143
119
|
it do
|
144
120
|
expect(config).to receive(:before).with(:suite).and_yield
|
@@ -106,7 +106,10 @@ describe KnapsackPro::Runners::Queue::MinitestRunner do
|
|
106
106
|
|
107
107
|
expect(ENV).to receive(:[]=).with('KNAPSACK_PRO_SUBSET_QUEUE_ID', subset_queue_id)
|
108
108
|
|
109
|
-
|
109
|
+
tracker = instance_double(KnapsackPro::Tracker)
|
110
|
+
expect(KnapsackPro).to receive(:tracker).twice.and_return(tracker)
|
111
|
+
expect(tracker).to receive(:reset!)
|
112
|
+
expect(tracker).to receive(:set_prerun_tests).with(test_file_paths)
|
110
113
|
|
111
114
|
# .minitest_run
|
112
115
|
expect(described_class).to receive(:require).with('./a_test.rb')
|
@@ -138,6 +138,11 @@ describe KnapsackPro::Runners::Queue::RSpecRunner do
|
|
138
138
|
|
139
139
|
expect(ENV).to receive(:[]=).with('KNAPSACK_PRO_SUBSET_QUEUE_ID', subset_queue_id)
|
140
140
|
|
141
|
+
tracker = instance_double(KnapsackPro::Tracker)
|
142
|
+
expect(KnapsackPro).to receive(:tracker).twice.and_return(tracker)
|
143
|
+
expect(tracker).to receive(:reset!)
|
144
|
+
expect(tracker).to receive(:set_prerun_tests).with(test_file_paths)
|
145
|
+
|
141
146
|
options = double
|
142
147
|
expect(RSpec::Core::ConfigurationOptions).to receive(:new).with([
|
143
148
|
'--example-arg', 'example-value',
|
@@ -152,6 +157,8 @@ describe KnapsackPro::Runners::Queue::RSpecRunner do
|
|
152
157
|
expect(described_class).to receive(:rspec_clear_examples)
|
153
158
|
|
154
159
|
expect(KnapsackPro::Hooks::Queue).to receive(:call_after_subset_queue)
|
160
|
+
|
161
|
+
expect(KnapsackPro::Report).to receive(:save_subset_queue_to_file)
|
155
162
|
end
|
156
163
|
|
157
164
|
context 'when exit code is zero' do
|
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: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ArturT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|