[ostree] Move cloning repo back to compose box

and pass absolute path to the config into runroot. This could avoid the
problem of not being able to clone the repo in runroot.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-04-07 14:33:37 +02:00
parent b7948f2d65
commit e705cdd165
4 changed files with 55 additions and 80 deletions

View file

@ -17,38 +17,23 @@ from pungi import ostree
class OstreeScriptTest(helpers.PungiTestCase):
def _dummy_config_repo(self, scm_dict, target, logger=None):
helpers.touch(os.path.join(target, 'fedora-atomic-docker-host.json'))
helpers.touch(os.path.join(target, 'fedora-rawhide.repo'))
@mock.patch('kobo.shortcuts.run')
@mock.patch('pungi.wrappers.scm.get_dir_from_scm')
def test_full_run(self, get_dir_from_scm, run):
get_dir_from_scm.side_effect = self._dummy_config_repo
def test_full_run(self, run):
repo = os.path.join(self.topdir, 'atomic')
ostree.main([
'--log-dir={}'.format(os.path.join(self.topdir, 'logs', 'Atomic')),
'--work-dir={}'.format(self.topdir),
'--treefile={}'.format('fedora-atomic-docker-host.json'),
'--config-url=https://git.fedorahosted.org/git/fedora-atomic.git',
'--config-branch=f24',
'--source-repo=https://kojipkgs.fedoraproject.org/repo',
'--treefile={}/fedora-atomic-docker-host.json'.format(self.topdir),
repo,
])
self.maxDiff = None
self.assertEqual(get_dir_from_scm.call_args_list,
[mock.call({'scm': 'git', 'repo': 'https://git.fedorahosted.org/git/fedora-atomic.git',
'branch': 'f24', 'dir': '.'},
self.topdir + '/config_repo')])
self.assertItemsEqual(
run.call_args_list,
[mock.call(['ostree', 'init', '--repo={}'.format(repo), '--mode=archive-z2'],
logfile=self.topdir + '/logs/Atomic/init-ostree-repo.log', show_cmd=True),
mock.call(['rpm-ostree', 'compose', 'tree', '--repo={}'.format(repo),
self.topdir + '/config_repo/fedora-atomic-docker-host.json'],
self.topdir + '/fedora-atomic-docker-host.json'],
logfile=self.topdir + '/logs/Atomic/create-ostree-repo.log', show_cmd=True)])