示例#1
0
 def create_and_restore_csv(self):
     try:
         self.__load_data()
         shell_obj = RemoteMachineShellConnection(self.master)
         self.log.info("Removing backup folder if already present")
         info = shell_obj.extract_remote_info()
         path = "/tmp/backup/"
         if info.type.lower() == "windows":
             path = "/cygdrive/c" + path
         #TODO : Check for mac also
         shell_obj.delete_files(path)
         create_dir = "mkdir " + path
         data_type = "csv:"
         destination = path + "data.csv"
         shell_obj.execute_command(create_dir)
         source = "http://*****:*****@ %s" % destination)
         source, destination = destination, source
         options = "-B standard_bucket0" + self.username_arg + self.password_arg
         self.log.info("Restoring data....!")
         shell_obj.execute_cbtransfer(source, destination, options)
         self.sleep(10)
         self.log.info("Checking whether number of items loaded match with the number of items restored.")
         rest = RestConnection(self.master)
         itemCount = rest.get_bucket_json('standard_bucket0')['basicStats']['itemCount']
         self.assertEqual(itemCount, self.num_items, msg="Number of items loaded do no match\
         with the number of items restored. Number of items loaded is {0} \
         but number of items restored is {1}".format(self.num_items, itemCount))
         self.log.info("Number of items loaded = Number of items restored. Pass!!")
     finally:
         shell_obj.disconnect()
示例#2
0
 def create_and_restore_csv(self):
     try:
         self.__load_data()
         shell_obj = RemoteMachineShellConnection(self.master)
         self.log.info("Removing backup folder if already present")
         info = shell_obj.extract_remote_info()
         path = "/tmp/backup/"
         if info.type.lower() == "windows":
             path = "/cygdrive/c" + path
         #TODO : Check for mac also
         shell_obj.delete_files(path)
         create_dir = "mkdir " + path
         data_type = "csv:"
         destination = path + "data.csv"
         shell_obj.execute_command(create_dir)
         source = "http://*****:*****@ %s" % destination)
         source, destination = destination, source
         options = "-B standard_bucket0" + self.username_arg + self.password_arg
         self.log.info("Restoring data....!")
         shell_obj.execute_cbtransfer(source, destination, options)
         self.sleep(10)
         self.log.info(
             "Checking whether number of items loaded match with the number of items restored."
         )
         rest = RestConnection(self.master)
         itemCount = rest.get_bucket_json(
             'standard_bucket0')['basicStats']['itemCount']
         self.assertEqual(itemCount,
                          self.num_items,
                          msg="Number of items loaded do no match\
         with the number of items restored. Number of items loaded is {0} \
         but number of items restored is {1}".format(
                              self.num_items, itemCount))
         self.log.info(
             "Number of items loaded = Number of items restored. Pass!!")
     finally:
         shell_obj.disconnect()