Beispiel #1
0
class TestSAASClient (unittest.TestCase):

    def setUp (self):
        self.m = VPSMgr ()
        self.rpc = SAAS_Client (0, self.m.logger)

    def test_invalid (self):
        self.rpc.connect ()
        print "connected"
        try:
            vps = self.rpc.vps (0)
            print VPSMgr.dump_vps_info (vps)
            self.assert_ (not VPSMgr.vps_is_valid (vps))
            vps = self.rpc.vps (100000000)
            print VPSMgr.dump_vps_info (vps)
            self.assert_ (not VPSMgr.vps_is_valid (vps))
        finally:
            self.rpc.close ()

    def test_done (self):
        m = VPSMgr ()
        m.done_task (CMD.OPEN, 4, True)

    def test_migrate_task (self):
        m = VPSMgr ()
        task = m.query_migrate_task (1030)
        print task
Beispiel #2
0
 def check(self):
     vps = None
     try:
         rpc = SAAS_Client(conf.HOST_ID, self.logger)
         rpc.connect()
         try:
             _id = rpc.todo(CMD.MONITOR)
         finally:
             rpc.close()
         self.logger.info("ok")
         return True
     except Exception, e:
         self.logger.exception(e)
         return False
Beispiel #3
0
 def check(self):
     vps = None
     try:
         rpc = SAAS_Client(conf.HOST_ID, self.logger)
         rpc.connect()
         try:
             _id = rpc.todo(CMD.MONITOR)
         finally:
             rpc.close()
         self.logger.info("ok")
         return True
     except Exception, e:
         self.logger.exception(e)
         return False
Beispiel #4
0
 def rpc_connect(self):
     rpc = SAAS_Client(self.host_id, self.logger_debug)
     rpc.connect()
     return rpc
Beispiel #5
0
 def setUp (self):
     self.m = VPSMgr ()
     self.rpc = SAAS_Client (0, self.m.logger)
Beispiel #6
0
 def rpc_connect(self):
     rpc = SAAS_Client(self.host_id, self.logger_debug)
     rpc.connect()
     return rpc