Beispiel #1
0
 def test_add_absolute_archive(self):
     # Given
     archive_extractor = ArchiveExtractor(oozie_node=Element("fake"), props=self.props)
     # When
     archive_extractor.add_archive("/test_archive.zip")
     # Then
     self.assertEqual(["/test_archive.zip"], archive_extractor.archives)
     self.assertEqual(["hdfs:///test_archive.zip"], archive_extractor.hdfs_archives)
 def test_add_absolute_archive(self):
     # Given
     archive_extractor = ArchiveExtractor(oozie_node=Element("fake"),
                                          params=self.default_params)
     # When
     archive_extractor.add_archive("/test_archive.zip")
     # Then
     self.assertEqual(archive_extractor.archives, ["/test_archive.zip"])
     self.assertEqual(archive_extractor.hdfs_archives,
                      ["hdfs:///test_archive.zip"])
Beispiel #3
0
 def test_add_archive_extra_hash(self):
     # Given
     archive_extractor = ArchiveExtractor(oozie_node=Element("fake"), props=self.props)
     # When
     with self.assertRaises(Exception) as context:
         archive_extractor.add_archive("/test_archive.zip#4rarear#")
     # Then
     self.assertEqual(
         "There should be maximum one '#' in the path /test_archive.zip#4rarear#", str(context.exception)
     )
Beispiel #4
0
 def test_add_relative_archive(self):
     # Given
     archive_extractor = ArchiveExtractor(oozie_node=Element("fake"), props=self.props)
     # When
     archive_extractor.add_archive("test_archive.zip")
     # Then
     self.assertEqual(["test_archive.zip"], archive_extractor.archives)
     self.assertEqual(
         ["hdfs:///user/pig/examples/pig_test_node/test_archive.zip"], archive_extractor.hdfs_archives
     )
Beispiel #5
0
 def test_add_multiple_archives(self):
     # Given
     archive_extractor = ArchiveExtractor(oozie_node=Element("fake"), props=self.props)
     # When
     archive_extractor.add_archive("/test_archive.zip")
     archive_extractor.add_archive("test_archive2.tar")
     archive_extractor.add_archive("/test_archive3.tar.gz")
     # Then
     self.assertEqual(
         archive_extractor.archives, ["/test_archive.zip", "test_archive2.tar", "/test_archive3.tar.gz"]
     )
     self.assertEqual(
         archive_extractor.hdfs_archives,
         [
             "hdfs:///test_archive.zip",
             "hdfs:///user/pig/examples/pig_test_node/test_archive2.tar",
             "hdfs:///test_archive3.tar.gz",
         ],
     )
 def test_add_hash_archives(self):
     # Given
     archive_extractor = ArchiveExtractor(oozie_node=Element("fake"),
                                          params=self.default_params)
     # When
     archive_extractor.add_archive("/test_archive.zip#test3_link")
     archive_extractor.add_archive("test_archive2.tar#test_link")
     archive_extractor.add_archive("/test_archive3.tar.gz")
     # Then
     self.assertEqual(
         archive_extractor.archives,
         [
             "/test_archive.zip#test3_link", "test_archive2.tar#test_link",
             "/test_archive3.tar.gz"
         ],
     )
     self.assertEqual(
         archive_extractor.hdfs_archives,
         [
             "hdfs:///test_archive.zip#test3_link",
             "hdfs:///user/pig/examples/pig_test_node/test_archive2.tar#test_link",
             "hdfs:///test_archive3.tar.gz",
         ],
     )