Ejemplo n.º 1
0
 def test_get_replicas(self):
     self.assertEqual("0", HDFS("/").replicas(), "Root dir replicas should be 0")
     self.assertNotEqual("0", HDFS("/tmp").replicas(), "dir replicas should be 0")
     name = uuid.uuid4()
     hdfs_file = HDFS("/tmp/{0}".format(name))
     hdfs_file.create_file()
     shell.execute_shell_command("hadoop dfs", "-setrep -w 1 /tmp/{0}".format(name))
     if hdfs_file.exists():
         self.assertEqual("1", hdfs_file.replicas(), "Number replicas of file must be 1")
         hdfs_file.delete()
         self.assertFalse(hdfs_file.exists())
Ejemplo n.º 2
0
 def test_get_replicas(self):
     self.assertEqual('0', HDFS("/").replicas(), "Root dir replicas should be 0")
     self.assertNotEqual('0', HDFS("/tmp").replicas(), "dir replicas should be 0")
     name = uuid.uuid4()
     hdfs_file = HDFS("/tmp/{0}".format(name))
     hdfs_file.create_file()
     shell.execute_shell_command('hadoop dfs', '-setrep -w 1 /tmp/{0}'.format(name))
     if hdfs_file.exists():
         self.assertEqual('1',
                          hdfs_file.replicas(),
                          "Number replicas of file must be 1")
         hdfs_file.delete()
         self.assertFalse(hdfs_file.exists())