knapsack 1.18.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +117 -0
- data/CHANGELOG.md +141 -65
- data/README.md +36 -1
- data/knapsack.gemspec +4 -5
- data/lib/knapsack/adapters/minitest_adapter.rb +3 -13
- data/lib/knapsack/adapters/rspec_adapter.rb +5 -2
- data/lib/knapsack/config/env.rb +2 -2
- data/lib/knapsack/distributors/report_distributor.rb +24 -45
- data/lib/knapsack/presenter.rb +9 -6
- data/lib/knapsack/tracker.rb +15 -15
- data/lib/knapsack/version.rb +1 -1
- data/spec/knapsack/adapters/rspec_adapter_spec.rb +5 -5
- data/spec/knapsack/config/env_spec.rb +10 -0
- data/spec/knapsack/distributors/report_distributor_spec.rb +87 -11
- data/spec/knapsack/tracker_spec.rb +7 -1
- data/spec/spec_helper.rb +0 -3
- data/test_examples/fast/shared_examples_test.rb +1 -1
- data/test_examples/fast/spec_test.rb +14 -2
- data/test_examples/test_helper.rb +0 -9
- metadata +19 -35
- data/.travis.yml +0 -116
- data/bin/print_header.sh +0 -5
@@ -48,7 +48,7 @@ describe Knapsack::Tracker do
|
|
48
48
|
|
49
49
|
context 'when test_path not set' do
|
50
50
|
it do
|
51
|
-
expect
|
51
|
+
expect(subject).to be_nil
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -133,6 +133,9 @@ describe Knapsack::Tracker do
|
|
133
133
|
it { expect(tracker.test_files_with_time.keys.size).to eql 2 }
|
134
134
|
it { expect(tracker.test_files_with_time['a_spec.rb']).to be_within(delta).of(0.1) }
|
135
135
|
it { expect(tracker.test_files_with_time['b_spec.rb']).to be_within(delta).of(0.2) }
|
136
|
+
it 'resets test_path after time is measured' do
|
137
|
+
expect(tracker.test_path).to be_nil
|
138
|
+
end
|
136
139
|
end
|
137
140
|
|
138
141
|
context "with Timecop - Timecop shouldn't have impact on measured test time" do
|
@@ -157,6 +160,9 @@ describe Knapsack::Tracker do
|
|
157
160
|
it { expect(tracker.test_files_with_time.keys.size).to eql 2 }
|
158
161
|
it { expect(tracker.test_files_with_time['a_spec.rb']).to be_within(delta).of(0) }
|
159
162
|
it { expect(tracker.test_files_with_time['b_spec.rb']).to be_within(delta).of(0) }
|
163
|
+
it 'resets test_path after time is measured' do
|
164
|
+
expect(tracker.test_path).to be_nil
|
165
|
+
end
|
160
166
|
end
|
161
167
|
end
|
162
168
|
|
data/spec/spec_helper.rb
CHANGED
@@ -16,10 +16,22 @@ describe FakeCalculator do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it '#add' do
|
19
|
-
@calc.add(2, 3)
|
19
|
+
result = @calc.add(2, 3)
|
20
|
+
|
21
|
+
if self.respond_to?(:_)
|
22
|
+
_(result).must_equal 5
|
23
|
+
else
|
24
|
+
result.must_equal 5
|
25
|
+
end
|
20
26
|
end
|
21
27
|
|
22
28
|
it '#mal' do
|
23
|
-
@calc.mal(2, 3)
|
29
|
+
result = @calc.mal(2, 3)
|
30
|
+
|
31
|
+
if self.respond_to?(:_)
|
32
|
+
_(result).must_equal 6
|
33
|
+
else
|
34
|
+
result.must_equal 6
|
35
|
+
end
|
24
36
|
end
|
25
37
|
end
|
@@ -2,15 +2,6 @@ require 'minitest/autorun'
|
|
2
2
|
|
3
3
|
require 'knapsack'
|
4
4
|
|
5
|
-
if RUBY_VERSION == "1.9.3"
|
6
|
-
unless defined? Minitest
|
7
|
-
Minitest = MiniTest
|
8
|
-
end
|
9
|
-
unless defined? Minitest::Test
|
10
|
-
Minitest::Test = MiniTest::Unit::TestCase
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
5
|
Knapsack.tracker.config({
|
15
6
|
enable_time_offset_warning: true,
|
16
7
|
time_offset_in_seconds: 3
|
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.
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ArturT
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -42,36 +42,36 @@ dependencies:
|
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 2.10.0
|
48
45
|
- - "~>"
|
49
46
|
- !ruby/object:Gem::Version
|
50
47
|
version: '3.0'
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 2.10.0
|
51
51
|
type: :development
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
|
-
- - ">="
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: 2.10.0
|
58
55
|
- - "~>"
|
59
56
|
- !ruby/object:Gem::Version
|
60
57
|
version: '3.0'
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 2.10.0
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rspec-its
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '1.
|
67
|
+
version: '1.3'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '1.
|
74
|
+
version: '1.3'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: cucumber
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,20 +114,6 @@ dependencies:
|
|
114
114
|
- - ">="
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: 5.0.0
|
117
|
-
- !ruby/object:Gem::Dependency
|
118
|
-
name: codeclimate-test-reporter
|
119
|
-
requirement: !ruby/object:Gem::Requirement
|
120
|
-
requirements:
|
121
|
-
- - "~>"
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: '0'
|
124
|
-
type: :development
|
125
|
-
prerelease: false
|
126
|
-
version_requirements: !ruby/object:Gem::Requirement
|
127
|
-
requirements:
|
128
|
-
- - "~>"
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
version: '0'
|
131
117
|
- !ruby/object:Gem::Dependency
|
132
118
|
name: pry
|
133
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,14 +134,14 @@ dependencies:
|
|
148
134
|
requirements:
|
149
135
|
- - ">="
|
150
136
|
- !ruby/object:Gem::Version
|
151
|
-
version: 0.
|
137
|
+
version: 0.9.4
|
152
138
|
type: :development
|
153
139
|
prerelease: false
|
154
140
|
version_requirements: !ruby/object:Gem::Requirement
|
155
141
|
requirements:
|
156
142
|
- - ">="
|
157
143
|
- !ruby/object:Gem::Version
|
158
|
-
version: 0.
|
144
|
+
version: 0.9.4
|
159
145
|
description: Parallel tests across CI server nodes based on each test file's time
|
160
146
|
execution. It generates a test time execution report and uses it for future test
|
161
147
|
runs.
|
@@ -163,20 +149,18 @@ email:
|
|
163
149
|
- arturtrzop@gmail.com
|
164
150
|
executables:
|
165
151
|
- knapsack
|
166
|
-
- print_header.sh
|
167
152
|
extensions: []
|
168
153
|
extra_rdoc_files: []
|
169
154
|
files:
|
155
|
+
- ".github/workflows/ruby.yml"
|
170
156
|
- ".gitignore"
|
171
157
|
- ".rspec"
|
172
|
-
- ".travis.yml"
|
173
158
|
- CHANGELOG.md
|
174
159
|
- Gemfile
|
175
160
|
- LICENSE.txt
|
176
161
|
- README.md
|
177
162
|
- Rakefile
|
178
163
|
- bin/knapsack
|
179
|
-
- bin/print_header.sh
|
180
164
|
- docs/images/logos/knapsack-@2.png
|
181
165
|
- docs/images/logos/knapsack-big.png
|
182
166
|
- docs/images/logos/knapsack-logo-@2.png
|
@@ -266,11 +250,11 @@ files:
|
|
266
250
|
- test_examples/fast/unit_test.rb
|
267
251
|
- test_examples/slow/slow_test.rb
|
268
252
|
- test_examples/test_helper.rb
|
269
|
-
homepage: https://github.com/
|
253
|
+
homepage: https://github.com/KnapsackPro/knapsack
|
270
254
|
licenses:
|
271
255
|
- MIT
|
272
256
|
metadata: {}
|
273
|
-
post_install_message:
|
257
|
+
post_install_message:
|
274
258
|
rdoc_options: []
|
275
259
|
require_paths:
|
276
260
|
- lib
|
@@ -278,15 +262,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
278
262
|
requirements:
|
279
263
|
- - ">="
|
280
264
|
- !ruby/object:Gem::Version
|
281
|
-
version:
|
265
|
+
version: '2.2'
|
282
266
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
283
267
|
requirements:
|
284
268
|
- - ">="
|
285
269
|
- !ruby/object:Gem::Version
|
286
270
|
version: '0'
|
287
271
|
requirements: []
|
288
|
-
rubygems_version: 3.
|
289
|
-
signing_key:
|
272
|
+
rubygems_version: 3.2.15
|
273
|
+
signing_key:
|
290
274
|
specification_version: 4
|
291
275
|
summary: Knapsack splits tests across CI nodes and makes sure that tests will run
|
292
276
|
comparable time on each node.
|
data/.travis.yml
DELETED
@@ -1,116 +0,0 @@
|
|
1
|
-
---
|
2
|
-
sudo: false
|
3
|
-
language: ruby
|
4
|
-
rvm:
|
5
|
-
- 1.9.3
|
6
|
-
- 2.0.0
|
7
|
-
- 2.1
|
8
|
-
- 2.2
|
9
|
-
- 2.3
|
10
|
-
- 2.4
|
11
|
-
- 2.5
|
12
|
-
- 2.6
|
13
|
-
addons:
|
14
|
-
code_climate:
|
15
|
-
repo_token: 38686058eed480dd0fcf8bce9015733e0bae88e44e30f4a1ac63df8aec2f86d8
|
16
|
-
before_install:
|
17
|
-
- "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
|
18
|
-
script:
|
19
|
-
# Test for knapsack gem
|
20
|
-
- bin/print_header.sh "Run specs for Knapsack gem"
|
21
|
-
- bundle exec rspec spec
|
22
|
-
|
23
|
-
|
24
|
-
- bin/print_header.sh "------------------------------------------------------"
|
25
|
-
|
26
|
-
|
27
|
-
# Tests for example rspec test suite
|
28
|
-
- bin/print_header.sh "Generate knapsack report"
|
29
|
-
- KNAPSACK_GENERATE_REPORT=true bundle exec rspec --default-path spec_examples --tag focus
|
30
|
-
|
31
|
-
- bin/print_header.sh "Run specs with enabled time offset warning"
|
32
|
-
- bundle exec rspec --default-path spec_examples
|
33
|
-
|
34
|
-
- bin/print_header.sh "Run rake task for the first CI node"
|
35
|
-
- CI_NODE_TOTAL=2 CI_NODE_INDEX=0 KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
|
36
|
-
- bin/print_header.sh "Run rake task for the second CI node"
|
37
|
-
- CI_NODE_TOTAL=2 CI_NODE_INDEX=1 KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
|
38
|
-
|
39
|
-
- bin/print_header.sh "Check passing arguments to rspec. Run only specs with custom_focus tag"
|
40
|
-
- KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake "knapsack:rspec[--tag custom_focus]"
|
41
|
-
- KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bin/knapsack rspec "--tag custom_focus --profile"
|
42
|
-
|
43
|
-
- bin/print_header.sh "Run specs with custom knapsack logger"
|
44
|
-
- CUSTOM_LOGGER=true KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
|
45
|
-
|
46
|
-
- bin/print_header.sh "Run specs for custom knapsack report path"
|
47
|
-
- cp knapsack_rspec_report.json knapsack_custom_rspec_report.json
|
48
|
-
- KNAPSACK_REPORT_PATH="knapsack_custom_rspec_report.json" KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
|
49
|
-
|
50
|
-
- bin/print_header.sh "Run specs when spec file was removed and still exists in knapsack report json"
|
51
|
-
- rm spec_examples/fast/1_spec.rb
|
52
|
-
- KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
|
53
|
-
|
54
|
-
- bin/print_header.sh "Run specs from multiple directories with manually specified test_dir"
|
55
|
-
- KNAPSACK_TEST_DIR=spec_examples KNAPSACK_TEST_FILE_PATTERN="{spec_examples,spec_engine_examples}/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
|
56
|
-
|
57
|
-
|
58
|
-
- bin/print_header.sh "------------------------------------------------------"
|
59
|
-
|
60
|
-
|
61
|
-
# Tests for example minitest test suite
|
62
|
-
- bin/print_header.sh "Generate knapsack report"
|
63
|
-
- KNAPSACK_GENERATE_REPORT=true bundle exec rake test
|
64
|
-
|
65
|
-
- bin/print_header.sh "Run tests with enabled time offset warning"
|
66
|
-
- bundle exec rake test
|
67
|
-
|
68
|
-
- bin/print_header.sh "Run rake task for the first CI node"
|
69
|
-
- CI_NODE_TOTAL=2 CI_NODE_INDEX=0 KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake knapsack:minitest
|
70
|
-
- bin/print_header.sh "Run rake task for the second CI node"
|
71
|
-
- CI_NODE_TOTAL=2 CI_NODE_INDEX=1 KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake knapsack:minitest
|
72
|
-
|
73
|
-
- bin/print_header.sh "Check passing arguments to minitest. Run verbose tests"
|
74
|
-
- KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake "knapsack:minitest[--verbose]"
|
75
|
-
- if [ "$TRAVIS_RUBY_VERSION" == "1.9.3" ]; then KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bin/knapsack minitest "--verbose"; fi
|
76
|
-
- if [ "$TRAVIS_RUBY_VERSION" != "1.9.3" ]; then KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bin/knapsack minitest "--verbose --pride"; fi
|
77
|
-
|
78
|
-
- bin/print_header.sh "Run tests with custom knapsack logger"
|
79
|
-
- CUSTOM_LOGGER=true KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake knapsack:minitest
|
80
|
-
|
81
|
-
- bin/print_header.sh "Run tests for custom knapsack report path"
|
82
|
-
- cp knapsack_minitest_report.json knapsack_custom_minitest_report.json
|
83
|
-
- KNAPSACK_REPORT_PATH="knapsack_custom_minitest_report.json" KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake knapsack:minitest
|
84
|
-
|
85
|
-
- bin/print_header.sh "Run tests when test file was removed and still exists in knapsack report json"
|
86
|
-
- rm test_examples/fast/unit_test.rb
|
87
|
-
- KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake knapsack:minitest
|
88
|
-
|
89
|
-
|
90
|
-
- bin/print_header.sh "------------------------------------------------------"
|
91
|
-
|
92
|
-
|
93
|
-
# Tests for example spinach test suite
|
94
|
-
- bin/print_header.sh "Generate knapsack report"
|
95
|
-
- KNAPSACK_GENERATE_REPORT=true bundle exec spinach -f spinach_examples
|
96
|
-
|
97
|
-
- bin/print_header.sh "Run tests with enabled time offset warning"
|
98
|
-
- bundle exec spinach -f spinach_examples
|
99
|
-
|
100
|
-
- bin/print_header.sh "Run rake task for the first CI node"
|
101
|
-
- CI_NODE_TOTAL=2 CI_NODE_INDEX=0 KNAPSACK_TEST_FILE_PATTERN="spinach_examples/**{,/*/**}/*.feature" bundle exec rake "knapsack:spinach[-f spinach_examples]"
|
102
|
-
- bin/print_header.sh "Run rake task for the second CI node"
|
103
|
-
- CI_NODE_TOTAL=2 CI_NODE_INDEX=1 KNAPSACK_TEST_FILE_PATTERN="spinach_examples/**{,/*/**}/*.feature" bundle exec rake "knapsack:spinach[-f spinach_examples]"
|
104
|
-
|
105
|
-
- bin/print_header.sh "Run tests with custom knapsack logger"
|
106
|
-
- CUSTOM_LOGGER=true KNAPSACK_TEST_FILE_PATTERN="spinach_examples/**{,/*/**}/*.feature" bundle exec rake "knapsack:spinach[-f spinach_examples]"
|
107
|
-
|
108
|
-
- bin/print_header.sh "Run tests for custom knapsack report path"
|
109
|
-
- cp knapsack_spinach_report.json knapsack_custom_spinach_report.json
|
110
|
-
- KNAPSACK_REPORT_PATH="knapsack_custom_spinach_report.json" KNAPSACK_TEST_FILE_PATTERN="spinach_examples/**{,/*/**}/*.feature" bundle exec rake "knapsack:spinach[-f spinach_examples]"
|
111
|
-
|
112
|
-
- bin/print_header.sh "Run tests when test file was removed and still exists in knapsack report json"
|
113
|
-
- rm spinach_examples/scenario1.feature
|
114
|
-
- KNAPSACK_TEST_FILE_PATTERN="spinach_examples/**{,/*/**}/*.feature" bundle exec rake "knapsack:spinach[-f spinach_examples]"
|
115
|
-
notifications:
|
116
|
-
email: false
|
data/bin/print_header.sh
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
echo ==========================================================================================================================
|
4
|
-
echo $1
|
5
|
-
echo ==========================================================================================================================
|