diff options
author | Radostin Stoyanov <rstoyanov1@gmail.com> | 2018-04-10 16:40:22 +0100 |
---|---|---|
committer | Radostin Stoyanov <rstoyanov1@gmail.com> | 2018-04-10 17:27:02 +0100 |
commit | 6146e9ab5e36ff894b8c95d00a45db6181ad8472 (patch) | |
tree | e5458ad224a87ebca17b62d979c67b25ad9c1e57 /tests/docker_source.py | |
parent | 085529eb8413449ea66fdc509dfd55b43ec0016e (diff) | |
download | virt-bootstrap.git-6146e9ab5e36ff894b8c95d00a45db6181ad8472.tar.gz virt-bootstrap.git-6146e9ab5e36ff894b8c95d00a45db6181ad8472.tar.xz virt-bootstrap.git-6146e9ab5e36ff894b8c95d00a45db6181ad8472.zip |
docker-source: Support blobs without .tar ext
Since skopeo v0.1.29 blobs are saved without the .tar extension.
See commit: projectatomic/skopeo@43acc74
Fix skopeo tests with changes to dir transport
The dir transport has been changed to save the blobs without the .tar extension
Fixes the skopeo tests failing due to this change
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
Diffstat (limited to 'tests/docker_source.py')
-rw-r--r-- | tests/docker_source.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/docker_source.py b/tests/docker_source.py index 758cb97..f569eeb 100644 --- a/tests/docker_source.py +++ b/tests/docker_source.py @@ -335,9 +335,12 @@ class TestDockerSource(unittest.TestCase): } manifest = {'schemaVersion': 2, 'Layers': ['sha256:a7050fc1']} - (src_instance, - m_uri, m_utils) = self._mock_retrieve_layers_info(manifest, - src_kwargs) + + with mock.patch('os.path.isfile') as m_isfile: + m_isfile.return_value = True + result = self._mock_retrieve_layers_info(manifest, src_kwargs) + + src_instance, m_uri, m_utils = result kwargs = { 'insecure': src_instance.insecure, @@ -373,7 +376,9 @@ class TestDockerSource(unittest.TestCase): ['/images_path/75c416ea.tar', None] ] - with mock.patch('os.path.getsize') as m_getsize: + with mock.patch('os.path.getsize') as m_getsize, \ + mock.patch('os.path.isfile') as m_isfile: m_getsize.return_value = None + m_isfile.side_effect = lambda x: x.endswith(".tar") src_instance = self._mock_retrieve_layers_info(manifest, kwargs)[0] self.assertEqual(src_instance.layers, expected_result) |