Exemple #1
0
 def test_double(self):
   with BsonNetworkProcess('python bsonnetwork/echo.py -i echoer') as d:
     d.connect('herp')
     d.connect('derp')
     d.identify('herp')
     d.identify('derp')
     for i in range(0, 100):
       self.subtest_send_receive(d, 'herp', utils.random_dict())
       self.subtest_send_receive(d, 'derp', utils.random_dict())
     d.disconnect('herp')
     d.disconnect('derp')
 def test_send_more(self):
   map(self.r.connect, self.clients)
   map(self.r.identify, self.clients)
   msg = utils.random_dict()
   for c in range(0, self.NUM_CLIENTS - 1):
     self.r.send_and_receive(clientid(c), clientid(c + 1), msg)
   map(self.r.disconnect, self.clients)
Exemple #3
0
  def test_send_more(self):
    with BNProcess('python bsonnetwork/router.py -i router') as r:
      r.connect('A')
      r.connect('B')
      r.identify('A')
      r.identify('B')

      seq = [utils.random_dict() for i in range(0, 10)]
      r.send_and_receive('A', 'B', seq)
      r.send_and_receive('B', 'A', seq)

      r.disconnect('A')
      r.disconnect('B')
Exemple #4
0
 def test_many(self):
   clients = 100
   with BsonNetworkProcess('python bsonnetwork/echo.py -i echoer') as d:
     clientid = lambda num: 'client%d' % num
     for i in range(0, clients):
       d.connect(clientid(i))
     for i in range(0, clients):
       d.identify(clientid(i))
     for i in range(0, clients):
       for m in range(0, 100):
         self.subtest_send_receive(d, clientid(i), utils.random_dict())
     for i in range(0, clients):
       d.disconnect(clientid(i))
Exemple #5
0
  def test_send_much(self):
    with BNProcess('python bsonnetwork/router.py -i router') as r:
      r.connect('A')
      r.connect('B')
      r.identify('A')
      r.identify('B')

      for pair in [('A', 'B'), ('B', 'A'), ('A', 'A'), ('B', 'B')]:
        seq = [utils.random_dict() for i in range(0, 50)]
        r.send_and_receive(pair[0], pair[1], seq)
        r.send_and_receive(pair[0], pair[1], seq)
        r.send_and_receive(pair[0], pair[1], seq)
        r.send_and_receive(pair[0], pair[1], seq)

      r.disconnect('A')
      r.disconnect('B')
Exemple #6
0
 def test_single(self):
   with BsonNetworkProcess('python bsonnetwork/echo.py -i echoer') as d:
     d.connect('herp')
     d.identify('herp')
     self.subtest_send_receive(d, 'herp', utils.random_dict())
     d.disconnect('herp')