Beispiel #1
0
    def test_connect(self):
        server = get_server_on_this_node()
        server.start()

        time.sleep(1)
        worker = create_worker(server.address)
        worker.start()

        #    while True:
        #      print "main thread is pausing..."
        time.sleep(5)

        print "connecting to %s:%d" % server.address

        client = JSClient(server.address)
        req = ControlMessage()
        req.type = ControlMessage.GET_NODE_LIST_REQ

        buf = client.do_rpc(req, True)
        resp = ControlMessage()
        resp.ParseFromString(buf)

        self.assertEquals(resp.node_count, 1)
        #    print resp

        worker.stop()
        client.close()
        server.stop()
        print "Done"
 def setUp(self):
     self.controller = Controller(('localhost', 0))
     self.controller.start()
     print "controller bound to %s:%d" % self.controller.address
     self.client = JSClient(self.controller.address)
     self.server = RemoteController()
     self.server.connect(self.controller.address[0],
                         self.controller.address[1])
     self.workers = []
Beispiel #3
0
 def setUp(self):
     self.controller = Controller(('localhost', 0))
     self.controller.start()
     print "controller bound to %s:%d" % self.controller.address
     self.client = JSClient(self.controller.address)
Beispiel #4
0
 def connect(self, addr, port):
     self.client = JSClient((addr, port))