zold-stress 0.5.0 → 0.5.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/.rultor.yml +2 -0
- data/bin/zold-stress +0 -1
- data/lib/zold/stress/pmnts.rb +2 -2
- data/lib/zold/stress/pool.rb +2 -2
- data/lib/zold/stress/round.rb +5 -5
- data/lib/zold/stress/summary.rb +1 -1
- data/test/zold/stress/fake_node.rb +2 -2
- data/test/zold/stress/test_pmnts.rb +4 -4
- data/test/zold/stress/test_pool.rb +1 -1
- data/test/zold/stress/test_round.rb +1 -1
- data/zold-stress.gemspec +1 -1
- 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: 6ab86a1ae25c81f4ac5fb1c98279b618dbfaa977e926a3c760b13d06b53ad2fb
|
|
4
|
+
data.tar.gz: a20be8604c929d4b371db76655a176c3a3973941e9e79e7f2fed9defdc260a2a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 706d9e39efaac93346011db9869cbb83c45dc9c2ef8d22dee3382faa2dd7f790e8cd917ed0b9793ff21ddfd996d5f429cab9915d6ef69a058d4274736165592e
|
|
7
|
+
data.tar.gz: 3debbc344aaaa1d5a3841bc407c9d7bb323df226c8bb94c25be04e39bab22e9acdaf6ac1946e4c7ac3d30ba626cdc4fd7ea6f347408a5aeb524199569f541d8f
|
data/.rultor.yml
CHANGED
data/bin/zold-stress
CHANGED
|
@@ -121,7 +121,6 @@ Available options:"
|
|
|
121
121
|
stats: stats, air: air, log: log, vlog: vlog, opts: opts
|
|
122
122
|
)
|
|
123
123
|
|
|
124
|
-
log.info("Zold version: #{Zold::VERSION}")
|
|
125
124
|
log.info("Time: #{Time.now.utc.iso8601}; CPUs: #{Concurrent.processor_count}")
|
|
126
125
|
log.info("Home directory: #{home}")
|
|
127
126
|
log.info("Ruby version: #{RUBY_VERSION}/#{RUBY_PLATFORM}")
|
data/lib/zold/stress/pmnts.rb
CHANGED
|
@@ -54,7 +54,7 @@ module Zold::Stress
|
|
|
54
54
|
File.write(f, @pvt.to_s)
|
|
55
55
|
loop do
|
|
56
56
|
source = all.sample
|
|
57
|
-
balance = @wallets.
|
|
57
|
+
balance = @wallets.acq(source, &:balance)
|
|
58
58
|
next if balance.negative? || balance.zero?
|
|
59
59
|
amount = balance / all.count
|
|
60
60
|
next if amount < Zold::Amount.new(zld: 0.0001)
|
|
@@ -79,7 +79,7 @@ module Zold::Stress
|
|
|
79
79
|
"--private-key=#{pvt}", '--ignore-nodes-absence'
|
|
80
80
|
]
|
|
81
81
|
)
|
|
82
|
-
if @wallets.
|
|
82
|
+
if @wallets.acq(source) { |w| Zold::Tax.new(w).in_debt? }
|
|
83
83
|
@log.error("The wallet #{source} is in debt and we can't pay taxes")
|
|
84
84
|
return
|
|
85
85
|
end
|
data/lib/zold/stress/pool.rb
CHANGED
|
@@ -51,7 +51,7 @@ module Zold::Stress
|
|
|
51
51
|
def rebuild
|
|
52
52
|
raise "There are no wallets in the pool at #{@wallets.path}, at least one is needed" if @wallets.all.empty?
|
|
53
53
|
balances = @wallets.all
|
|
54
|
-
.map { |id| { id: id, balance: @wallets.
|
|
54
|
+
.map { |id| { id: id, balance: @wallets.acq(id, &:balance) } }
|
|
55
55
|
.sort_by { |h| h[:balance] }
|
|
56
56
|
.reverse
|
|
57
57
|
balances.last([balances.count - @opts['pool'], 0].max).each do |h|
|
|
@@ -60,7 +60,7 @@ module Zold::Stress
|
|
|
60
60
|
)
|
|
61
61
|
end
|
|
62
62
|
Tempfile.open do |f|
|
|
63
|
-
File.write(f, @wallets.
|
|
63
|
+
File.write(f, @wallets.acq(balances[0][:id], &:key).to_s)
|
|
64
64
|
while @wallets.all.count < @opts['pool']
|
|
65
65
|
Zold::Create.new(wallets: @wallets, log: @vlog).run(
|
|
66
66
|
['create', "--public-key=#{f.path}", "--network=#{@opts['network']}"] + @opts.arguments
|
data/lib/zold/stress/round.rb
CHANGED
|
@@ -81,7 +81,7 @@ module Zold::Stress
|
|
|
81
81
|
end
|
|
82
82
|
end
|
|
83
83
|
@log.info("There are #{@wallets.all.count} wallets in the pool \
|
|
84
|
-
with #{@wallets.all.map { |id| @wallets.
|
|
84
|
+
with #{@wallets.all.map { |id| @wallets.acq(id, &:balance) }.inject(&:+)} total, \
|
|
85
85
|
in #{Zold::Age.new(start)}")
|
|
86
86
|
end
|
|
87
87
|
|
|
@@ -102,7 +102,7 @@ in #{Zold::Age.new(start)}")
|
|
|
102
102
|
mutex.synchronize do
|
|
103
103
|
a[1].each { |p| @air.add(p) }
|
|
104
104
|
end
|
|
105
|
-
@stats.put('output', @wallets.
|
|
105
|
+
@stats.put('output', @wallets.acq(a[0], &:size))
|
|
106
106
|
end
|
|
107
107
|
end
|
|
108
108
|
@log.info("#{sent.count} payments for #{sent.map { |s| s[:amount] }.inject(&:+)} \
|
|
@@ -122,7 +122,7 @@ in #{Zold::Age.new(start)}, #{@air.fetch.count} are now in the air, \
|
|
|
122
122
|
)
|
|
123
123
|
end
|
|
124
124
|
@air.pulled(id)
|
|
125
|
-
@stats.put('input', @wallets.
|
|
125
|
+
@stats.put('input', @wallets.acq(id, &:size))
|
|
126
126
|
end
|
|
127
127
|
@log.info("There are #{@wallets.all.count} wallets left, \
|
|
128
128
|
after the pull of #{targets.count} in #{Zold::Age.new(start)}")
|
|
@@ -131,8 +131,8 @@ after the pull of #{targets.count} in #{Zold::Age.new(start)}")
|
|
|
131
131
|
def match
|
|
132
132
|
total = 0
|
|
133
133
|
@air.fetch.each do |p|
|
|
134
|
-
next unless @wallets.
|
|
135
|
-
t = @wallets.
|
|
134
|
+
next unless @wallets.acq(p[:target], &:exists?)
|
|
135
|
+
t = @wallets.acq(p[:target], &:txns).find { |x| x.details == p[:details] && x.bnf == p[:source] }
|
|
136
136
|
next if t.nil?
|
|
137
137
|
@stats.put('arrived', p[:pulled] - p[:pushed])
|
|
138
138
|
total += 1
|
data/lib/zold/stress/summary.rb
CHANGED
|
@@ -48,7 +48,7 @@ module Zold::Stress
|
|
|
48
48
|
"#{tps.round(2)} tps",
|
|
49
49
|
%w[update push pull paid arrived].map do |m|
|
|
50
50
|
if @stats.exists?(m)
|
|
51
|
-
t = "#{m}: #{@stats.total(m)}/#{Zold::Age.new(Time.now - @stats.avg(m), limit:
|
|
51
|
+
t = "#{m}: #{@stats.total(m)}/#{Zold::Age.new(Time.now - @stats.avg(m), limit: 2)}"
|
|
52
52
|
errors = @stats.total(m + '_error')
|
|
53
53
|
t += errors.zero? ? '' : '/' + Rainbow(errors.to_s).red
|
|
54
54
|
t
|
|
@@ -72,8 +72,8 @@ module Zold::Stress
|
|
|
72
72
|
end
|
|
73
73
|
attempt = 0
|
|
74
74
|
loop do
|
|
75
|
-
code = Zold::Http.new(uri: "http://localhost:#{port}/").get.
|
|
76
|
-
break if code ==
|
|
75
|
+
code = Zold::Http.new(uri: "http://localhost:#{port}/").get.status
|
|
76
|
+
break if code == 200
|
|
77
77
|
@log.debug("Waiting for the node at localhost:#{port} (attempt no.#{attempt}): #{code}...")
|
|
78
78
|
attempt += 1
|
|
79
79
|
sleep 1
|
|
@@ -61,8 +61,8 @@ class PmntsTest < Minitest::Test
|
|
|
61
61
|
assert_equal(1, sent.count)
|
|
62
62
|
assert_equal(id, sent[0][:source])
|
|
63
63
|
assert_equal(Zold::Id::ROOT, sent[0][:target])
|
|
64
|
-
assert_equal(Zold::Amount.new(zld: 3.5), wallets.
|
|
65
|
-
assert_equal(Zold::Amount.new(zld: -3.5), wallets.
|
|
64
|
+
assert_equal(Zold::Amount.new(zld: 3.5), wallets.acq(id, &:balance))
|
|
65
|
+
assert_equal(Zold::Amount.new(zld: -3.5), wallets.acq(Zold::Id::ROOT, &:balance))
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
68
|
|
|
@@ -75,7 +75,7 @@ class PmntsTest < Minitest::Test
|
|
|
75
75
|
id = Zold::Create.new(wallets: wallets, log: test_log).run(
|
|
76
76
|
['create', '--public-key=fixtures/id_rsa.pub', Zold::Id.new.to_s, '--network=test']
|
|
77
77
|
)
|
|
78
|
-
wallets.
|
|
78
|
+
wallets.acq(id) do |w|
|
|
79
79
|
w.add(Zold::Txn.new(1, Time.now, Zold::Amount.new(zld: 1.0), 'NOPREFIX', Zold::Id.new, '-'))
|
|
80
80
|
end
|
|
81
81
|
ids << id
|
|
@@ -89,7 +89,7 @@ class PmntsTest < Minitest::Test
|
|
|
89
89
|
log: test_log, vlog: test_log
|
|
90
90
|
).send
|
|
91
91
|
assert_equal(20, sent.count)
|
|
92
|
-
assert_equal(46, wallets.all.map { |id| wallets.
|
|
92
|
+
assert_equal(46, wallets.all.map { |id| wallets.acq(id) { |w| w.txns.count } }.inject(&:+))
|
|
93
93
|
end
|
|
94
94
|
end
|
|
95
95
|
end
|
|
@@ -43,7 +43,7 @@ class PoolTest < Minitest::Test
|
|
|
43
43
|
Zold::Create.new(wallets: wallets, log: test_log).run(
|
|
44
44
|
['create', '--public-key=fixtures/id_rsa.pub', Zold::Id::ROOT.to_s, '--network=test']
|
|
45
45
|
)
|
|
46
|
-
wallets.
|
|
46
|
+
wallets.acq(Zold::Id::ROOT) do |w|
|
|
47
47
|
w.add(Zold::Txn.new(1, Time.now, Zold::Amount.new(zld: 1.0), 'NOPREFIX', Zold::Id.new, '-'))
|
|
48
48
|
end
|
|
49
49
|
remotes = Zold::Remotes.new(file: File.join(home, 'remotes'), network: 'test')
|
|
@@ -55,7 +55,7 @@ class StressTest < Minitest::Test
|
|
|
55
55
|
Zold::Create.new(wallets: wallets, log: test_log).run(
|
|
56
56
|
['create', '--public-key=fixtures/id_rsa.pub', Zold::Id::ROOT.to_s, '--network=test']
|
|
57
57
|
)
|
|
58
|
-
wallets.
|
|
58
|
+
wallets.acq(Zold::Id::ROOT) do |w|
|
|
59
59
|
w.add(Zold::Txn.new(1, Time.now, Zold::Amount.new(zld: 1.0), 'NOPREFIX', Zold::Id.new, '-'))
|
|
60
60
|
end
|
|
61
61
|
stats = Zold::Stress::Stats.new
|
data/zold-stress.gemspec
CHANGED
|
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
|
|
|
27
27
|
s.rubygems_version = '2.2'
|
|
28
28
|
s.required_ruby_version = '>=2.3'
|
|
29
29
|
s.name = 'zold-stress'
|
|
30
|
-
s.version = '0.5.
|
|
30
|
+
s.version = '0.5.1'
|
|
31
31
|
s.license = 'MIT'
|
|
32
32
|
s.summary = 'Zold stress test'
|
|
33
33
|
s.description = 'Stress testing toolkit for Zold network'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: zold-stress
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yegor Bugayenko
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-11-
|
|
11
|
+
date: 2018-11-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: backtrace
|