Esempio n. 1
0
    def __init__(self, hub_address, batch_size=1, pause_server_on_load=False):
        self.pause_server_on_load = pause_server_on_load

        self.tio = tioclient.connect(hub_address)

        if self.pause_server_on_load:
            self.tio.server_pause()

        self.containers = {}
        self.batch_size = batch_size
        if self.batch_size > 1:
            self.tio.wait_for_answers = False
Esempio n. 2
0
 def test_data_stress(self):
     if os.name != 'nt':
         print 'non Windows tests disabled'
         return
     tio_ps = subprocess.Popen([self.tio_path])
     tio_bench_ps = subprocess.Popen([
         self.tio_bench_path, '--run-test-parallel-data-stress',
         '--umdf-feeder-test-total-operations', self.total_operations
     ],
                                     stdout=subprocess.PIPE)
     tio_bench_ret = tio_bench_ps.wait()
     tio_bench_out = tio_bench_ps.communicate()[0]
     print tio_bench_out
     self.assertTrue(tio_bench_ret == 0)
     tio_bench_out = tio_bench_out.replace('\r', '').replace('\n', '')
     m = re.match('.*n=([0-9]+).*MAP ([0-9a-z_]+).*', tio_bench_out)
     tio_cn = tioclient.connect('tio://localhost:2605')
     cont = tio_cn.open(m.group(2))
     self.assertTrue(len(cont) == int(m.group(1)))
     tio_ps.kill()
Esempio n. 3
0
 def test_umdf_feeder_stress(self):
     if os.name != 'nt':
         print 'non Windows tests disabled'
         return
     tio_ps = subprocess.Popen([self.tio_path])
     tio_bench_args = [
         self.tio_bench_path, '--run-test-umdf-feeder-stress',
         '--umdf-feeder-test-total-feeders', self.total_feeders,
         '--umdf-feeder-test-total-clients', self.total_clients,
         '--umdf-feeder-test-total-operations', self.operations_by_feeder
     ]
     print 'running ', ' '.join(tio_bench_args)
     tio_bench_ps = subprocess.Popen(tio_bench_args, stdout=subprocess.PIPE)
     tio_bench_ret = tio_bench_ps.wait()
     tio_bench_out = tio_bench_ps.communicate()[0]
     print tio_bench_out
     self.assertTrue(tio_bench_ret == 0)
     symbols = tio_bench_out[tio_bench_out.find('Symbols: ') +
                             len('Symbols: '):]
     symbols = symbols[0:symbols.find('\r\n')]
     tio_cn = tioclient.connect('tio://localhost:2605')
     total_operations = 0
     for s in symbols.split(' '):
         containers = {
             'book_buy':
             tio_cn.open('intelimarket/bvmf/' + s + '/book_buy'),
             'book_sell':
             tio_cn.open('intelimarket/bvmf/' + s + '/book_sell'),
             'trades': tio_cn.open('intelimarket/bvmf/' + s + '/trades'),
             'properties':
             tio_cn.open('intelimarket/bvmf/' + s + '/properties')
         }
         total_operations = total_operations + len(
             containers['book_buy']) + len(containers['book_sell'])
     self.assertTrue(total_operations == int(self.operations_by_feeder) *
                     int(self.total_feeders))
     tio_ps.kill()
Esempio n. 4
0
 def __init__(self, hub_address, batch_size = 1):
   self.tio = tioclient.connect(hub_address)
   self.containers = {}
   self.batch_size = batch_size
   if self.batch_size > 1:
     self.tio.wait_for_answers = False
Esempio n. 5
0
 def setUp(self):
     self.tio = tioclient.connect('localhost')