zold-stress 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c39b360cbbeb1dedfc3aaddeca4ce31c6f84e0f3e73d3311ec801d2923457646
4
- data.tar.gz: eaf7ae9f9ce95a3d3faa9ecbdf5393d684e405e8c1deaa00c3489d59698bf874
3
+ metadata.gz: 6ab86a1ae25c81f4ac5fb1c98279b618dbfaa977e926a3c760b13d06b53ad2fb
4
+ data.tar.gz: a20be8604c929d4b371db76655a176c3a3973941e9e79e7f2fed9defdc260a2a
5
5
  SHA512:
6
- metadata.gz: f3cdc01c10cddea9defba0449ff31a57b2696e3efffe63cf0302ae65a10f3c905d05f867965411785ac17d9ccad187e5de097fe87f2daf96b702dd09e309e9a6
7
- data.tar.gz: 5e6174df13026e203f57ec777f419377c7154929ec0022e0da73da35e591fba96aff138faefc7b2a6c607334bb7caa0f9f3fcb52eb8b10a43fe1383ad3c27a21
6
+ metadata.gz: 706d9e39efaac93346011db9869cbb83c45dc9c2ef8d22dee3382faa2dd7f790e8cd917ed0b9793ff21ddfd996d5f429cab9915d6ef69a058d4274736165592e
7
+ data.tar.gz: 3debbc344aaaa1d5a3841bc407c9d7bb323df226c8bb94c25be04e39bab22e9acdaf6ac1946e4c7ac3d30ba626cdc4fd7ea6f347408a5aeb524199569f541d8f
@@ -1,6 +1,8 @@
1
1
  assets:
2
2
  rubygems.yml: zerocracy/home#assets/rubygems.yml
3
3
  install: |-
4
+ sudo apt-get -y update
5
+ sudo apt-get -y install libcurl4-openssl-dev
4
6
  sudo gem install zold
5
7
  zold --version
6
8
  export GEM_HOME=~/.ruby
@@ -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}")
@@ -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.find(source, &:balance)
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.find(source) { |w| Zold::Tax.new(w).in_debt? }
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
@@ -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.find(id, &:balance) } }
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.find(balances[0][:id], &:key).to_s)
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
@@ -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.find(id, &:balance) }.inject(&:+)} total, \
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.find(a[0], &:size))
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.find(id, &:size))
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.find(p[:target], &:exists?)
135
- t = @wallets.find(p[:target], &:txns).find { |x| x.details == p[:details] && x.bnf == p[:source] }
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
@@ -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: 1)}"
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.code
76
- break if code == '200'
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.find(id, &:balance))
65
- assert_equal(Zold::Amount.new(zld: -3.5), wallets.find(Zold::Id::ROOT, &:balance))
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.find(id) do |w|
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.find(id) { |w| w.txns.count } }.inject(&:+))
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.find(Zold::Id::ROOT) do |w|
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.find(Zold::Id::ROOT) do |w|
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
@@ -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.0'
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.0
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-13 00:00:00.000000000 Z
11
+ date: 2018-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace