def run(self):
   memcache_queue_name = uuid4().hex
   # TODO: launch a private memcached server for the load test
   mc = GetMemcacheClient(MEMCACHE_HOSTS)
   deque.create(mc, memcache_queue_name)
   # TODO: graceful end of test; end-to-end checksum
   for i in range(100):
     self.q.put({
         'servers': MEMCACHE_HOSTS,
         'memcache_queue_name': memcache_queue_name,
         'batch_size': BATCH_SIZE,
         'value_size': 100,
     })
Esempio n. 2
0
 def run(self):
     memcache_queue_name = uuid4().hex
     # TODO: launch a private memcached server for the load test
     mc = GetMemcacheClient(MEMCACHE_HOSTS)
     deque.create(mc, memcache_queue_name)
     # TODO: graceful end of test; end-to-end checksum
     for i in range(100):
         self.q.put({
             'servers': MEMCACHE_HOSTS,
             'memcache_queue_name': memcache_queue_name,
             'batch_size': BATCH_SIZE,
             'value_size': 100,
         })
  def testDeque(self):
    # TODO: Write serious unit test which covers all concurrency
    # cases of the lock-free algorithm.  Current test passes even when CAS is
    # ignored...
    mc = GetMemcacheClient()
    self.baseQueueTest(deque.create(mc))

    # test create and bind
    d1 = deque.create(mc)
    d2 = deque.bind(mc, d1.name)
    d1.appendleft(5)
    self.assertEqual(5, d2.pop())
    self.failUnlessRaises(IndexError, d1.popleft)

    # test named create and bind
    name = 'foo'
    d1 = deque.create(mc, name)
    self.failUnlessRaises(AddError, deque.create, mc, name)
    d2 = deque.bind(mc, name)
    self.assertEqual(name, d1.name)
    d1.appendleft(5)
    self.assertEqual(5, d2.pop())
    self.failUnlessRaises(IndexError, d1.popleft)
    def testDeque(self):
        # TODO: Write serious unit test which covers all concurrency
        # cases of the lock-free algorithm.  Current test passes even when CAS is
        # ignored...
        mc = GetMemcacheClient()
        self.baseQueueTest(deque.create(mc))

        # test create and bind
        d1 = deque.create(mc)
        d2 = deque.bind(mc, d1.name)
        d1.appendleft(5)
        self.assertEqual(5, d2.pop())
        self.failUnlessRaises(IndexError, d1.popleft)

        # test named create and bind
        name = 'foo'
        d1 = deque.create(mc, name)
        self.failUnlessRaises(AddError, deque.create, mc, name)
        d2 = deque.bind(mc, name)
        self.assertEqual(name, d1.name)
        d1.appendleft(5)
        self.assertEqual(5, d2.pop())
        self.failUnlessRaises(IndexError, d1.popleft)