test/zold/stress/test_round.rb in zold-stress-0.1.0 vs test/zold/stress/test_round.rb in zold-stress-0.2.0
- old
+ new
@@ -37,10 +37,13 @@
require 'zold/commands/node'
require 'tmpdir'
require_relative '../test__helper'
require_relative 'fake_node'
require_relative '../../../lib/zold/stress/round'
+require_relative '../../../lib/zold/stress/stats'
+require_relative '../../../lib/zold/stress/summary'
+require_relative '../../../lib/zold/stress/air'
class StressTest < Minitest::Test
def test_runs_a_few_full_cycles
Zold::Stress::FakeNode.new(Zold::Log::Quiet.new).exec do |port|
Dir.mktmpdir do |home|
@@ -55,10 +58,11 @@
w.add(Zold::Txn.new(1, Time.now, Zold::Amount.new(zld: 1.0), 'NOPREFIX', Zold::Id.new, '-'))
end
stats = Zold::Stress::Stats.new
air = Zold::Stress::Air.new
batch = 20
+ summary = Zold::Stress::Summary.new(stats, batch)
round = Zold::Stress::Round.new(
pvt: Zold::Key.new(file: 'fixtures/id_rsa'),
wallets: wallets, remotes: remotes,
air: air, stats: stats,
opts: test_opts('--pool=5', "--batch=#{batch}"),
@@ -72,10 +76,10 @@
loop do
break if air.fetch.empty?
break if attempt > 50
round.pull
round.match
- test_log.info(stats.to_console)
+ test_log.info(summary)
attempt += 1
sleep 0.2
end
assert(air.fetch.empty?)
assert_equal(batch, stats.total('arrived'))