diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-08-25 08:22:20 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-08-25 08:22:47 +0000 |
commit | ddea35e23596e32255222a001538571e335055af (patch) | |
tree | 862a3741af200836f9c2270aaa996b2f648ee443 /test/player_integration.rb | |
parent | 51212f0405057c03b032814677055b8ed2c4a494 (diff) | |
download | dtas-ddea35e23596e32255222a001538571e335055af.tar.gz |
This should make porting to different Unix socket types easier, too. Much of these tests were written before I decided to implement unix_client originally.
Diffstat (limited to 'test/player_integration.rb')
-rw-r--r-- | test/player_integration.rb | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/test/player_integration.rb b/test/player_integration.rb index 6580194..72f6039 100644 --- a/test/player_integration.rb +++ b/test/player_integration.rb @@ -4,6 +4,7 @@ require './test/helper' require 'dtas/player' require 'dtas/state_file' +require 'dtas/unix_client' require 'yaml' require 'tempfile' require 'shellwords' @@ -46,18 +47,8 @@ module PlayerIntegration end end - module PlayerClient - def preq(args) - args = Shellwords.join(args) if Array === args - send(args, Socket::MSG_EOR) - end - end - def client_socket - s = Socket.new(:AF_UNIX, :SOCK_SEQPACKET, 0) - s.connect(Socket.pack_sockaddr_un(@sock_path)) - s.extend(PlayerClient) - s + DTAS::UNIXClient.new(@sock_path) end def wait_pid_dead(pid, time = 5) @@ -79,8 +70,7 @@ module PlayerIntegration def default_sink_pid(s) default_pid = Tempfile.new(%w(dtas-test .pid)) pf = "echo $$ >> #{default_pid.path}; " - s.send("sink ed default command='#{pf}#@cmd'", Socket::MSG_EOR) - assert_equal "OK", s.readpartial(666) + s.req_ok("sink ed default command='#{pf}#@cmd'") default_pid end @@ -108,13 +98,11 @@ module PlayerIntegration end def dethrottle_decoder(s) - s.send("sink ed default active=false", Socket::MSG_EOR) - assert_equal "OK", s.readpartial(666) + s.req_ok("sink ed default active=false") end def stop_playback(pid_file, s) - s.send("skip", Socket::MSG_EOR) - assert_equal "OK", s.readpartial(666) + s.req_ok("skip") pid = read_pid_file(pid_file) wait_pid_dead(pid) end |