[Bps-public-commit] r17208 - in IPC-PubSub: .

alexmv at bestpractical.com alexmv at bestpractical.com
Sat Dec 13 14:54:56 EST 2008


Author: alexmv
Date: Sat Dec 13 14:54:56 2008
New Revision: 17208

Added:
   IPC-PubSub/t/short.t
Modified:
   IPC-PubSub/   (props changed)
   IPC-PubSub/t/basic.t
   IPC-PubSub/t/publisher.t

Log:
 r39951 at kohr-ah:  chmrr | 2008-12-13 14:54:42 -0500
  * Add TODO'd tests for ephemeral publisher's messages getting lost


Modified: IPC-PubSub/t/basic.t
==============================================================================
--- IPC-PubSub/t/basic.t	(original)
+++ IPC-PubSub/t/basic.t	Sat Dec 13 14:54:56 2008
@@ -5,7 +5,6 @@
 use IO::Socket::INET;
 use File::Temp ':POSIX';
 
-
 my @backends = qw(PlainHash);
 
 unshift @backends, 'DBM_Deep' if eval { require DBM::Deep };
@@ -23,7 +22,7 @@
     Memcached   => [ rand() . $$ ],
 );
 
-SKIP: for my $backend (@backends) {
+for my $backend (@backends) {
     diag("Testing backend $backend");
 
     my $bus = IPC::PubSub->new($backend, @{$init_args{$backend}});

Modified: IPC-PubSub/t/publisher.t
==============================================================================
--- IPC-PubSub/t/publisher.t	(original)
+++ IPC-PubSub/t/publisher.t	Sat Dec 13 14:54:56 2008
@@ -22,7 +22,7 @@
     Memcached   => [ rand() . $$ ],
 );
 
-SKIP: for my $backend (@backends) {
+for my $backend (@backends) {
     diag("Testing backend $backend");
 
     my $bus = IPC::PubSub->new( $backend, @{ $init_args{$backend} } );

Added: IPC-PubSub/t/short.t
==============================================================================
--- (empty file)
+++ IPC-PubSub/t/short.t	Sat Dec 13 14:54:56 2008
@@ -0,0 +1,42 @@
+use strict;
+use warnings;
+use Test::More;
+use IPC::PubSub;
+use IO::Socket::INET;
+use File::Temp ':POSIX';
+
+my @backends = qw(PlainHash);
+
+unshift @backends, 'DBM_Deep' if eval { require DBM::Deep };
+unshift @backends, 'JiftyDBI' if eval { require Jifty::DBI };
+unshift @backends, 'Memcached' if eval { require Cache::Memcached } and IO::Socket::INET->new('127.0.0.1:11211');
+
+plan tests => 2 * scalar @backends;
+
+my $tmp = tmpnam();
+END { unlink $tmp }
+
+my %init_args = (
+    DBM_Deep    => [ $tmp ],
+    JiftyDBI    => [ db_init => 1 ],
+    Memcached   => [ rand() . $$ ],
+);
+
+for my $backend (@backends) {
+    diag("Testing backend $backend");
+    local $TODO = "Removing a publisher removes their unseen messages";
+
+    my $bus = IPC::PubSub->new( $backend, @{ $init_args{$backend} } );
+    my $sub = $bus->new_subscriber( "brief" );
+    {
+        $bus->new_publisher( "brief" )->msg("ephemeral");
+    }
+    my @msgs = $sub->get;
+    is_deeply(\@msgs, ["ephemeral"]);
+
+    my $pub = $bus->new_publisher( "brief" );
+    $pub->msg("will unsubscribe");
+    $pub->unpublish("brief");
+    @msgs = $sub->get;
+    is_deeply(\@msgs, ["will unsubscribe"]);
+}



More information about the Bps-public-commit mailing list