diff options
author | Michał Górny <mgorny@gentoo.org> | 2017-10-29 18:03:54 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2017-10-29 18:03:54 +0100 |
commit | 30297b085e00187e00eed32022bd085a47c2df4d (patch) | |
tree | 3975a6f44f92edd03a7e05651ffe5b53e2ea63b9 /tests/test_recursiveloader.py | |
parent | f8b8a2b993bb2c7a54052667f33fc3d35a52604d (diff) | |
download | gemato-30297b085e00187e00eed32022bd085a47c2df4d.tar.gz |
cli: Add compression and forcing options
Diffstat (limited to 'tests/test_recursiveloader.py')
-rw-r--r-- | tests/test_recursiveloader.py | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/tests/test_recursiveloader.py b/tests/test_recursiveloader.py index 9521c2e..6f8f4e1 100644 --- a/tests/test_recursiveloader.py +++ b/tests/test_recursiveloader.py @@ -879,6 +879,30 @@ DATA test 0 MD5 d41d8cd98f00b204e9800998ecf8427e self.assertTrue(os.path.exists( os.path.join(self.dir, 'Manifest'))) + def test_cli_compress_manifests_low_watermark(self): + self.assertEqual( + gemato.cli.main(['gemato', 'update', + '--hashes=SHA256 SHA512', + '--compress-watermark=0', + self.dir]), + 0) + self.assertFalse(os.path.exists( + os.path.join(self.dir, 'Manifest'))) + self.assertTrue(os.path.exists( + os.path.join(self.dir, 'Manifest.gz'))) + + def test_cli_compress_manifests_high_watermark(self): + self.assertEqual( + gemato.cli.main(['gemato', 'update', + '--hashes=SHA256 SHA512', + '--compress-watermark=4096', + self.dir]), + 0) + self.assertFalse(os.path.exists( + os.path.join(self.dir, 'Manifest.gz'))) + self.assertTrue(os.path.exists( + os.path.join(self.dir, 'Manifest'))) + class DuplicateManifestFileEntryTest(TempDirTestCase): """ @@ -1915,6 +1939,30 @@ DATA test 0 MD5 d41d8cd98f00b204e9800998ecf8427e self.assertTrue(os.path.exists( os.path.join(self.dir, 'Manifest'))) + def test_cli_decompress_manifests_low_watermark(self): + self.assertEqual( + gemato.cli.main(['gemato', 'update', + '--hashes=SHA256 SHA512', + '--compress-watermark=0', + self.dir]), + 0) + self.assertFalse(os.path.exists( + os.path.join(self.dir, 'Manifest'))) + self.assertTrue(os.path.exists( + os.path.join(self.dir, 'Manifest.gz'))) + + def test_cli_decompress_manifests_high_watermark(self): + self.assertEqual( + gemato.cli.main(['gemato', 'update', + '--hashes=SHA256 SHA512', + '--compress-watermark=4096', + self.dir]), + 0) + self.assertFalse(os.path.exists( + os.path.join(self.dir, 'Manifest.gz'))) + self.assertTrue(os.path.exists( + os.path.join(self.dir, 'Manifest'))) + class CompressedSubManifestTest(TempDirTestCase): """ @@ -2010,6 +2058,38 @@ MANIFEST sub/Manifest.gz 78 MD5 9c158f87b2445279d7c8aac439612fba self.assertFalse(os.path.exists( os.path.join(self.dir, 'sub/Manifest.gz'))) + def test_cli_recompress_manifests_low_watermark(self): + self.assertEqual( + gemato.cli.main(['gemato', 'update', + '--hashes=SHA256 SHA512', + '--compress-watermark=0', + self.dir]), + 0) + self.assertTrue(os.path.exists( + os.path.join(self.dir, 'Manifest.gz'))) + self.assertTrue(os.path.exists( + os.path.join(self.dir, 'sub/Manifest.gz'))) + self.assertFalse(os.path.exists( + os.path.join(self.dir, 'Manifest'))) + self.assertFalse(os.path.exists( + os.path.join(self.dir, 'sub/Manifest'))) + + def test_cli_recompress_manifests_high_watermark(self): + self.assertEqual( + gemato.cli.main(['gemato', 'update', + '--hashes=SHA256 SHA512', + '--compress-watermark=4096', + self.dir]), + 0) + self.assertTrue(os.path.exists( + os.path.join(self.dir, 'Manifest'))) + self.assertTrue(os.path.exists( + os.path.join(self.dir, 'sub/Manifest'))) + self.assertFalse(os.path.exists( + os.path.join(self.dir, 'Manifest.gz'))) + self.assertFalse(os.path.exists( + os.path.join(self.dir, 'sub/Manifest.gz'))) + class CompressedManifestOrderingTest(TempDirTestCase): """ @@ -2319,6 +2399,30 @@ class CreateNewManifestTest(TempDirTestCase): self.assertTrue(os.path.exists( os.path.join(self.dir, 'Manifest'))) + def test_cli_compress_manifests_low_watermark(self): + self.assertEqual( + gemato.cli.main(['gemato', 'create', + '--hashes=SHA256 SHA512', + '--compress-watermark=0', + os.path.join(self.dir, 'Manifest')]), + 0) + self.assertFalse(os.path.exists( + os.path.join(self.dir, 'Manifest'))) + self.assertTrue(os.path.exists( + os.path.join(self.dir, 'Manifest.gz'))) + + def test_cli_compress_manifests_high_watermark(self): + self.assertEqual( + gemato.cli.main(['gemato', 'create', + '--hashes=SHA256 SHA512', + '--compress-watermark=4096', + os.path.join(self.dir, 'Manifest')]), + 0) + self.assertFalse(os.path.exists( + os.path.join(self.dir, 'Manifest.gz'))) + self.assertTrue(os.path.exists( + os.path.join(self.dir, 'Manifest'))) + class CreateNewCompressedManifestTest(TempDirTestCase): DIRS = ['sub'] |