Changeset 665

Show
Ignore:
Timestamp:
12/07/07 05:56:59 (1 year ago)
Author:
dormando
Message:

Believe this modified test is still useful. Based on what Tomash suggested.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/server/t/cas.t

    • Property svn:executable deleted
    r659 r665  
    22 
    33use strict; 
    4 use Test::More tests => 27
     4use Test::More tests => 30
    55use FindBin qw($Bin); 
    66use lib "$Bin/lib"; 
     
    9696ok($foo1_cas != $foo2_cas, "foo1 != foo2 multi-gets success"); 
    9797 
     98### simulate race condition with cas 
     99 
     100# gets foo1 - success 
     101@result = mem_gets($sock, "foo1"); 
     102ok($result[0] != "", "sock - gets foo1 is not empty"); 
     103 
     104# gets foo2 - success 
     105@result2 = mem_gets($sock2, "foo1"); 
     106ok($result2[0] != "","sock2 - gets foo1 is not empty"); 
     107 
     108print $sock "cas foo1 0 0 6 $result[0]\r\nbarva2\r\n"; 
     109print $sock2 "cas foo1 0 0 5 $result2[0]\r\napple\r\n"; 
     110 
     111my $res1 = <$sock>; 
     112my $res2 = <$sock2>; 
     113 
     114ok( ( $res1 eq "STORED\r\n" && $res2 eq "EXISTS\r\n") || 
     115    ( $res1 eq "EXISTS\r\n" && $res2 eq "STORED\r\n"), 
     116    "cas on same item from two sockets"); 
     117