Exemplo n.º 1
0
 def run(self, user_id, port=None, branch_directory=None,
         codehosting_endpoint_url=None, inet=False, protocol=None):
     from lp.codehosting.bzrutils import install_oops_handler
     from lp.codehosting.vfs import get_lp_server, hooks
     install_oops_handler(user_id)
     four_gig = int(4e9)
     resource.setrlimit(resource.RLIMIT_AS, (four_gig, four_gig))
     seen_new_branch = hooks.SetProcTitleHook()
     if protocol is None:
         protocol = transport_server_registry.get()
     lp_server = get_lp_server(
         int(user_id), codehosting_endpoint_url, branch_directory,
         seen_new_branch.seen)
     lp_server.start_server()
     try:
         old_lockdir_timeout = lockdir._DEFAULT_TIMEOUT_SECONDS
         lp_transport = get_transport(lp_server.get_url())
         host, port = self.get_host_and_port(port)
         lockdir._DEFAULT_TIMEOUT_SECONDS = 0
         try:
             protocol(lp_transport, host, port, inet)
         finally:
             lockdir._DEFAULT_TIMEOUT_SECONDS = old_lockdir_timeout
     finally:
         lp_server.stop_server()
Exemplo n.º 2
0
 def test_doesnt_call_hook_for_non_important_exception(self):
     # Some exceptions are exempt from OOPSes.
     self.assertEqual(0, len(self.oopses))
     hook = install_oops_handler(1000)
     self.addCleanup(remove_exception_logging_hook, hook)
     exception = AppendRevisionsOnlyViolation("foo")
     self.logException(exception)
     self.assertEqual(0, len(self.oopses))
Exemplo n.º 3
0
    def test_doesnt_call_hook_for_non_important_exception(self):
        # Some exceptions are exempt from OOPSes.
        exceptions = []

        self.assertEqual(0, len(self.oopses))
        hook = install_oops_handler(1000)
        self.addCleanup(remove_exception_logging_hook, hook)
        exception = AppendRevisionsOnlyViolation("foo")
        self.logException(exception)
        self.assertEqual(0, len(self.oopses))
Exemplo n.º 4
0
    def run(self, user_id, port=None, branch_directory=None, codehosting_endpoint_url=None, inet=False, protocol=None):
        from lp.codehosting.bzrutils import install_oops_handler
        from lp.codehosting.vfs import get_lp_server, hooks

        install_oops_handler(user_id)
        four_gig = int(4e9)
        resource.setrlimit(resource.RLIMIT_AS, (four_gig, four_gig))
        seen_new_branch = hooks.SetProcTitleHook()
        if protocol is None:
            protocol = transport_server_registry.get()
        lp_server = get_lp_server(int(user_id), codehosting_endpoint_url, branch_directory, seen_new_branch.seen)
        lp_server.start_server()
        try:
            old_lockdir_timeout = lockdir._DEFAULT_TIMEOUT_SECONDS
            lp_transport = get_transport(lp_server.get_url())
            host, port = self.get_host_and_port(port)
            lockdir._DEFAULT_TIMEOUT_SECONDS = 0
            try:
                protocol(lp_transport, host, port, inet)
            finally:
                lockdir._DEFAULT_TIMEOUT_SECONDS = old_lockdir_timeout
        finally:
            lp_server.stop_server()