zold 0.32.0 → 0.32.1
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/Gemfile.lock +1 -1
- data/lib/zold/version.rb +1 -1
- data/zold.gemspec +1 -1
- metadata +2 -168
- data/.0pdd.yml +0 -12
- data/.gitattributes +0 -9
- data/.github/typos.toml +0 -11
- data/.github/workflows/actionlint.yml +0 -25
- data/.github/workflows/bashate.yml +0 -25
- data/.github/workflows/codecov.yml +0 -27
- data/.github/workflows/copyrights.yml +0 -15
- data/.github/workflows/hadolint.yml +0 -14
- data/.github/workflows/markdown-lint.yml +0 -19
- data/.github/workflows/pdd.yml +0 -19
- data/.github/workflows/rake.yml +0 -31
- data/.github/workflows/reuse.yml +0 -19
- data/.github/workflows/shellcheck.yml +0 -19
- data/.github/workflows/typos.yml +0 -21
- data/.github/workflows/xcop.yml +0 -15
- data/.github/workflows/yamllint.yml +0 -19
- data/.gitignore +0 -15
- data/.pdd +0 -7
- data/.rubocop.yml +0 -66
- data/.ruby-version +0 -1
- data/.rultor.yml +0 -41
- data/cucumber.yml +0 -6
- data/features/cli.feature +0 -18
- data/features/gem_package.feature +0 -28
- data/features/step_definitions/steps.rb +0 -67
- data/features/support/env.rb +0 -9
- data/fixtures/448b451bc62e8e16.z +0 -1005
- data/fixtures/id_rsa +0 -51
- data/fixtures/id_rsa-2 +0 -51
- data/fixtures/id_rsa-2.pub +0 -1
- data/fixtures/id_rsa.pub +0 -1
- data/fixtures/keys/1.pub +0 -1
- data/fixtures/keys/2 +0 -51
- data/fixtures/keys/2.pub +0 -1
- data/fixtures/merge/asserts.rb +0 -20
- data/fixtures/merge/id_rsa +0 -51
- data/fixtures/merge/id_rsa.pub +0 -1
- data/fixtures/merge/into_no_wallet/assert.rb +0 -8
- data/fixtures/merge/into_no_wallet/copies/0123456789abcdef/1.zc +0 -6
- data/fixtures/merge/into_no_wallet/copies/0123456789abcdef/scores.zc +0 -1
- data/fixtures/merge/into_no_wallet/opts +0 -1
- data/fixtures/merge/legacy_negatives_stay/0123456789abcdef.z +0 -6
- data/fixtures/merge/legacy_negatives_stay/assert.rb +0 -8
- data/fixtures/merge/legacy_negatives_stay/copies/0123456789abcdef/1.zc +0 -6
- data/fixtures/merge/legacy_negatives_stay/copies/0123456789abcdef/scores.zc +0 -1
- data/fixtures/merge/legacy_negatives_stay/opts +0 -2
- data/fixtures/merge/missed_wallets/0000000000000000.z +0 -6
- data/fixtures/merge/missed_wallets/0123456789abcdef.z +0 -4
- data/fixtures/merge/missed_wallets/assert.rb +0 -8
- data/fixtures/merge/missed_wallets/copies/0123456789abcdef/1.zc +0 -8
- data/fixtures/merge/missed_wallets/copies/0123456789abcdef/scores.zc +0 -1
- data/fixtures/merge/missed_wallets/opts +0 -3
- data/fixtures/merge/negative_overwriting/0123456789abcdef.z +0 -6
- data/fixtures/merge/negative_overwriting/146b852f2d9ad984.z +0 -6
- data/fixtures/merge/negative_overwriting/assert.rb +0 -8
- data/fixtures/merge/negative_overwriting/copies/0123456789abcdef/1.zc +0 -6
- data/fixtures/merge/negative_overwriting/copies/0123456789abcdef/scores.zc +0 -1
- data/fixtures/merge/negative_overwriting/opts +0 -2
- data/fixtures/merge/negatives_in_between/0000000000000000.z +0 -6
- data/fixtures/merge/negatives_in_between/0123456789abcdef.z +0 -4
- data/fixtures/merge/negatives_in_between/assert.rb +0 -8
- data/fixtures/merge/negatives_in_between/copies/0123456789abcdef/1.zc +0 -6
- data/fixtures/merge/negatives_in_between/copies/0123456789abcdef/2.zc +0 -6
- data/fixtures/merge/negatives_in_between/copies/0123456789abcdef/3.zc +0 -6
- data/fixtures/merge/negatives_in_between/copies/0123456789abcdef/scores.zc +0 -3
- data/fixtures/merge/negatives_in_between/opts +0 -1
- data/fixtures/merge/random_expenses/0000000000000000.z +0 -6
- data/fixtures/merge/random_expenses/0123456789abcdef.z +0 -6
- data/fixtures/merge/random_expenses/assert.rb +0 -8
- data/fixtures/merge/random_expenses/copies/0123456789abcdef/1.zc +0 -7
- data/fixtures/merge/random_expenses/copies/0123456789abcdef/2.zc +0 -7
- data/fixtures/merge/random_expenses/copies/0123456789abcdef/3.zc +0 -7
- data/fixtures/merge/random_expenses/copies/0123456789abcdef/4.zc +0 -7
- data/fixtures/merge/random_expenses/copies/0123456789abcdef/5.zc +0 -7
- data/fixtures/merge/random_expenses/copies/0123456789abcdef/scores.zc +0 -5
- data/fixtures/merge/random_expenses/opts +0 -1
- data/fixtures/merge/simple_case/0000000000000000.z +0 -6
- data/fixtures/merge/simple_case/0123456789abcdef.z +0 -4
- data/fixtures/merge/simple_case/assert.rb +0 -8
- data/fixtures/merge/simple_case/copies/0123456789abcdef/1.zc +0 -6
- data/fixtures/merge/simple_case/copies/0123456789abcdef/scores.zc +0 -1
- data/fixtures/merge/simple_case/opts +0 -1
- data/fixtures/merge/unconfirmed_income/0123456789abcdef.z +0 -4
- data/fixtures/merge/unconfirmed_income/assert.rb +0 -8
- data/fixtures/merge/unconfirmed_income/copies/0123456789abcdef/1.zc +0 -6
- data/fixtures/merge/unconfirmed_income/copies/0123456789abcdef/scores.zc +0 -1
- data/fixtures/merge/unconfirmed_income/opts +0 -3
- data/fixtures/scripts/_head.sh +0 -72
- data/fixtures/scripts/calculate-scores.sh +0 -5
- data/fixtures/scripts/distribute-wallet.sh +0 -88
- data/fixtures/scripts/print-helps.sh +0 -9
- data/fixtures/scripts/pull-on-start.sh +0 -35
- data/fixtures/scripts/push-and-pull.sh +0 -46
- data/fixtures/scripts/redeploy-on-upgrade.sh +0 -40
- data/fixtures/scripts/spread-wallets.sh +0 -56
- data/renovate.json +0 -6
- data/test/commands/routines/test_audit.rb +0 -23
- data/test/commands/routines/test_gc.rb +0 -52
- data/test/commands/routines/test_reconcile.rb +0 -33
- data/test/commands/routines/test_reconnect.rb +0 -28
- data/test/commands/routines/test_retire.rb +0 -22
- data/test/commands/test_alias.rb +0 -58
- data/test/commands/test_calculate.rb +0 -22
- data/test/commands/test_clean.rb +0 -55
- data/test/commands/test_create.rb +0 -32
- data/test/commands/test_diff.rb +0 -43
- data/test/commands/test_fetch.rb +0 -144
- data/test/commands/test_invoice.rb +0 -32
- data/test/commands/test_list.rb +0 -29
- data/test/commands/test_merge.rb +0 -106
- data/test/commands/test_node.rb +0 -50
- data/test/commands/test_pay.rb +0 -203
- data/test/commands/test_propagate.rb +0 -33
- data/test/commands/test_pull.rb +0 -52
- data/test/commands/test_push.rb +0 -75
- data/test/commands/test_remote.rb +0 -247
- data/test/commands/test_remove.rb +0 -48
- data/test/commands/test_show.rb +0 -30
- data/test/commands/test_taxes.rb +0 -58
- data/test/fake_home.rb +0 -87
- data/test/node/fake_entrance.rb +0 -26
- data/test/node/fake_node.rb +0 -88
- data/test/node/test_async_entrance.rb +0 -85
- data/test/node/test_entrance.rb +0 -64
- data/test/node/test_farm.rb +0 -159
- data/test/node/test_farmers.rb +0 -58
- data/test/node/test_front.rb +0 -379
- data/test/node/test_nodup_entrance.rb +0 -31
- data/test/node/test_nospam_entrance.rb +0 -31
- data/test/node/test_safe_entrance.rb +0 -41
- data/test/node/test_spread_entrance.rb +0 -49
- data/test/node/test_sync_entrance.rb +0 -23
- data/test/node/test_trace.rb +0 -18
- data/test/test__helper.rb +0 -113
- data/test/test_age.rb +0 -37
- data/test/test_amount.rb +0 -62
- data/test/test_cached_wallets.rb +0 -55
- data/test/test_copies.rb +0 -127
- data/test/test_dir_items.rb +0 -72
- data/test/test_gem.rb +0 -23
- data/test/test_hands.rb +0 -51
- data/test/test_hexnum.rb +0 -18
- data/test/test_http.rb +0 -207
- data/test/test_hungry_wallets.rb +0 -72
- data/test/test_id.rb +0 -61
- data/test/test_json_page.rb +0 -29
- data/test/test_key.rb +0 -81
- data/test/test_metronome.rb +0 -71
- data/test/test_patch.rb +0 -160
- data/test/test_prefixes.rb +0 -31
- data/test/test_remotes.rb +0 -301
- data/test/test_signature.rb +0 -31
- data/test/test_size.rb +0 -21
- data/test/test_sync_wallets.rb +0 -39
- data/test/test_tax.rb +0 -153
- data/test/test_thread_pool.rb +0 -71
- data/test/test_tree_wallets.rb +0 -65
- data/test/test_txn.rb +0 -71
- data/test/test_upgrades.rb +0 -81
- data/test/test_verbose_thread.rb +0 -37
- data/test/test_version.rb +0 -17
- data/test/test_wallet.rb +0 -300
- data/test/test_wallets.rb +0 -67
- data/test/test_zold.rb +0 -81
- data/test/upgrades/test_delete_banned_wallets.rb +0 -29
- data/test/upgrades/test_protocol_up.rb +0 -24
data/test/node/test_front.rb
DELETED
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
-
# SPDX-License-Identifier: MIT
|
|
5
|
-
|
|
6
|
-
require 'json'
|
|
7
|
-
require 'time'
|
|
8
|
-
require 'securerandom'
|
|
9
|
-
require 'threads'
|
|
10
|
-
require 'zold/score'
|
|
11
|
-
require 'memory_profiler'
|
|
12
|
-
require_relative '../test__helper'
|
|
13
|
-
require_relative 'fake_node'
|
|
14
|
-
require_relative '../fake_home'
|
|
15
|
-
require_relative '../../lib/zold/http'
|
|
16
|
-
require_relative '../../lib/zold/age'
|
|
17
|
-
require_relative '../../lib/zold/json_page'
|
|
18
|
-
|
|
19
|
-
class FrontTest < Zold::Test
|
|
20
|
-
def app
|
|
21
|
-
Zold::Front
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
# Use this test to check how much memory is being used after doing a large
|
|
25
|
-
# number of routine operations. There should be no suspicious information
|
|
26
|
-
# in the report, which will be printed to the console.
|
|
27
|
-
def test_memory_leakage
|
|
28
|
-
skip
|
|
29
|
-
report = MemoryProfiler.report(top: 10) do
|
|
30
|
-
FakeNode.new(log: fake_log).run(opts('--network=foo')) do |port|
|
|
31
|
-
100.times do
|
|
32
|
-
Zold::Http.new(uri: "http://localhost:#{port}/", network: 'foo').get
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
report.pretty_print
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def test_renders_front_json
|
|
40
|
-
FakeNode.new(log: fake_log).run(opts('--network=foo')) do |port|
|
|
41
|
-
res = Zold::Http.new(uri: "http://localhost:#{port}/", network: 'foo').get
|
|
42
|
-
json = JSON.parse(res.body)
|
|
43
|
-
assert_equal(Zold::VERSION, json['version'])
|
|
44
|
-
assert_equal(Zold::PROTOCOL, json['protocol'])
|
|
45
|
-
assert_equal('foo', json['network'])
|
|
46
|
-
assert_equal('zold-io/zold', json['repo'])
|
|
47
|
-
assert_predicate(json['pid'], :positive?, json)
|
|
48
|
-
assert_predicate(json['cpus'], :positive?, json)
|
|
49
|
-
refute_predicate(json['journal'], :negative?, json)
|
|
50
|
-
assert_predicate(json['memory'], :positive?, json)
|
|
51
|
-
refute_predicate(json['load'], :negative?, json)
|
|
52
|
-
assert_predicate(json['wallets'], :positive?, json)
|
|
53
|
-
assert_predicate(json['remotes'], :zero?, json)
|
|
54
|
-
assert_predicate(json['nscore'], :zero?, json)
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def test_renders_public_pages
|
|
59
|
-
FakeNode.new(log: fake_log).run(opts) do |port|
|
|
60
|
-
{
|
|
61
|
-
200 => [
|
|
62
|
-
'/robots.txt',
|
|
63
|
-
'/',
|
|
64
|
-
'/remotes',
|
|
65
|
-
'/version',
|
|
66
|
-
'/protocol',
|
|
67
|
-
'/farm',
|
|
68
|
-
'/ledger',
|
|
69
|
-
'/ledger.json',
|
|
70
|
-
'/metronome',
|
|
71
|
-
'/journal',
|
|
72
|
-
'/score',
|
|
73
|
-
'/queue',
|
|
74
|
-
'/trace',
|
|
75
|
-
'/threads',
|
|
76
|
-
'/ps'
|
|
77
|
-
],
|
|
78
|
-
404 => [
|
|
79
|
-
'/this-is-absent',
|
|
80
|
-
'/wallet/ffffeeeeddddcccc',
|
|
81
|
-
'/wallet/ffffeeeeddddcccc.bin',
|
|
82
|
-
'/wallet/ffffeeeeddddcccc.txt',
|
|
83
|
-
'/wallet/ffffeeeeddddcccc/balance',
|
|
84
|
-
'/wallet/ffffeeeeddddcccc/key',
|
|
85
|
-
'/wallet/ffffeeeeddddcccc/mtime',
|
|
86
|
-
'/wallet/ffffeeeeddddcccc/digest'
|
|
87
|
-
]
|
|
88
|
-
}.each do |code, paths|
|
|
89
|
-
paths.each do |p|
|
|
90
|
-
uri = URI("http://localhost:#{port}#{p}")
|
|
91
|
-
response = Zold::Http.new(uri: uri).get
|
|
92
|
-
assert_equal(
|
|
93
|
-
code, response.status,
|
|
94
|
-
"Invalid response code for #{uri}: #{response.status_line}"
|
|
95
|
-
)
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
def test_updates_list_of_remotes
|
|
102
|
-
FakeNode.new(log: fake_log).run(['--no-metronome', '--ignore-score-weakness', '--no-cache']) do |port|
|
|
103
|
-
(Zold::Remotes::MAX_NODES + 5).times do |i|
|
|
104
|
-
score = Zold::Score.new(
|
|
105
|
-
host: 'localhost', port: i + 1, invoice: 'NOPREFIX@ffffffffffffffff', strength: 1
|
|
106
|
-
).next.next.next.next
|
|
107
|
-
response = Zold::Http.new(uri: "http://localhost:#{port}/remotes", score: score).get
|
|
108
|
-
assert_equal(200, response.status, response.body)
|
|
109
|
-
assert_equal(
|
|
110
|
-
[i + 1, Zold::Remotes::MAX_NODES + 1].min,
|
|
111
|
-
Zold::JsonPage.new(response.body).to_hash['all'].count, response.body
|
|
112
|
-
)
|
|
113
|
-
assert_match(
|
|
114
|
-
/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z/,
|
|
115
|
-
Zold::JsonPage.new(response.body).to_hash['mtime'].to_s,
|
|
116
|
-
response.body
|
|
117
|
-
)
|
|
118
|
-
end
|
|
119
|
-
end
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
def test_increments_score
|
|
123
|
-
FakeNode.new(log: fake_log).run(opts('--threads=1')) do |port|
|
|
124
|
-
3.times do |i|
|
|
125
|
-
assert_equal_wait(true, max: 120) do
|
|
126
|
-
response = Zold::Http.new(uri: "http://localhost:#{port}/").get
|
|
127
|
-
assert_equal(200, response.status, response.body)
|
|
128
|
-
score = Zold::Score.parse_json(Zold::JsonPage.new(response.body).to_hash['score'])
|
|
129
|
-
score.value >= i
|
|
130
|
-
end
|
|
131
|
-
end
|
|
132
|
-
end
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
[
|
|
136
|
-
'.txt', '.html',
|
|
137
|
-
'/balance', '/key', '/mtime',
|
|
138
|
-
'/digest', '/size',
|
|
139
|
-
'/age', '/mnemo', '/debt', '/txns',
|
|
140
|
-
'/txns.json', '.bin', '/copies'
|
|
141
|
-
].each do |p|
|
|
142
|
-
method = "test_wallet_page_#{p.gsub(/[^a-z]/, '_')}"
|
|
143
|
-
define_method(method) do
|
|
144
|
-
FakeHome.new(log: fake_log).run do |home|
|
|
145
|
-
FakeNode.new(log: fake_log).run(opts) do |port|
|
|
146
|
-
wallet = home.create_wallet(txns: 2)
|
|
147
|
-
base = "http://localhost:#{port}"
|
|
148
|
-
response = Zold::Http.new(uri: "#{base}/wallet/#{wallet.id}").put(wallet.path)
|
|
149
|
-
assert_equal(200, response.status, response.body)
|
|
150
|
-
assert_equal_wait(200) { Zold::Http.new(uri: "#{base}/wallet/#{wallet.id}").get.status }
|
|
151
|
-
assert_equal_wait(200) { Zold::Http.new(uri: "#{base}/wallet/#{wallet.id}#{p}").get.status }
|
|
152
|
-
end
|
|
153
|
-
end
|
|
154
|
-
end
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
def test_renders_wallets_page
|
|
158
|
-
FakeHome.new(log: fake_log).run do |home|
|
|
159
|
-
FakeNode.new(log: fake_log).run(opts) do |port|
|
|
160
|
-
wallet = home.create_wallet(txns: 2)
|
|
161
|
-
base = "http://localhost:#{port}"
|
|
162
|
-
response = Zold::Http.new(uri: "#{base}/wallet/#{wallet.id}").put(wallet.path)
|
|
163
|
-
assert_equal(200, response.status, response.body)
|
|
164
|
-
assert_equal_wait(200) { Zold::Http.new(uri: "#{base}/wallet/#{wallet.id}").get.status }
|
|
165
|
-
response = Zold::Http.new(uri: "#{base}/wallets").get
|
|
166
|
-
assert_equal(200, response.status, response.body)
|
|
167
|
-
assert_includes(response.body.to_s.split("\n"), wallet.id.to_s, response.body)
|
|
168
|
-
end
|
|
169
|
-
end
|
|
170
|
-
end
|
|
171
|
-
|
|
172
|
-
def test_fetch_in_multiple_threads
|
|
173
|
-
FakeNode.new(log: fake_log).run(opts) do |port|
|
|
174
|
-
FakeHome.new(log: fake_log).run do |home|
|
|
175
|
-
wallet = home.create_wallet
|
|
176
|
-
base = "http://localhost:#{port}"
|
|
177
|
-
Zold::Http.new(uri: "#{base}/wallet/#{wallet.id}").put(wallet.path)
|
|
178
|
-
assert_equal_wait(200) { Zold::Http.new(uri: "#{base}/wallet/#{wallet.id}").get.status }
|
|
179
|
-
threads = []
|
|
180
|
-
mutex = Mutex.new
|
|
181
|
-
Threads.new(6).assert(100) do
|
|
182
|
-
assert_equal_wait(200) do
|
|
183
|
-
res = Zold::Http.new(uri: "#{base}/wallet/#{wallet.id}").get
|
|
184
|
-
mutex.synchronize { threads << res.headers['X-Zold-Thread'] }
|
|
185
|
-
res.status
|
|
186
|
-
end
|
|
187
|
-
end
|
|
188
|
-
assert_operator(threads.uniq.count, :>, 1)
|
|
189
|
-
end
|
|
190
|
-
end
|
|
191
|
-
end
|
|
192
|
-
|
|
193
|
-
def test_pushes_twice
|
|
194
|
-
FakeNode.new(log: fake_log).run(opts) do |port|
|
|
195
|
-
FakeHome.new(log: fake_log).run do |home|
|
|
196
|
-
wallet = home.create_wallet
|
|
197
|
-
base = "http://localhost:#{port}"
|
|
198
|
-
assert_equal(
|
|
199
|
-
200,
|
|
200
|
-
Zold::Http.new(uri: "#{base}/wallet/#{wallet.id}").put(wallet.path).status
|
|
201
|
-
)
|
|
202
|
-
assert_equal_wait(200) { Zold::Http.new(uri: "#{base}/wallet/#{wallet.id}").get.status }
|
|
203
|
-
3.times do
|
|
204
|
-
r = Zold::Http.new(uri: "#{base}/wallet/#{wallet.id}").put(wallet.path)
|
|
205
|
-
assert_equal(304, r.status, r.body)
|
|
206
|
-
end
|
|
207
|
-
end
|
|
208
|
-
end
|
|
209
|
-
end
|
|
210
|
-
|
|
211
|
-
def test_pushes_many_wallets
|
|
212
|
-
FakeNode.new(log: fake_log).run(opts) do |port|
|
|
213
|
-
base = "http://localhost:#{port}"
|
|
214
|
-
FakeHome.new(log: fake_log).run do |home|
|
|
215
|
-
Threads.new(5).assert do
|
|
216
|
-
wallet = home.create_wallet
|
|
217
|
-
Zold::Http.new(uri: "#{base}/wallet/#{wallet.id}").put(wallet.path)
|
|
218
|
-
assert_equal_wait(200) { Zold::Http.new(uri: "#{base}/wallet/#{wallet.id}").get.status }
|
|
219
|
-
end
|
|
220
|
-
end
|
|
221
|
-
end
|
|
222
|
-
end
|
|
223
|
-
|
|
224
|
-
def test_different_logos
|
|
225
|
-
{
|
|
226
|
-
'0' => 'https://www.zold.io/images/logo-red.png',
|
|
227
|
-
'4' => 'https://www.zold.io/images/logo-orange.png',
|
|
228
|
-
'16' => 'https://www.zold.io/images/logo-green.png'
|
|
229
|
-
}.each do |num, path|
|
|
230
|
-
score = Zold::Score.new(
|
|
231
|
-
host: 'localhost', port: 999,
|
|
232
|
-
invoice: 'NOPREFIX@ffffffffffffffff',
|
|
233
|
-
strength: 1
|
|
234
|
-
)
|
|
235
|
-
num.to_i.times do
|
|
236
|
-
score = score.next
|
|
237
|
-
end
|
|
238
|
-
if score.value >= 16
|
|
239
|
-
assert_equal(
|
|
240
|
-
'https://www.zold.io/images/logo-green.png', path,
|
|
241
|
-
"Expected #{path} for score #{score.value}"
|
|
242
|
-
)
|
|
243
|
-
elsif score.value >= 4
|
|
244
|
-
assert_equal(
|
|
245
|
-
'https://www.zold.io/images/logo-orange.png', path,
|
|
246
|
-
"Expected #{path} for score #{score.value}"
|
|
247
|
-
)
|
|
248
|
-
else
|
|
249
|
-
assert_equal(
|
|
250
|
-
'https://www.zold.io/images/logo-red.png', path,
|
|
251
|
-
"Expected #{path} for score #{score.value}"
|
|
252
|
-
)
|
|
253
|
-
end
|
|
254
|
-
end
|
|
255
|
-
end
|
|
256
|
-
|
|
257
|
-
def test_gzip
|
|
258
|
-
FakeNode.new(log: fake_log).run(opts) do |port|
|
|
259
|
-
response = Zold::Http.new(uri: URI("http://localhost:#{port}/version")).get
|
|
260
|
-
assert_equal(200, response.status, response)
|
|
261
|
-
assert_operator(300, :>, response.body.length.to_i, 'Expected the content to be small')
|
|
262
|
-
end
|
|
263
|
-
end
|
|
264
|
-
|
|
265
|
-
def test_performance
|
|
266
|
-
times = Queue.new
|
|
267
|
-
FakeNode.new(log: fake_log).run(opts('--threads=4', '--strength=6')) do |port|
|
|
268
|
-
Threads.new(10).assert(100) do
|
|
269
|
-
start = Time.now
|
|
270
|
-
Zold::Http.new(uri: URI("http://localhost:#{port}/")).get
|
|
271
|
-
times << (Time.now - start)
|
|
272
|
-
end
|
|
273
|
-
end
|
|
274
|
-
all = []
|
|
275
|
-
all << times.pop(true) until times.empty?
|
|
276
|
-
fake_log.info("Average response time is #{all.sum / all.count}")
|
|
277
|
-
end
|
|
278
|
-
|
|
279
|
-
# The score exposed via the HTTP header must be reduced to the value of 16.
|
|
280
|
-
# We need this in order to optimize the amount of data we transfer in each
|
|
281
|
-
# HTTP request. This value is enough to identify a valuable node, and filter
|
|
282
|
-
# out those that are too weak.
|
|
283
|
-
def test_score_is_reduced
|
|
284
|
-
FakeNode.new(log: fake_log).run(opts('--threads=1', '--strength=1', '--farmer=plain')) do |port|
|
|
285
|
-
scores = []
|
|
286
|
-
50.times do
|
|
287
|
-
res = Zold::Http.new(uri: URI("http://localhost:#{port}/")).get
|
|
288
|
-
scores << Zold::Score.parse(res.headers[Zold::Http::SCORE_HEADER]).value
|
|
289
|
-
sleep(0.1)
|
|
290
|
-
end
|
|
291
|
-
assert_operator(scores.uniq.sort.reverse[0], :<=, Zold::Front::MIN_SCORE)
|
|
292
|
-
end
|
|
293
|
-
end
|
|
294
|
-
|
|
295
|
-
def test_headers_are_being_set_correctly
|
|
296
|
-
FakeNode.new(log: fake_log).run(opts('--expose-version=9.9.9')) do |port|
|
|
297
|
-
response = Zold::Http.new(uri: URI("http://localhost:#{port}/")).get
|
|
298
|
-
assert_equal('no-cache', response.headers['Cache-Control'])
|
|
299
|
-
assert_equal('close', response.headers['Connection'])
|
|
300
|
-
assert_equal('9.9.9', response.headers['X-Zold-Version'])
|
|
301
|
-
assert_equal(app.settings.protocol.to_s, response.headers[Zold::Http::PROTOCOL_HEADER])
|
|
302
|
-
assert_equal('*', response.headers['Access-Control-Allow-Origin'])
|
|
303
|
-
assert(response.headers['X-Zold-Milliseconds'])
|
|
304
|
-
refute_nil(response.headers[Zold::Http::SCORE_HEADER])
|
|
305
|
-
end
|
|
306
|
-
end
|
|
307
|
-
|
|
308
|
-
def test_alias_parameter
|
|
309
|
-
name = SecureRandom.hex(4)
|
|
310
|
-
FakeNode.new(log: fake_log).run(opts("--alias=#{name}")) do |port|
|
|
311
|
-
uri = URI("http://localhost:#{port}/")
|
|
312
|
-
response = Zold::Http.new(uri: uri).get
|
|
313
|
-
assert_match(
|
|
314
|
-
name,
|
|
315
|
-
Zold::JsonPage.new(response.body).to_hash['alias'].to_s,
|
|
316
|
-
response.body
|
|
317
|
-
)
|
|
318
|
-
end
|
|
319
|
-
end
|
|
320
|
-
|
|
321
|
-
def test_default_alias_parameter
|
|
322
|
-
FakeNode.new(log: fake_log).run(opts) do |port|
|
|
323
|
-
uri = URI("http://localhost:#{port}/")
|
|
324
|
-
response = Zold::Http.new(uri: uri).get
|
|
325
|
-
assert_match(
|
|
326
|
-
"localhost:#{port}",
|
|
327
|
-
Zold::JsonPage.new(response.body).to_hash['alias'].to_s,
|
|
328
|
-
response.body
|
|
329
|
-
)
|
|
330
|
-
end
|
|
331
|
-
end
|
|
332
|
-
|
|
333
|
-
def test_invalid_alias
|
|
334
|
-
skip
|
|
335
|
-
exception = assert_raises RuntimeError do
|
|
336
|
-
FakeNode.new(log: fake_log).run(opts('--alias=invalid-alias')) do |port|
|
|
337
|
-
uri = URI("http://localhost:#{port}/")
|
|
338
|
-
Zold::Http.new(uri: uri).get
|
|
339
|
-
end
|
|
340
|
-
end
|
|
341
|
-
assert_includes(exception.message, 'should be a 4 to 16 char long', exception.message)
|
|
342
|
-
end
|
|
343
|
-
|
|
344
|
-
def test_push_fetch_in_multiple_threads
|
|
345
|
-
key = Zold::Key.new(text: File.read('fixtures/id_rsa'))
|
|
346
|
-
FakeNode.new(log: fake_log).run(opts) do |port|
|
|
347
|
-
FakeHome.new(log: fake_log).run do |home|
|
|
348
|
-
wallet = home.create_wallet(Zold::Id::ROOT)
|
|
349
|
-
base = "http://localhost:#{port}"
|
|
350
|
-
Zold::Http.new(uri: "#{base}/wallet/#{wallet.id}").put(wallet.path)
|
|
351
|
-
assert_equal_wait(200) { Zold::Http.new(uri: "#{base}/wallet/#{wallet.id}").get.status }
|
|
352
|
-
cycles = 50
|
|
353
|
-
cycles.times do
|
|
354
|
-
wallet.sub(Zold::Amount.new(zents: 10), "NOPREFIX@#{Zold::Id.new}", key)
|
|
355
|
-
Zold::Http.new(uri: "#{base}/wallet/#{wallet.id}").put(wallet.path)
|
|
356
|
-
assert_equal(200, Zold::Http.new(uri: "#{base}/wallet/#{wallet.id}").get.status)
|
|
357
|
-
end
|
|
358
|
-
assert_equal_wait(-10 * cycles) do
|
|
359
|
-
Zold::Http.new(uri: "#{base}/wallet/#{wallet.id}/balance").get.body.to_i
|
|
360
|
-
end
|
|
361
|
-
end
|
|
362
|
-
end
|
|
363
|
-
end
|
|
364
|
-
|
|
365
|
-
def test_checksum_in_json
|
|
366
|
-
FakeNode.new(log: fake_log).run(opts) do |port|
|
|
367
|
-
uri = URI("http://localhost:#{port}/")
|
|
368
|
-
response = Zold::Http.new(uri: uri).get
|
|
369
|
-
hash = Zold::JsonPage.new(response.body).to_hash
|
|
370
|
-
assert_includes(hash.keys, 'checksum')
|
|
371
|
-
end
|
|
372
|
-
end
|
|
373
|
-
|
|
374
|
-
private
|
|
375
|
-
|
|
376
|
-
def opts(*extra)
|
|
377
|
-
['--no-metronome', '--ignore-score-weakness', '--standalone', '--threads=0', '--strength=1'] + extra
|
|
378
|
-
end
|
|
379
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
-
# SPDX-License-Identifier: MIT
|
|
5
|
-
|
|
6
|
-
require_relative '../fake_home'
|
|
7
|
-
require_relative '../test__helper'
|
|
8
|
-
require_relative '../../lib/zold/id'
|
|
9
|
-
require_relative '../../lib/zold/node/nodup_entrance'
|
|
10
|
-
require_relative 'fake_entrance'
|
|
11
|
-
|
|
12
|
-
# NoDupEntrance test.
|
|
13
|
-
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
14
|
-
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
15
|
-
# License:: MIT
|
|
16
|
-
class TestNoDupEntrance < Zold::Test
|
|
17
|
-
def test_ignores_dup
|
|
18
|
-
FakeHome.new(log: fake_log).run do |home|
|
|
19
|
-
wallet = home.create_wallet
|
|
20
|
-
Zold::NoDupEntrance.new(RealEntrance.new, home.wallets, log: fake_log).start do |e|
|
|
21
|
-
assert_empty(e.push(wallet.id, File.read(wallet.path)))
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
class RealEntrance < FakeEntrance
|
|
27
|
-
def push(id, _)
|
|
28
|
-
[id]
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
-
# SPDX-License-Identifier: MIT
|
|
5
|
-
|
|
6
|
-
require_relative '../test__helper'
|
|
7
|
-
require_relative '../../lib/zold/id'
|
|
8
|
-
require_relative '../../lib/zold/node/nospam_entrance'
|
|
9
|
-
require_relative 'fake_entrance'
|
|
10
|
-
|
|
11
|
-
# NoSpamEntrance test.
|
|
12
|
-
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
13
|
-
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
14
|
-
# License:: MIT
|
|
15
|
-
class TestNoSpamEntrance < Zold::Test
|
|
16
|
-
def test_ignores_spam
|
|
17
|
-
Zold::NoSpamEntrance.new(RealEntrance.new, log: fake_log).start do |e|
|
|
18
|
-
id = Zold::Id.new
|
|
19
|
-
content = 'hello'
|
|
20
|
-
refute_empty(e.push(id, content))
|
|
21
|
-
assert_empty(e.push(id, content))
|
|
22
|
-
assert_empty(e.push(id, content))
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
class RealEntrance < FakeEntrance
|
|
27
|
-
def push(id, _)
|
|
28
|
-
[id]
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
-
# SPDX-License-Identifier: MIT
|
|
5
|
-
|
|
6
|
-
require_relative '../fake_home'
|
|
7
|
-
require_relative '../test__helper'
|
|
8
|
-
require_relative '../../lib/zold/wallet'
|
|
9
|
-
require_relative '../../lib/zold/id'
|
|
10
|
-
require_relative '../../lib/zold/key'
|
|
11
|
-
require_relative '../../lib/zold/node/safe_entrance'
|
|
12
|
-
require_relative '../../lib/zold/node/soft_error'
|
|
13
|
-
require_relative 'fake_entrance'
|
|
14
|
-
|
|
15
|
-
# SafeEntrance test.
|
|
16
|
-
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
17
|
-
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
18
|
-
# License:: MIT
|
|
19
|
-
class TestSafeEntrance < Zold::Test
|
|
20
|
-
def test_rejects_wallet_with_negative_balance
|
|
21
|
-
FakeHome.new(log: fake_log).run do |home|
|
|
22
|
-
wallet = home.create_wallet
|
|
23
|
-
amount = Zold::Amount.new(zld: 39.99)
|
|
24
|
-
key = Zold::Key.new(file: 'fixtures/id_rsa')
|
|
25
|
-
wallet.sub(amount, "NOPREFIX@#{Zold::Id.new}", key)
|
|
26
|
-
assert_raises Zold::SoftError do
|
|
27
|
-
Zold::SafeEntrance.new(FakeEntrance.new).push(wallet.id, File.read(wallet.path))
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def test_rejects_wallet_with_wrong_network
|
|
33
|
-
FakeHome.new(log: fake_log).run do |home|
|
|
34
|
-
wallet = Zold::Wallet.new(File.join(home.dir, 'wallet.z'))
|
|
35
|
-
wallet.init(Zold::Id.new, Zold::Key.new(file: 'fixtures/id_rsa.pub'), network: 'someothernetwork')
|
|
36
|
-
assert_raises StandardError do
|
|
37
|
-
Zold::SafeEntrance.new(FakeEntrance.new).push(wallet.id, File.read(wallet.path))
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
-
# SPDX-License-Identifier: MIT
|
|
5
|
-
|
|
6
|
-
require_relative '../fake_home'
|
|
7
|
-
require_relative 'fake_node'
|
|
8
|
-
require_relative '../test__helper'
|
|
9
|
-
require_relative '../../lib/zold/id'
|
|
10
|
-
require_relative '../../lib/zold/node/entrance'
|
|
11
|
-
require_relative '../../lib/zold/node/pipeline'
|
|
12
|
-
require_relative '../../lib/zold/node/spread_entrance'
|
|
13
|
-
require_relative 'fake_entrance'
|
|
14
|
-
|
|
15
|
-
# SpreadEntrance test.
|
|
16
|
-
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
17
|
-
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
18
|
-
# License:: MIT
|
|
19
|
-
class TestSpreadEntrance < Zold::Test
|
|
20
|
-
def test_renders_json
|
|
21
|
-
FakeHome.new(log: fake_log).run do |home|
|
|
22
|
-
wallet = home.create_wallet(Zold::Id.new)
|
|
23
|
-
Zold::SpreadEntrance.new(
|
|
24
|
-
Zold::Entrance.new(
|
|
25
|
-
home.wallets,
|
|
26
|
-
Zold::Pipeline.new(home.remotes, home.copies(wallet).root, 'x'),
|
|
27
|
-
log: fake_log
|
|
28
|
-
),
|
|
29
|
-
home.wallets, home.remotes, 'x', log: fake_log
|
|
30
|
-
).start do |e|
|
|
31
|
-
assert_equal(0, e.to_json[:modified])
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def test_ignores_duplicates
|
|
37
|
-
FakeHome.new(log: fake_log).run do |home|
|
|
38
|
-
FakeNode.new(log: fake_log).run(['--ignore-score-weakness']) do |port|
|
|
39
|
-
wallet = home.create_wallet
|
|
40
|
-
remotes = home.remotes
|
|
41
|
-
remotes.add('localhost', port)
|
|
42
|
-
Zold::SpreadEntrance.new(FakeEntrance.new, home.wallets, remotes, 'x', log: fake_log).start do |e|
|
|
43
|
-
8.times { e.push(wallet.id, File.read(wallet.path)) }
|
|
44
|
-
assert_operator(e.to_json[:modified], :<, 2, "It's too big: #{e.to_json[:modified]}")
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
-
# SPDX-License-Identifier: MIT
|
|
5
|
-
|
|
6
|
-
require_relative '../fake_home'
|
|
7
|
-
require_relative '../test__helper'
|
|
8
|
-
require_relative '../../lib/zold/node/sync_entrance'
|
|
9
|
-
require_relative 'fake_entrance'
|
|
10
|
-
|
|
11
|
-
# SyncEntrance test.
|
|
12
|
-
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
13
|
-
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
14
|
-
# License:: MIT
|
|
15
|
-
class TestSyncEntrance < Zold::Test
|
|
16
|
-
def test_renders_json
|
|
17
|
-
FakeHome.new(log: fake_log).run do |home|
|
|
18
|
-
Zold::SyncEntrance.new(FakeEntrance.new, File.join(home.dir, 'x'), log: fake_log).start do |e|
|
|
19
|
-
refute_nil(e.to_json)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
data/test/node/test_trace.rb
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
-
# SPDX-License-Identifier: MIT
|
|
5
|
-
|
|
6
|
-
require_relative '../test__helper'
|
|
7
|
-
require_relative '../../lib/zold/node/trace'
|
|
8
|
-
|
|
9
|
-
class TraceTest < Zold::Test
|
|
10
|
-
def test_records_log_lines
|
|
11
|
-
trace = Zold::Trace.new(fake_log, 2)
|
|
12
|
-
trace.error('This should not be visible')
|
|
13
|
-
trace.error('How are you, друг?')
|
|
14
|
-
trace.error('Works?')
|
|
15
|
-
refute_includes(trace.to_s, 'visible')
|
|
16
|
-
assert_includes(trace.to_s, 'друг')
|
|
17
|
-
end
|
|
18
|
-
end
|
data/test/test__helper.rb
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
-
# SPDX-License-Identifier: MIT
|
|
5
|
-
|
|
6
|
-
gem 'openssl'
|
|
7
|
-
require 'openssl'
|
|
8
|
-
require 'minitest/hooks/test'
|
|
9
|
-
require 'concurrent'
|
|
10
|
-
require 'timeout'
|
|
11
|
-
|
|
12
|
-
$stdout.sync = true
|
|
13
|
-
|
|
14
|
-
ENV['RACK_ENV'] = 'test'
|
|
15
|
-
require 'simplecov'
|
|
16
|
-
require 'simplecov-cobertura'
|
|
17
|
-
unless SimpleCov.running || ENV['PICKS']
|
|
18
|
-
SimpleCov.command_name('test')
|
|
19
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
|
|
20
|
-
[
|
|
21
|
-
SimpleCov::Formatter::HTMLFormatter,
|
|
22
|
-
SimpleCov::Formatter::CoberturaFormatter
|
|
23
|
-
]
|
|
24
|
-
)
|
|
25
|
-
SimpleCov.minimum_coverage 85
|
|
26
|
-
SimpleCov.minimum_coverage_by_file 50
|
|
27
|
-
SimpleCov.start do
|
|
28
|
-
add_filter 'test/'
|
|
29
|
-
add_filter 'vendor/'
|
|
30
|
-
add_filter 'target/'
|
|
31
|
-
track_files 'lib/**/*.rb'
|
|
32
|
-
track_files '*.rb'
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
require 'minitest/autorun'
|
|
37
|
-
require 'minitest/mock'
|
|
38
|
-
require 'minitest/reporters'
|
|
39
|
-
require 'webmock/minitest'
|
|
40
|
-
Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new]
|
|
41
|
-
Minitest.load :minitest_reporter
|
|
42
|
-
|
|
43
|
-
require_relative '../lib/zold/hands'
|
|
44
|
-
Zold::Hands.start
|
|
45
|
-
|
|
46
|
-
module Zold
|
|
47
|
-
class Test < Minitest::Test
|
|
48
|
-
include Minitest::Hooks
|
|
49
|
-
|
|
50
|
-
# We need this in order to make sure any test is faster than a minute. This
|
|
51
|
-
# should help spotting tests that hang out sometimes. The number of seconds
|
|
52
|
-
# to wait can be increased, but try to make it as little as possible,
|
|
53
|
-
# in order to catch problems earlier.
|
|
54
|
-
def around
|
|
55
|
-
Timeout.timeout(180) do
|
|
56
|
-
Thread.current.name = 'test'
|
|
57
|
-
super
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def assert_wait(max: 30, &block)
|
|
62
|
-
assert_equal_wait(true, max: max, &block)
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
def assert_equal_wait(expected, max: 30)
|
|
66
|
-
start = Time.now
|
|
67
|
-
loop do
|
|
68
|
-
begin
|
|
69
|
-
actual = yield
|
|
70
|
-
if expected == actual
|
|
71
|
-
assert_equal(expected, actual)
|
|
72
|
-
break
|
|
73
|
-
end
|
|
74
|
-
rescue StandardError => e
|
|
75
|
-
fake_log.debug(e.message)
|
|
76
|
-
end
|
|
77
|
-
sleep 1
|
|
78
|
-
sec = Time.now - start
|
|
79
|
-
require_relative '../lib/zold/age'
|
|
80
|
-
raise "'#{actual}' is not equal to '#{expected}' even after #{Zold::Age.new(start)} of waiting" if sec > max
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
def fake_log
|
|
85
|
-
require 'loog'
|
|
86
|
-
@fake_log ||= ENV['TEST_QUIET_LOG'] == 'true' ? Loog::NULL : Loog::VERBOSE
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
class TestLogger
|
|
90
|
-
attr_accessor :msgs
|
|
91
|
-
|
|
92
|
-
def initialize(log = Loog::NULL)
|
|
93
|
-
@log = log
|
|
94
|
-
@msgs = []
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
def info(msg)
|
|
98
|
-
@log.info(msg)
|
|
99
|
-
@msgs << msg
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
def debug(msg)
|
|
103
|
-
@log.debug(msg)
|
|
104
|
-
@msgs << msg
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
def error(msg)
|
|
108
|
-
@log.error(msg)
|
|
109
|
-
@msgs << msg
|
|
110
|
-
end
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
end
|