Class: DRbDump::TestCase
- Inherits:
-
MiniTest::Unit::TestCase
- Object
- MiniTest::Unit::TestCase
- DRbDump::TestCase
- Defined in:
- lib/drbdump/test_case.rb
Overview
A test case for writing DRbDump tests.
Constant Summary collapse
- ARG_DUMP =
Dump containing DRb messages with arguments
File.join test, 'arg.dump'
- FIN_DUMP =
Dump containing a packet with a FIN flag
File.join test, 'drb_fin.dump'
- HTTP_DUMP =
Dump containing HTTP packets
File.join test, 'http.dump'
- PING_DUMP =
Dump containing messages from example/ping.rb
File.join test, 'ping.dump'
- RING_DUMP =
Dump containing Rinda::RingFinger lookups
File.join test, 'ring.dump'
- TOO_LARGE_DUMP =
Dump containing a DRb message that is too large
File.join test, 'too_large_packet.pcap'
Instance Method Summary collapse
-
#drbdump(file = PING_DUMP) ⇒ Object
Creates a new drbdump for
file
and makes it available as @drbdump. -
#mu_pp(obj) ⇒ Object
Pretty-print minitest diff output.
-
#packets(file) ⇒ Object
Returns a Capp packet Enumerator for
file
. -
#resolver ⇒ Object
Creates a resolver for addresses in *_DUMP files.
Instance Method Details
#drbdump(file = PING_DUMP) ⇒ Object
Creates a new drbdump for file
and makes it available as @drbdump. Calling this again will create a brand new instance.
50 51 52 53 54 55 56 57 58 |
# File 'lib/drbdump/test_case.rb', line 50 def drbdump file = PING_DUMP @drbdump = DRbDump.new devices: [file] @drbdump.instance_variable_set :@running, true @drbdump.resolver = resolver @statistics = @drbdump.statistics @drbdump end |
#mu_pp(obj) ⇒ Object
Pretty-print minitest diff output
63 64 65 66 67 |
# File 'lib/drbdump/test_case.rb', line 63 def mu_pp obj # :nodoc: s = '' s = PP.pp obj, s s.chomp end |
#packets(file) ⇒ Object
Returns a Capp packet Enumerator for file
72 73 74 |
# File 'lib/drbdump/test_case.rb', line 72 def packets file Capp.open(file).loop end |
#resolver ⇒ Object
Creates a resolver for addresses in *_DUMP files
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/drbdump/test_case.rb', line 79 def resolver Tempfile.open 'hosts' do |io| io.puts '10.101.28.77 kault' io.flush resolver = Resolv::Hosts.new io.path resolver.getname '10.101.28.77' # initialize resolver end end |