コード例 #1
0
ファイル: test_arbiter.py プロジェクト: unkcpz/circus
            yield arbiter.stop()

    @tornado.testing.gen_test
    def test_add_watcher_same_lowercase_names(self):
        controller = "tcp://127.0.0.1:%d" % get_available_port()
        sub = "tcp://127.0.0.1:%d" % get_available_port()
        arbiter = Arbiter([],
                          controller,
                          sub,
                          loop=get_ioloop(),
                          check_delay=-1)
        arbiter.add_watcher('foo', SLEEP % 5)
        self.assertRaises(AlreadyExist, arbiter.add_watcher, 'Foo', SLEEP % 5)


@skipIf(not has_circusweb(), 'Tests for circus-web')
class TestCircusWeb(TestCircus):
    @tornado.testing.gen_test
    def test_circushttpd(self):
        controller = "tcp://127.0.0.1:%d" % get_available_port()
        sub = "tcp://127.0.0.1:%d" % get_available_port()

        arbiter = Arbiter([],
                          controller,
                          sub,
                          loop=get_ioloop(),
                          check_delay=-1,
                          httpd=True,
                          debug=True)
        self.arbiters.append(arbiter)
        try:
コード例 #2
0
ファイル: test_arbiter.py プロジェクト: aubustou/circus
            yield arbiter.stop()

    @tornado.testing.gen_test
    def test_start_arbiter_with_autostart(self):
        arbiter = Arbiter([], DEFAULT_ENDPOINT_DEALER, DEFAULT_ENDPOINT_SUB,
                          loop=get_ioloop(),
                          check_delay=-1)
        arbiter.add_watcher('foo', SLEEP % 5, autostart=False)
        try:
            yield arbiter.start()
            self.assertEqual(arbiter.watchers[0].status(), 'stopped')
        finally:
            yield arbiter.stop()


@skipIf(not has_circusweb(), 'Tests for circus-web')
class TestCircusWeb(TestCircus):

    @tornado.testing.gen_test
    def test_circushttpd(self):
        controller = "tcp://127.0.0.1:%d" % get_available_port()
        sub = "tcp://127.0.0.1:%d" % get_available_port()

        arbiter = Arbiter([], controller, sub, loop=get_ioloop(),
                          check_delay=-1, httpd=True, debug=True)
        self.arbiters.append(arbiter)
        try:
            yield arbiter.start()
            poll_for_callable(self.assertDictEqual,
                              arbiter.statuses, {'circushttpd': 'active'})
        finally: