def test_handler(self): log = self._get_file() stream = {'stream': FileStream(log)} self._run_circus('circus.tests.test_stats_client.run_process', stdout_stream=stream, stderr_stream=stream, stats=True) time.sleep(.5) # checking that our system is live and running client = CircusClient() res = client.send_message('list') watchers = res['watchers'] watchers.sort() self.assertEqual(['circusd-stats', 'test'], watchers) # making sure the stats process run res = client.send_message('status', name='test') self.assertEqual(res['status'], 'active') res = client.send_message('status', name='circusd-stats') self.assertEqual(res['status'], 'active') # playing around with the stats now: we should get some ! from circus.stats.client import StatsClient client = StatsClient() next = client.iter_messages().next for i in range(10): watcher, pid, stat = next() self.assertTrue(watcher in ('test', 'circusd-stats', 'circus'), watcher)
def test_handler(self): if os.getenv('TRAVIS', False): return log = self._get_file() stream = {'stream': FileStream(log)} self._run_circus('circus.tests.test_stats_client.run_process', stdout_stream=stream, stderr_stream=stream, stats=True) time.sleep(.5) # checking that our system is live and running client = CircusClient() res = client.send_message('list') watchers = res['watchers'] watchers.sort() self.assertEqual(['circusd-stats', 'test'], watchers) # making sure the stats process run res = client.send_message('status', name='test') self.assertEqual(res['status'], 'active') res = client.send_message('status', name='circusd-stats') self.assertEqual(res['status'], 'active') # playing around with the stats now: we should get some ! from circus.stats.client import StatsClient client = StatsClient() next = client.iter_messages().next for i in range(10): watcher, pid, stat = next() self.assertTrue(watcher in ('test', 'circusd-stats', 'circus'), watcher)
def test_handler(self): if os.getenv('TRAVIS', False): return log = self._get_file() stream = {'stream': FileStream(log)} self._run_circus('circus.tests.test_stats_client.run_process', stdout_stream=stream, stderr_stream=stream, stats=True) # waiting for data to appear in the file stream empty = True while empty: with open(log) as f: empty = f.read() == '' time.sleep(.1) # checking that our system is live and running client = CircusClient() res = client.send_message('list') watchers = res['watchers'] watchers.sort() self.assertEqual(['circusd-stats', 'test'], watchers) # making sure the stats process run res = client.send_message('status', name='test') self.assertEqual(res['status'], 'active') res = client.send_message('status', name='circusd-stats') self.assertEqual(res['status'], 'active') # playing around with the stats now: we should get some ! from circus.stats.client import StatsClient client = StatsClient() next = client.iter_messages().next for i in range(10): watcher, pid, stat = next() self.assertTrue(watcher in ('test', 'circusd-stats', 'circus'), watcher)
def test_handler(self): log = self._get_file() stream = {'stream': FileStream(log)} self._run_circus('circus.tests.test_stats_client.run_process', stdout_stream=stream, stderr_stream=stream, stats=True) # waiting for data to appear in the file stream empty = True while empty: with open(log) as f: empty = f.read() == '' time.sleep(.1) # checking that our system is live and running client = CircusClient() res = client.send_message('list') watchers = res['watchers'] watchers.sort() self.assertEqual(['circusd-stats', 'test'], watchers) # making sure the stats process run res = client.send_message('status', name='test') self.assertEqual(res['status'], 'active') res = client.send_message('status', name='circusd-stats') self.assertEqual(res['status'], 'active') # playing around with the stats now: we should get some ! from circus.stats.client import StatsClient client = StatsClient() next = client.iter_messages().next for i in range(10): watcher, pid, stat = next() self.assertTrue(watcher in ('test', 'circusd-stats', 'circus'), watcher)