def setUp(self):
        yield FullIntegrationTest.setUp(self)

        _, self.lock_path = tempfile.mkstemp()

        options = OptParseMock()
        options.agency_lock_path = self.lock_path
        options.agency_socket_path = self.socket_path
        options.agency_journal = ["sqlite://%s" % (self.jourfile,)]
        options.agency_rundir = os.path.abspath(os.path.curdir)
        c = config.Config()
        c.load(dict(), options)
        self.agency = standalone_agency.Agency(c)

        yield self.spawn_agency()
        yield self.wait_for_pid(self.pid_path)

        def host_descriptor():
            def check(host_desc):
                return host_desc.instance_id == 1

            d = self.db.get_document(hostname)
            d.addCallbacks(check, failure.Failure.trap, errbackArgs=(NotFoundError,))
            return d

        hostname = self.agency.get_hostname()
        yield self.wait_for(host_descriptor, 5)
    def setUp(self):
        yield FullIntegrationTest.setUp(self)

        _, self.lock_path= tempfile.mkstemp()

        options = OptParseMock()
        options.agency_lock_path = self.lock_path
        options.agency_socket_path = self.socket_path
        self.agency = standalone_agency.Agency(options)

        yield self.spawn_agency()
        yield self.wait_for_pid(self.pid_path)

        def host_descriptor():

            def check(host_desc):
                return host_desc.instance_id == 1

            d = self.db.get_document(hostname)
            d.addCallbacks(check, failure.Failure.trap,
                           errbackArgs=(NotFoundError, ))
            return d

        hostname = unicode(socket.gethostbyaddr(socket.gethostname())[0])
        yield self.wait_for(host_descriptor, 5)
Esempio n. 3
0
    def setUp(self):
        yield FullIntegrationTest.setUp(self)

        self.agency = agency.Agency(
            msg_host=self.msg_host, msg_port=self.msg_port,
            db_host=self.db_host, db_port=self.db_port, db_name=self.db_name,
            agency_journal=self.jourfile, rundir=self.tempdir,
            logdir=self.tempdir,
            socket_path=self.socket_path)
Esempio n. 4
0
    def setUp(self):
        yield FullIntegrationTest.setUp(self)

        journal_connstr = "sqlite://%s" % (self.jourfile,)
        c = config.Config(
            msg=config.MsgConfig(host=self.msg_host, port=self.msg_port),
            db=config.DbConfig(host=self.db_host, port=self.db_port, name=self.db_name),
            agency=config.AgencyConfig(
                journal=[journal_connstr], rundir=self.tempdir, logdir=self.tempdir, socket_path=self.socket_path
            ),
        )
        c.load(dict())
        self.agency = agency.Agency(c)