示例#1
0
 public function test_failover_over_limit()
 {
     $pool = new ConnectionPool(self::$KS, NULL, 5, 4);
     $pool->fill();
     $stats = $pool->stats();
     self::assertEqual($stats['created'], 5);
     foreach (range(1, 5) as $i) {
         $conn = $pool->get();
         $conn->client = new MockClient($conn->transport);
         $pool->return_connection($conn);
     }
     $cf = new ColumnFamily($pool, self::$CF);
     try {
         $cf->insert('key', array('col' => 'val'));
         self::assertTrue(false);
     } catch (MaxRetriesException $ex) {
     }
     $stats = $pool->stats();
     self::assertEqual($stats['created'], 10);
     self::assertEqual($stats['failed'], 5);
     self::assertEqual($stats['recycled'], 0);
 }