示例#1
0
    def test_method(self):
        self.logger.info(('-' * 20 + " %s " + '-' * 20), self.test_name)
        self.setup()

        success = False
        try:
            self.logger.info("running %s program", self.test_name)
            self.run_program(self.make_hdfs_input_path(),
                             self.make_hdfs_output_path())

            self.logger.info("now going to process output")
            self.logger.debug("""hadut.dfs("-get", %s, %s)""" %
                              (self.make_hdfs_output_path(), self.output_dir))
            hadut.dfs("-get", self.make_hdfs_output_path(), self.output_dir)
            self.process_output()
            success = True
        except Exception as e:
            self.logger.error("*" * 72)
            self.logger.error("Test %s raised an exception" % self.test_name)
            self.logger.error(e)
            self.logger.error("*" * 72)
        finally:
            self.logger.info("cleaning up")
            self.clean_up()
            self.logger.info('-' * (42 + len(self.test_name))
                             )  # close the test section with a horizontal line
            self.show_test_msg(success)

        return success
	def test_method(self):
		self.logger.info( ('-'*20 + " %s " + '-'*20), self.test_name)
		self.setup()

		success = False
		try:
			self.logger.info("running %s program", self.test_name)
			self.run_program(self.make_hdfs_input_path(), self.make_hdfs_output_path())

			self.logger.info("now going to process output")
			self.logger.debug("""hadut.dfs("-get", %s, %s)""" % (self.make_hdfs_output_path(), self.output_dir))
			hadut.dfs("-get", self.make_hdfs_output_path(), self.output_dir)
			self.process_output()
			success = True
		except Exception as e:
			self.logger.error("*"*72)
			self.logger.error("Test %s raised an exception" % self.test_name)
			self.logger.error(e)
			self.logger.error("*"*72)
		finally:
			self.logger.info("cleaning up")
			self.clean_up()
			self.logger.info( '-'*(42 + len(self.test_name)) ) # close the test section with a horizontal line
			self.show_test_msg(success)

		return success
	def setup(self):
		"""
		* Creates an hdfs directory with the name of this test (self.make_hdfs_test_path())
		* uploads the local 'input' directory into the hdfs directory
		"""
		hadut.run_hadoop_cmd_e("dfsadmin", args_list=["-safemode", "wait"])
		self.logger.debug("hdfs out of safe mode")

		if hadut.hdfs_path_exists(self.make_hdfs_test_path()):
			error_msg = "hdfs test path '%s' already exists.  Please remove it" % self.make_hdfs_test_path()
			self.logger.fatal(error_msg)
			raise RuntimeError(error_msg)

		hadut.dfs("-mkdir", self.make_hdfs_test_path())
		input_dir = self.make_hdfs_input_path()
		hadut.dfs("-put", self.make_local_input_path(), input_dir)
示例#4
0
    def setup(self):
        """
		* Creates an hdfs directory with the name of this test (self.make_hdfs_test_path())
		* uploads the local 'input' directory into the hdfs directory
		"""
        hadut.run_hadoop_cmd_e("dfsadmin", args_list=["-safemode", "wait"])
        self.logger.debug("hdfs out of safe mode")

        if hadut.hdfs_path_exists(self.make_hdfs_test_path()):
            error_msg = "hdfs test path '%s' already exists.  Please remove it" % self.make_hdfs_test_path(
            )
            self.logger.fatal(error_msg)
            raise RuntimeError(error_msg)

        hadut.dfs("-mkdir", self.make_hdfs_test_path())
        input_dir = self.make_hdfs_input_path()
        hadut.dfs("-put", self.make_local_input_path(), input_dir)
示例#5
0
    def clean_up(self):
        self.rm_output_dir()
        try:
            hadut.dfs("-rmr", self.make_hdfs_input_path())
        except Exception as e:
            self.logger.warning(e)
            pass

        try:
            hadut.dfs("-rmr", self.make_hdfs_output_path())
        except Exception as e:
            self.logger.warning(e)
            pass

        try:
            hadut.dfs("-rmr", self.make_hdfs_test_path())
        except Exception as e:
            self.logger.warning(e)
            pass
	def clean_up(self):
		self.rm_output_dir()
		try:
			hadut.dfs("-rmr", self.make_hdfs_input_path())
		except Exception as e:
			self.logger.warning(e)
			pass

		try:
			hadut.dfs("-rmr", self.make_hdfs_output_path())
		except Exception as e:
			self.logger.warning(e)
			pass

		try:
			hadut.dfs("-rmr", self.make_hdfs_test_path())
		except Exception as e:
			self.logger.warning(e)
			pass