Exemplo n.º 1
0
 def test_validate_manager_deployment_size_success(self):
     # reusing the copying code, but actually there's no significance for
     # the directory being the "manager_dir" one; it's simply a directory
     # containing a "blueprint" (in this case, "file1")
     self._copy_manager1_dir_to_manager_dir()
     bootstrap.validate_manager_deployment_size(
         os.path.join(self.manager_dir, 'file1'))
Exemplo n.º 2
0
 def test_validate_manager_deployment_size_ignore_gitfile_success(self):
     # this test checks that the validation of the manager deployment size
     # also ignores the .git folder
     self._copy_manager1_dir_to_manager_dir()
     # getting the archive's size when compressed with the .git folder
     # included in the archive
     with patch.object(bootstrap, 'blueprint_archive_filter_func',
                       lambda tarinfo: tarinfo):
         archive_obj = bootstrap.tar_manager_deployment()
         manager_dep_size = len(archive_obj.getvalue())
     # setting the limit to be smaller than the archive's size when
     # compressed with the .git folder included in the archive
     with patch.object(bootstrap, 'MAX_MANAGER_DEPLOYMENT_SIZE',
                       manager_dep_size-1):
         # validation should pass as the limit is still bigger than
         # the size of the archive when the .git folder is excluded
         bootstrap.validate_manager_deployment_size(
             os.path.join(self.manager_dir, 'file1'))