judges 0.53.2 → 0.53.3
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/features/update.feature +1 -2
- data/judges.gemspec +1 -1
- data/lib/judges/commands/update.rb +2 -1
- data/lib/judges/judge.rb +3 -3
- data/lib/judges.rb +1 -1
- data/test/commands/test_update.rb +22 -1
- data/test/test_judge.rb +0 -24
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30206b0fdcdc39f9e4fcbb9aa44cc6377aa63d707600c912813e39dbcc08649f
|
4
|
+
data.tar.gz: a90eb5d5bd333faf95484e7f6c114422831245c17175a05c0f82a2ed33caf896
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f52536f181c8172e6a869c8ce0dfb01b30f62fe31d64c9bfaf775d7bc47bd5e57b8efd7808afd8641e2f888b8447e3899181b5ca2c54aff4c9314345de31afb1
|
7
|
+
data.tar.gz: b51aa8226d7494c97521392fd6e1b2aac6bbb8b60a762af72f0b0ec93d09827e29a36a39ba8a166facba7a047704706576582a0b53fdcfe701671037491958a6
|
data/features/update.feature
CHANGED
@@ -63,7 +63,7 @@ Feature: Update
|
|
63
63
|
n.type = 'second'
|
64
64
|
"""
|
65
65
|
Then I run bin/judges with "--verbose update --quiet --lifetime 2 --timeout 1 --max-cycles 5 . simple.fb"
|
66
|
-
Then Stdout contains "Update completed in 2 cycle(s), did
|
66
|
+
Then Stdout contains "Update completed in 2 cycle(s), did 3i/0d/3a"
|
67
67
|
And Exit code is zero
|
68
68
|
|
69
69
|
Scenario: Use options from a file
|
@@ -93,7 +93,6 @@ Feature: Update
|
|
93
93
|
"""
|
94
94
|
Then I run bin/judges with "--verbose update --timeout 1 --quiet . foo.fb"
|
95
95
|
Then Stdout contains "execution expired"
|
96
|
-
Then Stdout contains "judge timed out after"
|
97
96
|
Then Stdout contains "1 judge(s) processed"
|
98
97
|
Then Stdout contains "Update completed in 1 cycle(s), did 0i/0d/0a"
|
99
98
|
And Exit code is zero
|
data/judges.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
10
10
|
s.required_ruby_version = '>=3.2'
|
11
11
|
s.name = 'judges'
|
12
|
-
s.version = '0.53.
|
12
|
+
s.version = '0.53.3'
|
13
13
|
s.license = 'MIT'
|
14
14
|
s.summary = 'Command-Line Tool for a Factbase'
|
15
15
|
s.description =
|
@@ -215,6 +215,7 @@ class Judges::Update
|
|
215
215
|
def one_judge(opts, fb, judge, global, options, errors)
|
216
216
|
local = {}
|
217
217
|
start = Time.now
|
218
|
+
fb = Factbase::Tallied.new(fb)
|
218
219
|
begin
|
219
220
|
if opts['lifetime'] && Time.now - @start > opts['lifetime']
|
220
221
|
throw :"👎 The '#{judge.name}' judge skipped, no time left"
|
@@ -224,8 +225,8 @@ class Judges::Update
|
|
224
225
|
end
|
225
226
|
rescue Timeout::Error, Timeout::ExitException => e
|
226
227
|
errors << "Judge #{judge.name} stopped by timeout after #{start.ago}: #{e.message}"
|
227
|
-
throw :"👎 The '#{judge.name}' judge timed out after #{start.ago}: #{e.message}"
|
228
228
|
end
|
229
|
+
fb.churn
|
229
230
|
end
|
230
231
|
|
231
232
|
def include?(opts, name)
|
data/lib/judges/judge.rb
CHANGED
@@ -53,10 +53,10 @@ class Judges::Judge
|
|
53
53
|
# @param [Hash] global Global configuration options shared across all judges
|
54
54
|
# @param [Hash] local Local configuration options specific to this judge
|
55
55
|
# @param [Judges::Options] options Command-line options object
|
56
|
-
# @return [
|
56
|
+
# @return [nil] Nothing
|
57
57
|
# @raise [RuntimeError] If the lib directory doesn't exist, the script can't be loaded, or execution fails
|
58
58
|
def run(fb, global, local, options)
|
59
|
-
$fb =
|
59
|
+
$fb = fb
|
60
60
|
$judge = File.basename(@dir)
|
61
61
|
$options = options
|
62
62
|
$loog = @loog
|
@@ -76,7 +76,7 @@ class Judges::Judge
|
|
76
76
|
raise "Can't load '#{s}'" unless File.exist?(s)
|
77
77
|
elapsed(@loog, good: "#{$judge} completed", level: Logger::INFO) do
|
78
78
|
load(s, true)
|
79
|
-
|
79
|
+
nil
|
80
80
|
# rubocop:disable Lint/RescueException
|
81
81
|
rescue Exception => e
|
82
82
|
# rubocop:enable Lint/RescueException
|
data/lib/judges.rb
CHANGED
@@ -55,7 +55,28 @@ class TestUpdate < Minitest::Test
|
|
55
55
|
Dir.mktmpdir do |d|
|
56
56
|
save_it(File.join(d, 'foo/foo.rb'), '$fb.insert.foo = 1; sleep 10')
|
57
57
|
file = File.join(d, 'base.fb')
|
58
|
-
Judges::Update.new(Loog::NULL).run(
|
58
|
+
Judges::Update.new(Loog::NULL).run(
|
59
|
+
{ 'timeout' => 0.1, 'quiet' => true, 'fail-fast' => true },
|
60
|
+
[d, file]
|
61
|
+
)
|
62
|
+
fb = Factbase.new
|
63
|
+
fb.import(File.binread(file))
|
64
|
+
xml = Nokogiri::XML.parse(Factbase::ToXML.new(fb).xml)
|
65
|
+
refute_empty(xml.xpath('/fb/f[foo]'), xml)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_reports_changes_from_slow_judge
|
70
|
+
Dir.mktmpdir do |d|
|
71
|
+
save_it(File.join(d, 'foo/foo.rb'), '$fb.insert.foo = 1; sleep 10')
|
72
|
+
file = File.join(d, 'base.fb')
|
73
|
+
log = Loog::Buffer.new
|
74
|
+
Judges::Update.new(Loog::Tee.new(log, Loog::NULL)).run(
|
75
|
+
{ 'timeout' => 0.1, 'quiet' => true, 'fail-fast' => true },
|
76
|
+
[d, file]
|
77
|
+
)
|
78
|
+
assert_includes(log.to_s, 'did 1i/0d/1a')
|
79
|
+
assert_includes(log.to_s, 'Update completed in 1 cycle(s), did 1i/0d/1a')
|
59
80
|
fb = Factbase.new
|
60
81
|
fb.import(File.binread(file))
|
61
82
|
xml = Nokogiri::XML.parse(Factbase::ToXML.new(fb).xml)
|
data/test/test_judge.rb
CHANGED
@@ -25,30 +25,6 @@ class TestJudge < Minitest::Test
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
def test_counts_churn
|
29
|
-
Dir.mktmpdir do |d|
|
30
|
-
save_it(File.join(d, "#{File.basename(d)}.rb"), '$fb.insert.foo = 42')
|
31
|
-
judge = Judges::Judge.new(d, nil, Loog::NULL)
|
32
|
-
fb = Factbase.new
|
33
|
-
c = judge.run(fb, {}, {}, {})
|
34
|
-
assert_equal(1, c.inserted)
|
35
|
-
assert_equal(0, c.deleted)
|
36
|
-
assert_equal(1, c.added)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_counts_churn_after_txn
|
41
|
-
Dir.mktmpdir do |d|
|
42
|
-
save_it(File.join(d, "#{File.basename(d)}.rb"), '$fb.txn { |fbt| fbt.insert.foo = 42 }')
|
43
|
-
judge = Judges::Judge.new(d, nil, Loog::NULL)
|
44
|
-
fb = Factbase.new
|
45
|
-
c = judge.run(fb, {}, {}, {})
|
46
|
-
assert_equal(1, c.inserted)
|
47
|
-
assert_equal(0, c.deleted)
|
48
|
-
assert_equal(1, c.added)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
28
|
def test_run_isolated
|
53
29
|
Dir.mktmpdir do |d|
|
54
30
|
save_it(File.join(d, "#{File.basename(d)}.rb"), '$fb.insert')
|