def test_dont_run_after_sync_local_commands(self): cb = CB( config='tests/minimal_config.yaml', data_dir=self.data_dir, ) cb.create_images(no_tests=True) cb.sync(create_remote_dirs=False)
def setUpClass(cls): cls.work_dir = Path('/tmp/cloud-build') os.makedirs(cls.work_dir / 'external_files/p9/x86_64', exist_ok=True) (cls.work_dir / 'external_files/p9/x86_64/README').write_text('README') config = cls.work_dir / 'config.yaml' branch = cls.branch arch = cls.arch remote = Path('/tmp/cloud-build/images') if branch: remote = remote / '{branch}' if arch: remote = remote / '{arch}' remote = (remote / 'cloud').as_posix() change( 'tests/test_integration_images.yaml', config, 'remote', remote, ) with ExitStack() as stack: stack.enter_context(mock.patch('subprocess.call', Call())) cloud_build = CB( config=config, data_dir=(cls.work_dir / 'cloud_build').as_posix(), ) cloud_build.create_images(no_tests=True) cloud_build.copy_external_files() cloud_build.sign() cloud_build.sync(create_remote_dirs=True) images_dir = cls.work_dir / 'images' cls.images_dir = images_dir images = defaultdict(lambda: defaultdict(list)) if branch: for branch in os.listdir(images_dir): if arch: for arch in os.listdir(images_dir / branch): images[branch][arch] = os.listdir(images_dir / branch / arch / 'cloud') else: images[branch]['arch'] = os.listdir(images_dir / branch / 'cloud') elif arch: for arch in os.listdir(images_dir): images['branch'][arch] = os.listdir(images_dir / arch / 'cloud') else: images['branch']['arch'] = os.listdir(images_dir / 'cloud') cls._images = images
def test_no_delete_true(self): cb = CB( config='tests/test_no_delete_true.yaml', data_dir=self.data_dir, ) other_file = self.images_dir / 'other_file.txt' other_file.write_text('Some text') cb.create_images(no_tests=True) cb.sync(create_remote_dirs=True) del cb msg = 'Other files shoud not be deleted if no_delete' if not other_file.exists(): self.fail(msg)
def setUpClass(cls): cls.work_dir = Path('/tmp/cloud-build') os.makedirs(cls.work_dir, exist_ok=True) renamer(cls.work_dir) with ExitStack() as stack: stack.enter_context(mock.patch('subprocess.call', Call())) cloud_build = CB( config='tests/test_rename.yaml', data_dir=(cls.work_dir / 'cloud_build').as_posix(), ) cloud_build.create_images(no_tests=True) cloud_build.sync(create_remote_dirs=True) images_dir = cls.work_dir / 'images' cls.images = os.listdir(images_dir)