Remove usage of unittest2 on Python 3
It was needed to provide assertItemsEqual method. Starting with Python 3.2, there's assertCountEqual that does the same thing. Six provides a helper that will dispatch to the existing method. With this change, unittest 2 is only needed on Python 2.6 to backport the method. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
43fb06e00f
commit
2f54745715
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
import six
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
@ -101,14 +102,16 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
# Server.x86_64, Client.amd64, Server.x86_64
|
# Server.x86_64, Client.amd64, Server.x86_64
|
||||||
pool = poolCls.return_value
|
pool = poolCls.return_value
|
||||||
self.assertEqual(3, len(pool.queue_put.mock_calls))
|
self.assertEqual(3, len(pool.queue_put.mock_calls))
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
[call[0][0][3] for call in pool.queue_put.call_args_list],
|
[call[0][0][3] for call in pool.queue_put.call_args_list],
|
||||||
['rm -rf %s/work/amd64/buildinstall/Client && lorax ...' % self.topdir,
|
['rm -rf %s/work/amd64/buildinstall/Client && lorax ...' % self.topdir,
|
||||||
'rm -rf %s/work/amd64/buildinstall/Server && lorax ...' % self.topdir,
|
'rm -rf %s/work/amd64/buildinstall/Server && lorax ...' % self.topdir,
|
||||||
'rm -rf %s/work/x86_64/buildinstall/Server && lorax ...' % self.topdir])
|
'rm -rf %s/work/x86_64/buildinstall/Server && lorax ...' % self.topdir])
|
||||||
|
|
||||||
# Obtained correct lorax commands.
|
# Obtained correct lorax commands.
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
||||||
[mock.call('Test', '1', '1',
|
[mock.call('Test', '1', '1',
|
||||||
[self.topdir + "/work/x86_64/repo/p1",
|
[self.topdir + "/work/x86_64/repo/p1",
|
||||||
@ -146,7 +149,8 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
add_template_var=[], add_arch_template_var=[],
|
add_template_var=[], add_arch_template_var=[],
|
||||||
rootfs_size=None,
|
rootfs_size=None,
|
||||||
log_dir=self.topdir + '/logs/amd64/buildinstall-Client-logs')])
|
log_dir=self.topdir + '/logs/amd64/buildinstall-Client-logs')])
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
get_volid.mock_calls,
|
get_volid.mock_calls,
|
||||||
[mock.call(compose, 'x86_64', variant=compose.variants['Server'], disc_type='DVD'),
|
[mock.call(compose, 'x86_64', variant=compose.variants['Server'], disc_type='DVD'),
|
||||||
mock.call(compose, 'amd64', variant=compose.variants['Client'], disc_type='DVD'),
|
mock.call(compose, 'amd64', variant=compose.variants['Client'], disc_type='DVD'),
|
||||||
@ -174,7 +178,7 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
|
|
||||||
pool = poolCls.return_value
|
pool = poolCls.return_value
|
||||||
self.assertEqual(1, len(pool.queue_put.mock_calls))
|
self.assertEqual(1, len(pool.queue_put.mock_calls))
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
[call[0][0][3] for call in pool.queue_put.call_args_list],
|
[call[0][0][3] for call in pool.queue_put.call_args_list],
|
||||||
['rm -rf %s/work/amd64/buildinstall/Client && lorax ...' % self.topdir])
|
['rm -rf %s/work/amd64/buildinstall/Client && lorax ...' % self.topdir])
|
||||||
|
|
||||||
@ -193,7 +197,7 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
rootfs_size=None,
|
rootfs_size=None,
|
||||||
log_dir=self.topdir + '/logs/amd64/buildinstall-Client-logs')],
|
log_dir=self.topdir + '/logs/amd64/buildinstall-Client-logs')],
|
||||||
any_order=True)
|
any_order=True)
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
get_volid.mock_calls,
|
get_volid.mock_calls,
|
||||||
[mock.call(compose, 'amd64', variant=compose.variants['Client'], disc_type='dvd')])
|
[mock.call(compose, 'amd64', variant=compose.variants['Client'], disc_type='dvd')])
|
||||||
|
|
||||||
@ -221,7 +225,8 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
self.assertEqual(2, len(pool.queue_put.mock_calls))
|
self.assertEqual(2, len(pool.queue_put.mock_calls))
|
||||||
|
|
||||||
# Obtained correct lorax commands.
|
# Obtained correct lorax commands.
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
loraxCls.return_value.get_buildinstall_cmd.mock_calls,
|
loraxCls.return_value.get_buildinstall_cmd.mock_calls,
|
||||||
[mock.call('Test', '1', '1', [self.topdir + "/work/x86_64/repo/p1"],
|
[mock.call('Test', '1', '1', [self.topdir + "/work/x86_64/repo/p1"],
|
||||||
self.topdir + '/work/x86_64/buildinstall',
|
self.topdir + '/work/x86_64/buildinstall',
|
||||||
@ -229,7 +234,8 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
mock.call('Test', '1', '1', [self.topdir + "/work/amd64/repo/p1"],
|
mock.call('Test', '1', '1', [self.topdir + "/work/amd64/repo/p1"],
|
||||||
self.topdir + '/work/amd64/buildinstall',
|
self.topdir + '/work/amd64/buildinstall',
|
||||||
buildarch='amd64', is_final=True, volid='vol_id')])
|
buildarch='amd64', is_final=True, volid='vol_id')])
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
get_volid.mock_calls,
|
get_volid.mock_calls,
|
||||||
[mock.call(compose, 'x86_64', disc_type='DVD'),
|
[mock.call(compose, 'x86_64', disc_type='DVD'),
|
||||||
mock.call(compose, 'amd64', disc_type='DVD')])
|
mock.call(compose, 'amd64', disc_type='DVD')])
|
||||||
@ -276,14 +282,16 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
# Server.x86_64, Client.amd64, Server.x86_64
|
# Server.x86_64, Client.amd64, Server.x86_64
|
||||||
pool = poolCls.return_value
|
pool = poolCls.return_value
|
||||||
self.assertEqual(3, len(pool.queue_put.mock_calls))
|
self.assertEqual(3, len(pool.queue_put.mock_calls))
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
[call[0][0][3] for call in pool.queue_put.call_args_list],
|
[call[0][0][3] for call in pool.queue_put.call_args_list],
|
||||||
['rm -rf %s/work/amd64/buildinstall/Client && lorax ...' % self.topdir,
|
['rm -rf %s/work/amd64/buildinstall/Client && lorax ...' % self.topdir,
|
||||||
'rm -rf %s/work/amd64/buildinstall/Server && lorax ...' % self.topdir,
|
'rm -rf %s/work/amd64/buildinstall/Server && lorax ...' % self.topdir,
|
||||||
'rm -rf %s/work/x86_64/buildinstall/Server && lorax ...' % self.topdir])
|
'rm -rf %s/work/x86_64/buildinstall/Server && lorax ...' % self.topdir])
|
||||||
|
|
||||||
# Obtained correct lorax commands.
|
# Obtained correct lorax commands.
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
||||||
[mock.call('Test', '1.2.3', '1.2.3',
|
[mock.call('Test', '1.2.3', '1.2.3',
|
||||||
[self.topdir + "/work/x86_64/repo/p1",
|
[self.topdir + "/work/x86_64/repo/p1",
|
||||||
@ -318,7 +326,8 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
add_template_var=[], add_arch_template_var=[],
|
add_template_var=[], add_arch_template_var=[],
|
||||||
rootfs_size=None,
|
rootfs_size=None,
|
||||||
log_dir=self.topdir + '/logs/amd64/buildinstall-Client-logs')])
|
log_dir=self.topdir + '/logs/amd64/buildinstall-Client-logs')])
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
get_volid.mock_calls,
|
get_volid.mock_calls,
|
||||||
[mock.call(compose, 'x86_64', variant=compose.variants['Server'], disc_type='dvd'),
|
[mock.call(compose, 'x86_64', variant=compose.variants['Server'], disc_type='dvd'),
|
||||||
mock.call(compose, 'amd64', variant=compose.variants['Client'], disc_type='dvd'),
|
mock.call(compose, 'amd64', variant=compose.variants['Client'], disc_type='dvd'),
|
||||||
@ -353,14 +362,16 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
# Server.x86_64, Client.amd64, Server.x86_64
|
# Server.x86_64, Client.amd64, Server.x86_64
|
||||||
pool = poolCls.return_value
|
pool = poolCls.return_value
|
||||||
self.assertEqual(3, len(pool.queue_put.mock_calls))
|
self.assertEqual(3, len(pool.queue_put.mock_calls))
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
[call[0][0][3] for call in pool.queue_put.call_args_list],
|
[call[0][0][3] for call in pool.queue_put.call_args_list],
|
||||||
['rm -rf %s/work/amd64/buildinstall/Client && lorax ...' % self.topdir,
|
['rm -rf %s/work/amd64/buildinstall/Client && lorax ...' % self.topdir,
|
||||||
'rm -rf %s/work/amd64/buildinstall/Server && lorax ...' % self.topdir,
|
'rm -rf %s/work/amd64/buildinstall/Server && lorax ...' % self.topdir,
|
||||||
'rm -rf %s/work/x86_64/buildinstall/Server && lorax ...' % self.topdir])
|
'rm -rf %s/work/x86_64/buildinstall/Server && lorax ...' % self.topdir])
|
||||||
|
|
||||||
# Obtained correct lorax commands.
|
# Obtained correct lorax commands.
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
||||||
[mock.call('Test', '1', '1',
|
[mock.call('Test', '1', '1',
|
||||||
[self.topdir + "/work/x86_64/repo/p1",
|
[self.topdir + "/work/x86_64/repo/p1",
|
||||||
@ -395,7 +406,8 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
add_template_var=[], add_arch_template_var=[],
|
add_template_var=[], add_arch_template_var=[],
|
||||||
rootfs_size=None,
|
rootfs_size=None,
|
||||||
log_dir=self.topdir + '/logs/amd64/buildinstall-Client-logs')])
|
log_dir=self.topdir + '/logs/amd64/buildinstall-Client-logs')])
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
get_volid.mock_calls,
|
get_volid.mock_calls,
|
||||||
[mock.call(compose, 'x86_64', variant=compose.variants['Server'], disc_type='dvd'),
|
[mock.call(compose, 'x86_64', variant=compose.variants['Server'], disc_type='dvd'),
|
||||||
mock.call(compose, 'amd64', variant=compose.variants['Client'], disc_type='dvd'),
|
mock.call(compose, 'amd64', variant=compose.variants['Client'], disc_type='dvd'),
|
||||||
@ -430,14 +442,16 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
# Server.x86_64, Client.amd64, Server.x86_64
|
# Server.x86_64, Client.amd64, Server.x86_64
|
||||||
pool = poolCls.return_value
|
pool = poolCls.return_value
|
||||||
self.assertEqual(3, len(pool.queue_put.mock_calls))
|
self.assertEqual(3, len(pool.queue_put.mock_calls))
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
[call[0][0][3] for call in pool.queue_put.call_args_list],
|
[call[0][0][3] for call in pool.queue_put.call_args_list],
|
||||||
['rm -rf %s/amd64/Client && lorax ...' % buildinstall_topdir,
|
['rm -rf %s/amd64/Client && lorax ...' % buildinstall_topdir,
|
||||||
'rm -rf %s/amd64/Server && lorax ...' % buildinstall_topdir,
|
'rm -rf %s/amd64/Server && lorax ...' % buildinstall_topdir,
|
||||||
'rm -rf %s/x86_64/Server && lorax ...' % buildinstall_topdir])
|
'rm -rf %s/x86_64/Server && lorax ...' % buildinstall_topdir])
|
||||||
|
|
||||||
# Obtained correct lorax commands.
|
# Obtained correct lorax commands.
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
||||||
[mock.call('Test', '1', '1',
|
[mock.call('Test', '1', '1',
|
||||||
["http://localhost/work/x86_64/repo/p1",
|
["http://localhost/work/x86_64/repo/p1",
|
||||||
@ -472,7 +486,8 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
add_template_var=[], add_arch_template_var=[],
|
add_template_var=[], add_arch_template_var=[],
|
||||||
rootfs_size=None,
|
rootfs_size=None,
|
||||||
log_dir=buildinstall_topdir + '/amd64/Client/logs')])
|
log_dir=buildinstall_topdir + '/amd64/Client/logs')])
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
get_volid.mock_calls,
|
get_volid.mock_calls,
|
||||||
[mock.call(compose, 'x86_64', variant=compose.variants['Server'], disc_type='dvd'),
|
[mock.call(compose, 'x86_64', variant=compose.variants['Server'], disc_type='dvd'),
|
||||||
mock.call(compose, 'amd64', variant=compose.variants['Client'], disc_type='dvd'),
|
mock.call(compose, 'amd64', variant=compose.variants['Client'], disc_type='dvd'),
|
||||||
@ -506,7 +521,8 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
phase.run()
|
phase.run()
|
||||||
|
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
||||||
[mock.call('Test', '1', '1',
|
[mock.call('Test', '1', '1',
|
||||||
[self.topdir + "/work/x86_64/repo/p1",
|
[self.topdir + "/work/x86_64/repo/p1",
|
||||||
@ -588,7 +604,7 @@ class BuildinstallThreadTestCase(PungiTestCase):
|
|||||||
t.process((compose, 'x86_64', compose.variants['Server'], self.cmd), 0)
|
t.process((compose, 'x86_64', compose.variants['Server'], self.cmd), 0)
|
||||||
|
|
||||||
destdir = os.path.join(self.topdir, "work/x86_64/buildinstall/Server")
|
destdir = os.path.join(self.topdir, "work/x86_64/buildinstall/Server")
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
get_runroot_cmd.mock_calls,
|
get_runroot_cmd.mock_calls,
|
||||||
[mock.call(
|
[mock.call(
|
||||||
'rrt', 'x86_64', self.cmd, channel=None,
|
'rrt', 'x86_64', self.cmd, channel=None,
|
||||||
@ -599,14 +615,14 @@ class BuildinstallThreadTestCase(PungiTestCase):
|
|||||||
os.path.join(self.topdir, "logs/x86_64/buildinstall-Server-logs"),
|
os.path.join(self.topdir, "logs/x86_64/buildinstall-Server-logs"),
|
||||||
],
|
],
|
||||||
)])
|
)])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
run_runroot_cmd.mock_calls,
|
run_runroot_cmd.mock_calls,
|
||||||
[mock.call(get_runroot_cmd.return_value,
|
[mock.call(get_runroot_cmd.return_value,
|
||||||
log_file=self.topdir + '/logs/x86_64/buildinstall-Server.x86_64.log')])
|
log_file=self.topdir + '/logs/x86_64/buildinstall-Server.x86_64.log')])
|
||||||
with open(self.topdir + '/logs/x86_64/buildinstall-Server-RPMs.x86_64.log') as f:
|
with open(self.topdir + '/logs/x86_64/buildinstall-Server-RPMs.x86_64.log') as f:
|
||||||
rpms = f.read().strip().split('\n')
|
rpms = f.read().strip().split('\n')
|
||||||
self.assertItemsEqual(rpms, ['bash', 'zsh'])
|
six.assertCountEqual(self, rpms, ["bash", "zsh"])
|
||||||
self.assertItemsEqual(self.pool.finished_tasks, [('Server', 'x86_64')])
|
six.assertCountEqual(self, self.pool.finished_tasks, [("Server", "x86_64")])
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
mock_tweak.call_args_list,
|
mock_tweak.call_args_list,
|
||||||
@ -659,7 +675,7 @@ class BuildinstallThreadTestCase(PungiTestCase):
|
|||||||
t.process((compose, "amd64", None, self.cmd), 0)
|
t.process((compose, "amd64", None, self.cmd), 0)
|
||||||
|
|
||||||
destdir = os.path.join(self.topdir, "work/amd64/buildinstall")
|
destdir = os.path.join(self.topdir, "work/amd64/buildinstall")
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
get_runroot_cmd.mock_calls,
|
get_runroot_cmd.mock_calls,
|
||||||
[mock.call(
|
[mock.call(
|
||||||
"rrt", "amd64", self.cmd, channel=None,
|
"rrt", "amd64", self.cmd, channel=None,
|
||||||
@ -667,15 +683,16 @@ class BuildinstallThreadTestCase(PungiTestCase):
|
|||||||
packages=['anaconda'], mounts=[self.topdir], weight=None,
|
packages=['anaconda'], mounts=[self.topdir], weight=None,
|
||||||
chown_paths=[destdir],
|
chown_paths=[destdir],
|
||||||
)])
|
)])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
run_runroot_cmd.mock_calls,
|
run_runroot_cmd.mock_calls,
|
||||||
[mock.call(get_runroot_cmd.return_value,
|
[mock.call(get_runroot_cmd.return_value,
|
||||||
log_file=self.topdir + "/logs/amd64/buildinstall.amd64.log")])
|
log_file=self.topdir + "/logs/amd64/buildinstall.amd64.log")])
|
||||||
with open(self.topdir + "/logs/amd64/buildinstall-RPMs.amd64.log") as f:
|
with open(self.topdir + "/logs/amd64/buildinstall-RPMs.amd64.log") as f:
|
||||||
rpms = f.read().strip().split('\n')
|
rpms = f.read().strip().split('\n')
|
||||||
self.assertItemsEqual(rpms, ['bash', 'zsh'])
|
six.assertCountEqual(self, rpms, ["bash", "zsh"])
|
||||||
self.assertItemsEqual(self.pool.finished_tasks, [(None, 'amd64')])
|
six.assertCountEqual(self, self.pool.finished_tasks, [(None, "amd64")])
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
mock_tweak.call_args_list,
|
mock_tweak.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -691,7 +708,8 @@ class BuildinstallThreadTestCase(PungiTestCase):
|
|||||||
for var in ["Client", "Server"]
|
for var in ["Client", "Server"]
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
mock_link.call_args_list,
|
mock_link.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(compose, "amd64", compose.variants["Client"], False),
|
mock.call(compose, "amd64", compose.variants["Client"], False),
|
||||||
@ -731,7 +749,7 @@ class BuildinstallThreadTestCase(PungiTestCase):
|
|||||||
mock.call('Runroot task failed: 1234. See %s/logs/x86_64/buildinstall.x86_64.log for more details.'
|
mock.call('Runroot task failed: 1234. See %s/logs/x86_64/buildinstall.x86_64.log for more details.'
|
||||||
% self.topdir)
|
% self.topdir)
|
||||||
])
|
])
|
||||||
self.assertItemsEqual(self.pool.finished_tasks, [])
|
self.assertEqual(self.pool.finished_tasks, set())
|
||||||
|
|
||||||
@mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper')
|
@mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper')
|
||||||
@mock.patch('pungi.wrappers.kojiwrapper.get_buildroot_rpms')
|
@mock.patch('pungi.wrappers.kojiwrapper.get_buildroot_rpms')
|
||||||
@ -764,7 +782,7 @@ class BuildinstallThreadTestCase(PungiTestCase):
|
|||||||
mock.call('[FAIL] Buildinstall (variant Server, arch x86_64) failed, but going on anyway.'),
|
mock.call('[FAIL] Buildinstall (variant Server, arch x86_64) failed, but going on anyway.'),
|
||||||
mock.call('Runroot task failed: 1234. See %s/logs/x86_64/buildinstall-Server.x86_64.log for more details.' % self.topdir)
|
mock.call('Runroot task failed: 1234. See %s/logs/x86_64/buildinstall-Server.x86_64.log for more details.' % self.topdir)
|
||||||
])
|
])
|
||||||
self.assertItemsEqual(self.pool.finished_tasks, [])
|
self.assertEqual(self.pool.finished_tasks, set())
|
||||||
|
|
||||||
@mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper')
|
@mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper')
|
||||||
@mock.patch('pungi.wrappers.kojiwrapper.get_buildroot_rpms')
|
@mock.patch('pungi.wrappers.kojiwrapper.get_buildroot_rpms')
|
||||||
@ -792,7 +810,7 @@ class BuildinstallThreadTestCase(PungiTestCase):
|
|||||||
self.assertEqual(0, len(run.mock_calls))
|
self.assertEqual(0, len(run.mock_calls))
|
||||||
|
|
||||||
self.assertTrue(os.path.exists(dummy_file))
|
self.assertTrue(os.path.exists(dummy_file))
|
||||||
self.assertItemsEqual(self.pool.finished_tasks, [])
|
self.assertEqual(self.pool.finished_tasks, set())
|
||||||
|
|
||||||
@mock.patch('pungi.phases.buildinstall.link_boot_iso')
|
@mock.patch('pungi.phases.buildinstall.link_boot_iso')
|
||||||
@mock.patch('pungi.phases.buildinstall.tweak_buildinstall')
|
@mock.patch('pungi.phases.buildinstall.tweak_buildinstall')
|
||||||
@ -827,7 +845,7 @@ class BuildinstallThreadTestCase(PungiTestCase):
|
|||||||
with mock.patch('time.sleep'):
|
with mock.patch('time.sleep'):
|
||||||
t.process((compose, 'x86_64', compose.variants['Server'], self.cmd), 0)
|
t.process((compose, 'x86_64', compose.variants['Server'], self.cmd), 0)
|
||||||
|
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
get_runroot_cmd.mock_calls,
|
get_runroot_cmd.mock_calls,
|
||||||
[mock.call(
|
[mock.call(
|
||||||
'rrt', 'x86_64', self.cmd, channel=None,
|
'rrt', 'x86_64', self.cmd, channel=None,
|
||||||
@ -838,18 +856,19 @@ class BuildinstallThreadTestCase(PungiTestCase):
|
|||||||
"/buildinstall_topdir/buildinstall-%s/x86_64/Server/logs" % os.path.basename(self.topdir),
|
"/buildinstall_topdir/buildinstall-%s/x86_64/Server/logs" % os.path.basename(self.topdir),
|
||||||
],
|
],
|
||||||
)])
|
)])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
run_runroot_cmd.mock_calls,
|
run_runroot_cmd.mock_calls,
|
||||||
[mock.call(get_runroot_cmd.return_value,
|
[mock.call(get_runroot_cmd.return_value,
|
||||||
log_file=self.topdir + '/logs/x86_64/buildinstall-Server.x86_64.log')])
|
log_file=self.topdir + '/logs/x86_64/buildinstall-Server.x86_64.log')])
|
||||||
with open(self.topdir + '/logs/x86_64/buildinstall-Server-RPMs.x86_64.log') as f:
|
with open(self.topdir + '/logs/x86_64/buildinstall-Server-RPMs.x86_64.log') as f:
|
||||||
rpms = f.read().strip().split('\n')
|
rpms = f.read().strip().split('\n')
|
||||||
self.assertItemsEqual(rpms, ['bash', 'zsh'])
|
six.assertCountEqual(self, rpms, ["bash", "zsh"])
|
||||||
self.assertItemsEqual(self.pool.finished_tasks, [('Server', 'x86_64')])
|
six.assertCountEqual(self, self.pool.finished_tasks, [("Server", "x86_64")])
|
||||||
|
|
||||||
buildinstall_topdir = os.path.join(
|
buildinstall_topdir = os.path.join(
|
||||||
"/buildinstall_topdir", "buildinstall-" + os.path.basename(self.topdir))
|
"/buildinstall_topdir", "buildinstall-" + os.path.basename(self.topdir))
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
copy_all.mock_calls,
|
copy_all.mock_calls,
|
||||||
[mock.call(os.path.join(buildinstall_topdir, 'x86_64/Server/results'),
|
[mock.call(os.path.join(buildinstall_topdir, 'x86_64/Server/results'),
|
||||||
os.path.join(self.topdir, 'work/x86_64/buildinstall/Server')),
|
os.path.join(self.topdir, 'work/x86_64/buildinstall/Server')),
|
||||||
@ -904,19 +923,22 @@ class TestSymlinkIso(PungiTestCase):
|
|||||||
self.assertEqual(os.stat(tgt).st_ino,
|
self.assertEqual(os.stat(tgt).st_ino,
|
||||||
os.stat(self.topdir + '/compose/Server/x86_64/os/images/boot.iso').st_ino)
|
os.stat(self.topdir + '/compose/Server/x86_64/os/images/boot.iso').st_ino)
|
||||||
|
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
self.compose.get_image_name.mock_calls,
|
self.compose.get_image_name.mock_calls,
|
||||||
[mock.call('x86_64', self.compose.variants['Server'],
|
[mock.call('x86_64', self.compose.variants['Server'],
|
||||||
disc_type='boot', disc_num=None, suffix='.iso')])
|
disc_type='boot', disc_num=None, suffix='.iso')])
|
||||||
self.assertItemsEqual(iso.get_implanted_md5.mock_calls,
|
self.assertEqual(iso.get_implanted_md5.mock_calls, [mock.call(tgt)])
|
||||||
[mock.call(tgt)])
|
self.assertEqual(iso.get_manifest_cmd.mock_calls, [mock.call("image-name")])
|
||||||
self.assertItemsEqual(iso.get_manifest_cmd.mock_calls,
|
self.assertEqual(iso.get_volume_id.mock_calls, [mock.call(tgt)])
|
||||||
[mock.call('image-name')])
|
self.assertEqual(
|
||||||
self.assertItemsEqual(iso.get_volume_id.mock_calls,
|
run.mock_calls,
|
||||||
[mock.call(tgt)])
|
[
|
||||||
self.assertItemsEqual(run.mock_calls,
|
mock.call(
|
||||||
[mock.call(iso.get_manifest_cmd.return_value,
|
iso.get_manifest_cmd.return_value,
|
||||||
workdir=self.topdir + '/compose/Server/x86_64/iso')])
|
workdir=self.topdir + "/compose/Server/x86_64/iso",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
image = ImageCls.return_value
|
image = ImageCls.return_value
|
||||||
self.assertEqual(image.path, 'Server/x86_64/iso/image-name')
|
self.assertEqual(image.path, 'Server/x86_64/iso/image-name')
|
||||||
@ -953,19 +975,22 @@ class TestSymlinkIso(PungiTestCase):
|
|||||||
self.assertEqual(os.stat(tgt).st_ino,
|
self.assertEqual(os.stat(tgt).st_ino,
|
||||||
os.stat(self.topdir + '/compose/Server/x86_64/os/images/boot.iso').st_ino)
|
os.stat(self.topdir + '/compose/Server/x86_64/os/images/boot.iso').st_ino)
|
||||||
|
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
self.compose.get_image_name.mock_calls,
|
self.compose.get_image_name.mock_calls,
|
||||||
[mock.call('x86_64', self.compose.variants['Server'],
|
[mock.call('x86_64', self.compose.variants['Server'],
|
||||||
disc_type='netinst', disc_num=None, suffix='.iso')])
|
disc_type='netinst', disc_num=None, suffix='.iso')])
|
||||||
self.assertItemsEqual(iso.get_implanted_md5.mock_calls,
|
self.assertEqual(iso.get_implanted_md5.mock_calls, [mock.call(tgt)])
|
||||||
[mock.call(tgt)])
|
self.assertEqual(iso.get_manifest_cmd.mock_calls, [mock.call("image-name")])
|
||||||
self.assertItemsEqual(iso.get_manifest_cmd.mock_calls,
|
self.assertEqual(iso.get_volume_id.mock_calls, [mock.call(tgt)])
|
||||||
[mock.call('image-name')])
|
self.assertEqual(
|
||||||
self.assertItemsEqual(iso.get_volume_id.mock_calls,
|
run.mock_calls,
|
||||||
[mock.call(tgt)])
|
[
|
||||||
self.assertItemsEqual(run.mock_calls,
|
mock.call(
|
||||||
[mock.call(iso.get_manifest_cmd.return_value,
|
iso.get_manifest_cmd.return_value,
|
||||||
workdir=self.topdir + '/compose/Server/x86_64/iso')])
|
workdir=self.topdir + "/compose/Server/x86_64/iso",
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
image = ImageCls.return_value
|
image = ImageCls.return_value
|
||||||
self.assertEqual(image.path, 'Server/x86_64/iso/image-name')
|
self.assertEqual(image.path, 'Server/x86_64/iso/image-name')
|
||||||
|
@ -573,19 +573,19 @@ class TestUmask(unittest.TestCase):
|
|||||||
os.umask(0o022)
|
os.umask(0o022)
|
||||||
logger = mock.Mock()
|
logger = mock.Mock()
|
||||||
checks.check_umask(logger)
|
checks.check_umask(logger)
|
||||||
self.assertItemsEqual(logger.mock_calls, [])
|
self.assertEqual(logger.mock_calls, [])
|
||||||
|
|
||||||
def test_no_warning_with_0000(self):
|
def test_no_warning_with_0000(self):
|
||||||
os.umask(0o000)
|
os.umask(0o000)
|
||||||
logger = mock.Mock()
|
logger = mock.Mock()
|
||||||
checks.check_umask(logger)
|
checks.check_umask(logger)
|
||||||
self.assertItemsEqual(logger.mock_calls, [])
|
self.assertEqual(logger.mock_calls, [])
|
||||||
|
|
||||||
def test_warning_with_0044(self):
|
def test_warning_with_0044(self):
|
||||||
os.umask(0o044)
|
os.umask(0o044)
|
||||||
logger = mock.Mock()
|
logger = mock.Mock()
|
||||||
checks.check_umask(logger)
|
checks.check_umask(logger)
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
logger.mock_calls,
|
logger.mock_calls,
|
||||||
[mock.call.warning('Unusually strict umask detected (0%03o), '
|
[mock.call.warning('Unusually strict umask detected (0%03o), '
|
||||||
'expect files with broken permissions.', 0o044)]
|
'expect files with broken permissions.', 0o044)]
|
||||||
|
@ -6,6 +6,7 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
import unittest
|
import unittest
|
||||||
import os
|
import os
|
||||||
|
import six
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import shutil
|
import shutil
|
||||||
@ -262,20 +263,25 @@ class ComposeTestCase(unittest.TestCase):
|
|||||||
['Client', 'Crashy', 'Live', 'Server'])
|
['Client', 'Crashy', 'Live', 'Server'])
|
||||||
self.assertEqual(sorted(v.uid for v in compose.variants['Server'].variants.values()),
|
self.assertEqual(sorted(v.uid for v in compose.variants['Server'].variants.values()),
|
||||||
['Server-Gluster', 'Server-ResilientStorage', 'Server-optional'])
|
['Server-Gluster', 'Server-ResilientStorage', 'Server-optional'])
|
||||||
self.assertItemsEqual(compose.variants['Client'].arches,
|
six.assertCountEqual(
|
||||||
['i386', 'x86_64'])
|
self, compose.variants["Client"].arches, ["i386", "x86_64"]
|
||||||
self.assertItemsEqual(compose.variants['Crashy'].arches,
|
)
|
||||||
['ppc64le'])
|
self.assertEqual(compose.variants["Crashy"].arches, ["ppc64le"])
|
||||||
self.assertItemsEqual(compose.variants['Live'].arches,
|
self.assertEqual(compose.variants["Live"].arches, ["x86_64"])
|
||||||
['x86_64'])
|
six.assertCountEqual(
|
||||||
self.assertItemsEqual(compose.variants['Server'].arches,
|
self, compose.variants["Server"].arches, ["s390x", "x86_64"]
|
||||||
['s390x', 'x86_64'])
|
)
|
||||||
self.assertItemsEqual(compose.variants['Server'].variants['Gluster'].arches,
|
self.assertEqual(
|
||||||
['x86_64'])
|
compose.variants["Server"].variants["Gluster"].arches, ["x86_64"]
|
||||||
self.assertItemsEqual(compose.variants['Server'].variants['ResilientStorage'].arches,
|
)
|
||||||
['x86_64'])
|
self.assertEqual(
|
||||||
self.assertItemsEqual(compose.variants['Server'].variants['optional'].arches,
|
compose.variants["Server"].variants["ResilientStorage"].arches, ["x86_64"]
|
||||||
['s390x', 'x86_64'])
|
)
|
||||||
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
|
compose.variants["Server"].variants["optional"].arches,
|
||||||
|
["s390x", "x86_64"]
|
||||||
|
)
|
||||||
|
|
||||||
self.assertEqual([v.uid for v in compose.get_variants()],
|
self.assertEqual([v.uid for v in compose.get_variants()],
|
||||||
['Client', 'Crashy', 'Live', 'Server', 'Server-Gluster',
|
['Client', 'Crashy', 'Live', 'Server', 'Server-Gluster',
|
||||||
@ -305,18 +311,18 @@ class ComposeTestCase(unittest.TestCase):
|
|||||||
['Client', 'Live', 'Server'])
|
['Client', 'Live', 'Server'])
|
||||||
self.assertEqual(sorted(v.uid for v in compose.variants['Server'].variants.values()),
|
self.assertEqual(sorted(v.uid for v in compose.variants['Server'].variants.values()),
|
||||||
['Server-Gluster', 'Server-ResilientStorage', 'Server-optional'])
|
['Server-Gluster', 'Server-ResilientStorage', 'Server-optional'])
|
||||||
self.assertItemsEqual(compose.variants['Client'].arches,
|
self.assertEqual(compose.variants["Client"].arches, ["x86_64"])
|
||||||
['x86_64'])
|
self.assertEqual(compose.variants["Live"].arches, ["x86_64"])
|
||||||
self.assertItemsEqual(compose.variants['Live'].arches,
|
self.assertEqual(compose.variants["Server"].arches, ["x86_64"])
|
||||||
['x86_64'])
|
self.assertEqual(
|
||||||
self.assertItemsEqual(compose.variants['Server'].arches,
|
compose.variants["Server"].variants["Gluster"].arches, ["x86_64"]
|
||||||
['x86_64'])
|
)
|
||||||
self.assertItemsEqual(compose.variants['Server'].variants['Gluster'].arches,
|
self.assertEqual(
|
||||||
['x86_64'])
|
compose.variants["Server"].variants["ResilientStorage"].arches, ["x86_64"]
|
||||||
self.assertItemsEqual(compose.variants['Server'].variants['ResilientStorage'].arches,
|
)
|
||||||
['x86_64'])
|
self.assertEqual(
|
||||||
self.assertItemsEqual(compose.variants['Server'].variants['optional'].arches,
|
compose.variants["Server"].variants["optional"].arches, ["x86_64"]
|
||||||
['x86_64'])
|
)
|
||||||
|
|
||||||
self.assertEqual(compose.get_arches(), ['x86_64'])
|
self.assertEqual(compose.get_arches(), ['x86_64'])
|
||||||
self.assertEqual([v.uid for v in compose.get_variants()],
|
self.assertEqual([v.uid for v in compose.get_variants()],
|
||||||
@ -348,12 +354,15 @@ class ComposeTestCase(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertEqual(sorted(v.uid for v in compose.variants.values()),
|
self.assertEqual(sorted(v.uid for v in compose.variants.values()),
|
||||||
['Client', 'Server'])
|
['Client', 'Server'])
|
||||||
self.assertItemsEqual(compose.variants['Client'].arches,
|
six.assertCountEqual(
|
||||||
['i386', 'x86_64'])
|
self, compose.variants["Client"].arches, ["i386", "x86_64"]
|
||||||
self.assertItemsEqual(compose.variants['Server'].arches,
|
)
|
||||||
['s390x', 'x86_64'])
|
six.assertCountEqual(
|
||||||
self.assertItemsEqual(compose.variants['Server'].variants['Gluster'].arches,
|
self, compose.variants["Server"].arches, ["s390x", "x86_64"]
|
||||||
['x86_64'])
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
compose.variants["Server"].variants["Gluster"].arches, ["x86_64"]
|
||||||
|
)
|
||||||
|
|
||||||
self.assertEqual(compose.get_arches(), ['i386', 's390x', 'x86_64'])
|
self.assertEqual(compose.get_arches(), ['i386', 's390x', 'x86_64'])
|
||||||
self.assertEqual([v.uid for v in compose.get_variants()],
|
self.assertEqual([v.uid for v in compose.get_variants()],
|
||||||
@ -388,18 +397,18 @@ class ComposeTestCase(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertEqual(sorted(v.uid for v in compose.variants.values()),
|
self.assertEqual(sorted(v.uid for v in compose.variants.values()),
|
||||||
['Client', 'Server'])
|
['Client', 'Server'])
|
||||||
self.assertItemsEqual(compose.variants['Client'].arches,
|
self.assertEqual(compose.variants["Client"].arches, ["x86_64"])
|
||||||
['x86_64'])
|
self.assertEqual(compose.variants["Server"].arches, ["x86_64"])
|
||||||
self.assertItemsEqual(compose.variants['Server'].arches,
|
self.assertEqual(
|
||||||
['x86_64'])
|
compose.variants["Server"].variants["optional"].arches, ["x86_64"]
|
||||||
self.assertItemsEqual(compose.variants['Server'].variants['optional'].arches,
|
)
|
||||||
['x86_64'])
|
|
||||||
|
|
||||||
self.assertEqual(compose.get_arches(), ['x86_64'])
|
self.assertEqual(compose.get_arches(), ['x86_64'])
|
||||||
self.assertEqual([v.uid for v in compose.get_variants()],
|
self.assertEqual([v.uid for v in compose.get_variants()],
|
||||||
['Client', 'Server', 'Server-optional'])
|
['Client', 'Server', 'Server-optional'])
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
logger.info.call_args_list,
|
logger.info.call_args_list,
|
||||||
[mock.call('Excluding variant Live: filtered by configuration.'),
|
[mock.call('Excluding variant Live: filtered by configuration.'),
|
||||||
mock.call('Excluding variant Crashy: all its arches are filtered.'),
|
mock.call('Excluding variant Crashy: all its arches are filtered.'),
|
||||||
|
@ -20,7 +20,7 @@ from tests.helpers import load_config, PKGSET_REPOS
|
|||||||
class ConfigTestCase(unittest.TestCase):
|
class ConfigTestCase(unittest.TestCase):
|
||||||
def assertValidation(self, cfg, errors=[], warnings=[]):
|
def assertValidation(self, cfg, errors=[], warnings=[]):
|
||||||
actual_errors, actual_warnings = checks.validate(cfg)
|
actual_errors, actual_warnings = checks.validate(cfg)
|
||||||
self.assertItemsEqual(errors, actual_errors)
|
six.assertCountEqual(self, errors, actual_errors)
|
||||||
self.assertEqual(warnings, actual_warnings)
|
self.assertEqual(warnings, actual_warnings)
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
import six
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
@ -49,7 +50,8 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
|
|||||||
|
|
||||||
self.assertEqual(len(pool.add.call_args_list), 0)
|
self.assertEqual(len(pool.add.call_args_list), 0)
|
||||||
self.assertEqual(pool.queue_put.call_args_list, [])
|
self.assertEqual(pool.queue_put.call_args_list, [])
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
phase.logger.warn.call_args_list,
|
phase.logger.warn.call_args_list,
|
||||||
[mock.call('No RPMs found for Everything.x86_64, skipping ISO'),
|
[mock.call('No RPMs found for Everything.x86_64, skipping ISO'),
|
||||||
mock.call('No RPMs found for Everything.amd64, skipping ISO'),
|
mock.call('No RPMs found for Everything.amd64, skipping ISO'),
|
||||||
@ -92,7 +94,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
|
|||||||
[mock.call(compose, 'x86_64', compose.variants['Server'], no_split=False, logger=phase.logger)])
|
[mock.call(compose, 'x86_64', compose.variants['Server'], no_split=False, logger=phase.logger)])
|
||||||
self.assertEqual(len(pool.add.call_args_list), 1)
|
self.assertEqual(len(pool.add.call_args_list), 1)
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
[x[0][0] for x in write_script.call_args_list],
|
[x[0][0] for x in write_script.call_args_list],
|
||||||
[CreateIsoOpts(
|
[CreateIsoOpts(
|
||||||
output_dir='%s/compose/Server/x86_64/iso' % self.topdir,
|
output_dir='%s/compose/Server/x86_64/iso' % self.topdir,
|
||||||
@ -105,7 +107,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
|
|||||||
os_tree='%s/compose/Server/x86_64/os' % self.topdir,
|
os_tree='%s/compose/Server/x86_64/os' % self.topdir,
|
||||||
hfs_compat=True,
|
hfs_compat=True,
|
||||||
)])
|
)])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
pool.queue_put.call_args_list,
|
pool.queue_put.call_args_list,
|
||||||
[mock.call((
|
[mock.call((
|
||||||
compose,
|
compose,
|
||||||
@ -150,19 +152,22 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
|
|||||||
phase.logger = mock.Mock()
|
phase.logger = mock.Mock()
|
||||||
phase.run()
|
phase.run()
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
prepare_iso.call_args_list,
|
prepare_iso.call_args_list,
|
||||||
[mock.call(compose, 'x86_64', compose.variants['Server'],
|
[mock.call(compose, 'x86_64', compose.variants['Server'],
|
||||||
disc_count=1, disc_num=1, split_iso_data=disc_data),
|
disc_count=1, disc_num=1, split_iso_data=disc_data),
|
||||||
mock.call(compose, 'src', compose.variants['Server'],
|
mock.call(compose, 'src', compose.variants['Server'],
|
||||||
disc_count=1, disc_num=1, split_iso_data=disc_data)])
|
disc_count=1, disc_num=1, split_iso_data=disc_data)])
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
split_iso.call_args_list,
|
split_iso.call_args_list,
|
||||||
[mock.call(compose, 'x86_64', compose.variants['Server'], no_split=True, logger=phase.logger),
|
[mock.call(compose, 'x86_64', compose.variants['Server'], no_split=True, logger=phase.logger),
|
||||||
mock.call(compose, 'src', compose.variants['Server'], no_split=False, logger=phase.logger)])
|
mock.call(compose, 'src', compose.variants['Server'], no_split=False, logger=phase.logger)])
|
||||||
self.assertEqual(len(pool.add.call_args_list), 2)
|
self.assertEqual(len(pool.add.call_args_list), 2)
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
[x[0][0] for x in write_script.call_args_list],
|
[x[0][0] for x in write_script.call_args_list],
|
||||||
[CreateIsoOpts(output_dir='%s/compose/Server/x86_64/iso' % self.topdir,
|
[CreateIsoOpts(output_dir='%s/compose/Server/x86_64/iso' % self.topdir,
|
||||||
iso_name='image-name',
|
iso_name='image-name',
|
||||||
@ -183,7 +188,8 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
|
|||||||
jigdo_dir='%s/compose/Server/source/jigdo' % self.topdir,
|
jigdo_dir='%s/compose/Server/source/jigdo' % self.topdir,
|
||||||
os_tree='%s/compose/Server/source/tree' % self.topdir,
|
os_tree='%s/compose/Server/source/tree' % self.topdir,
|
||||||
hfs_compat=True)])
|
hfs_compat=True)])
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
pool.queue_put.call_args_list,
|
pool.queue_put.call_args_list,
|
||||||
[mock.call((compose,
|
[mock.call((compose,
|
||||||
{'iso_path': '%s/compose/Server/x86_64/iso/image-name' % self.topdir,
|
{'iso_path': '%s/compose/Server/x86_64/iso/image-name' % self.topdir,
|
||||||
@ -235,16 +241,16 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
|
|||||||
phase.logger = mock.Mock()
|
phase.logger = mock.Mock()
|
||||||
phase.run()
|
phase.run()
|
||||||
|
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
prepare_iso.call_args_list,
|
prepare_iso.call_args_list,
|
||||||
[mock.call(compose, 'src', compose.variants['Server'],
|
[mock.call(compose, 'src', compose.variants['Server'],
|
||||||
disc_count=1, disc_num=1, split_iso_data=disc_data)])
|
disc_count=1, disc_num=1, split_iso_data=disc_data)])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
split_iso.call_args_list,
|
split_iso.call_args_list,
|
||||||
[mock.call(compose, 'src', compose.variants['Server'], no_split=False, logger=phase.logger)])
|
[mock.call(compose, 'src', compose.variants['Server'], no_split=False, logger=phase.logger)])
|
||||||
self.assertEqual(len(pool.add.call_args_list), 1)
|
self.assertEqual(len(pool.add.call_args_list), 1)
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
[x[0][0] for x in write_script.call_args_list],
|
[x[0][0] for x in write_script.call_args_list],
|
||||||
[CreateIsoOpts(output_dir='%s/compose/Server/source/iso' % self.topdir,
|
[CreateIsoOpts(output_dir='%s/compose/Server/source/iso' % self.topdir,
|
||||||
iso_name='image-name',
|
iso_name='image-name',
|
||||||
@ -255,7 +261,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
|
|||||||
jigdo_dir='%s/compose/Server/source/jigdo' % self.topdir,
|
jigdo_dir='%s/compose/Server/source/jigdo' % self.topdir,
|
||||||
os_tree='%s/compose/Server/source/tree' % self.topdir,
|
os_tree='%s/compose/Server/source/tree' % self.topdir,
|
||||||
hfs_compat=True)])
|
hfs_compat=True)])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
pool.queue_put.call_args_list,
|
pool.queue_put.call_args_list,
|
||||||
[mock.call((compose,
|
[mock.call((compose,
|
||||||
{'iso_path': '%s/compose/Server/source/iso/image-name' % self.topdir,
|
{'iso_path': '%s/compose/Server/source/iso/image-name' % self.topdir,
|
||||||
@ -300,15 +306,15 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
|
|||||||
phase.run()
|
phase.run()
|
||||||
|
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
prepare_iso.call_args_list,
|
prepare_iso.call_args_list,
|
||||||
[mock.call(compose, 'x86_64', compose.variants['Server'],
|
[mock.call(compose, 'x86_64', compose.variants['Server'],
|
||||||
disc_count=1, disc_num=1, split_iso_data=disc_data)])
|
disc_count=1, disc_num=1, split_iso_data=disc_data)])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
split_iso.call_args_list,
|
split_iso.call_args_list,
|
||||||
[mock.call(compose, 'x86_64', compose.variants['Server'], no_split=False, logger=phase.logger)])
|
[mock.call(compose, 'x86_64', compose.variants['Server'], no_split=False, logger=phase.logger)])
|
||||||
self.assertEqual(len(pool.add.call_args_list), 1)
|
self.assertEqual(len(pool.add.call_args_list), 1)
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
[x[0][0] for x in write_script.call_args_list],
|
[x[0][0] for x in write_script.call_args_list],
|
||||||
[CreateIsoOpts(output_dir='%s/compose/Server/x86_64/iso' % self.topdir,
|
[CreateIsoOpts(output_dir='%s/compose/Server/x86_64/iso' % self.topdir,
|
||||||
iso_name='image-name',
|
iso_name='image-name',
|
||||||
@ -319,7 +325,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
|
|||||||
jigdo_dir='%s/compose/Server/x86_64/jigdo' % self.topdir,
|
jigdo_dir='%s/compose/Server/x86_64/jigdo' % self.topdir,
|
||||||
os_tree='%s/compose/Server/x86_64/os' % self.topdir,
|
os_tree='%s/compose/Server/x86_64/os' % self.topdir,
|
||||||
hfs_compat=False)])
|
hfs_compat=False)])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
pool.queue_put.call_args_list,
|
pool.queue_put.call_args_list,
|
||||||
[mock.call((compose,
|
[mock.call((compose,
|
||||||
{'iso_path': '%s/compose/Server/x86_64/iso/image-name' % self.topdir,
|
{'iso_path': '%s/compose/Server/x86_64/iso/image-name' % self.topdir,
|
||||||
|
@ -5,6 +5,8 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -20,7 +22,9 @@ class CreateRepoWrapperTest(unittest.TestCase):
|
|||||||
cmd = repo.get_createrepo_cmd('/test/dir')
|
cmd = repo.get_createrepo_cmd('/test/dir')
|
||||||
|
|
||||||
self.assertEqual(cmd[:2], ['createrepo_c', '/test/dir'])
|
self.assertEqual(cmd[:2], ['createrepo_c', '/test/dir'])
|
||||||
self.assertItemsEqual(cmd[2:], ['--update', '--database', '--unique-md-filenames'])
|
six.assertCountEqual(
|
||||||
|
self, cmd[2:], ["--update", "--database", "--unique-md-filenames"]
|
||||||
|
)
|
||||||
|
|
||||||
def test_get_createrepo_c_cmd_full(self):
|
def test_get_createrepo_c_cmd_full(self):
|
||||||
repo = CreaterepoWrapper()
|
repo = CreaterepoWrapper()
|
||||||
@ -37,22 +41,28 @@ class CreateRepoWrapperTest(unittest.TestCase):
|
|||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
|
|
||||||
self.assertEqual(cmd[:2], ['createrepo_c', '/test/dir'])
|
self.assertEqual(cmd[:2], ['createrepo_c', '/test/dir'])
|
||||||
self.assertItemsEqual(cmd[2:],
|
six.assertCountEqual(
|
||||||
['--baseurl=http://base.example.com', '--excludes=abc', '--excludes=xyz',
|
self,
|
||||||
'--pkglist=/test/pkglist', '--groupfile=/test/comps', '--cachedir=/test/cache',
|
cmd[2:],
|
||||||
'--skip-stat', '--update-md-path=/test/md_path', '--split', '--checkts',
|
["--baseurl=http://base.example.com", "--excludes=abc", "--excludes=xyz",
|
||||||
'--checksum=sha256', '--distro=Fedora', '--simple-md-filenames', '--no-database',
|
"--pkglist=/test/pkglist", "--groupfile=/test/comps", "--cachedir=/test/cache",
|
||||||
'--content=c1', '--content=c2', '--repo=r1', '--repo=r2', '--revision=rev',
|
"--skip-stat", "--update-md-path=/test/md_path", "--split", "--checkts",
|
||||||
'--deltas', '--oldpackagedirs=/test/old', '--num-deltas=2', '--workers=3',
|
"--checksum=sha256", "--distro=Fedora", "--simple-md-filenames", "--no-database",
|
||||||
'--outputdir=/test/output', '--xz', "--zck", "--zck-primary-dict=/foo/bar"])
|
"--content=c1", "--content=c2", "--repo=r1", "--repo=r2", "--revision=rev",
|
||||||
|
"--deltas", "--oldpackagedirs=/test/old", "--num-deltas=2", "--workers=3",
|
||||||
|
"--outputdir=/test/output", "--xz", "--zck", "--zck-primary-dict=/foo/bar"],
|
||||||
|
)
|
||||||
|
|
||||||
def test_get_createrepo_cmd_minimal(self):
|
def test_get_createrepo_cmd_minimal(self):
|
||||||
repo = CreaterepoWrapper(False)
|
repo = CreaterepoWrapper(False)
|
||||||
cmd = repo.get_createrepo_cmd('/test/dir')
|
cmd = repo.get_createrepo_cmd('/test/dir')
|
||||||
|
|
||||||
self.assertEqual(cmd[:2], ['createrepo', '/test/dir'])
|
self.assertEqual(cmd[:2], ['createrepo', '/test/dir'])
|
||||||
self.assertItemsEqual(cmd[2:], ['--update', '--database', '--unique-md-filenames',
|
six.assertCountEqual(
|
||||||
'--pretty'])
|
self,
|
||||||
|
cmd[2:],
|
||||||
|
["--update", "--database", "--unique-md-filenames", "--pretty"],
|
||||||
|
)
|
||||||
|
|
||||||
def test_get_createrepo_cmd_full(self):
|
def test_get_createrepo_cmd_full(self):
|
||||||
repo = CreaterepoWrapper(False)
|
repo = CreaterepoWrapper(False)
|
||||||
@ -67,11 +77,14 @@ class CreateRepoWrapperTest(unittest.TestCase):
|
|||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
|
|
||||||
self.assertEqual(cmd[:2], ['createrepo', '/test/dir'])
|
self.assertEqual(cmd[:2], ['createrepo', '/test/dir'])
|
||||||
self.assertItemsEqual(cmd[2:],
|
six.assertCountEqual(
|
||||||
['--baseurl=http://base.example.com', '--excludes=abc', '--excludes=xyz',
|
self,
|
||||||
'--pkglist=/test/pkglist', '--groupfile=/test/comps', '--cachedir=/test/cache',
|
cmd[2:],
|
||||||
'--skip-stat', '--update-md-path=/test/md_path', '--split', '--checkts',
|
["--baseurl=http://base.example.com", "--excludes=abc", "--excludes=xyz",
|
||||||
'--checksum=sha256', '--distro=Fedora', '--simple-md-filenames', '--no-database',
|
"--pkglist=/test/pkglist", "--groupfile=/test/comps", "--cachedir=/test/cache",
|
||||||
'--content=c1', '--content=c2', '--repo=r1', '--repo=r2', '--revision=rev',
|
"--skip-stat", "--update-md-path=/test/md_path", "--split", "--checkts",
|
||||||
'--deltas', '--oldpackagedirs=/test/old', '--num-deltas=2', '--workers=3',
|
"--checksum=sha256", "--distro=Fedora", "--simple-md-filenames", "--no-database",
|
||||||
'--outputdir=/test/output'])
|
"--content=c1", "--content=c2", "--repo=r1", "--repo=r2", "--revision=rev",
|
||||||
|
"--deltas", "--oldpackagedirs=/test/old", "--num-deltas=2", "--workers=3",
|
||||||
|
"--outputdir=/test/output"],
|
||||||
|
)
|
||||||
|
@ -9,6 +9,7 @@ import mock
|
|||||||
|
|
||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
|
import six
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
||||||
@ -75,7 +76,8 @@ class TestCreaterepoPhase(PungiTestCase):
|
|||||||
everything = compose.variants["Everything"]
|
everything = compose.variants["Everything"]
|
||||||
client = compose.variants["Client"]
|
client = compose.variants["Client"]
|
||||||
self.assertEqual(len(pool.add.mock_calls), 5)
|
self.assertEqual(len(pool.add.mock_calls), 5)
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
pool.queue_put.mock_calls,
|
pool.queue_put.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call((compose, "x86_64", server, "rpm")),
|
mock.call((compose, "x86_64", server, "rpm")),
|
||||||
@ -110,7 +112,8 @@ class TestCreaterepoPhase(PungiTestCase):
|
|||||||
server = compose.variants["Server"]
|
server = compose.variants["Server"]
|
||||||
everything = compose.variants["Everything"]
|
everything = compose.variants["Everything"]
|
||||||
self.assertEqual(len(pool.add.mock_calls), 5)
|
self.assertEqual(len(pool.add.mock_calls), 5)
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
pool.queue_put.mock_calls,
|
pool.queue_put.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call((compose, "x86_64", server, "rpm")),
|
mock.call((compose, "x86_64", server, "rpm")),
|
||||||
@ -139,8 +142,10 @@ def make_mocked_modifyrepo_cmd(tc, module_artifacts):
|
|||||||
tc.assertEqual(len(module_streams), len(module_artifacts))
|
tc.assertEqual(len(module_streams), len(module_artifacts))
|
||||||
for ms in module_streams:
|
for ms in module_streams:
|
||||||
tc.assertIn(ms.get_stream_name(), module_artifacts)
|
tc.assertIn(ms.get_stream_name(), module_artifacts)
|
||||||
tc.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
ms.get_rpm_artifacts(), module_artifacts[ms.get_stream_name()],
|
tc,
|
||||||
|
ms.get_rpm_artifacts(),
|
||||||
|
module_artifacts[ms.get_stream_name()],
|
||||||
)
|
)
|
||||||
return mocked_modifyrepo_cmd
|
return mocked_modifyrepo_cmd
|
||||||
|
|
||||||
@ -171,7 +176,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
||||||
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
||||||
mock.call(createrepo_c=True))
|
mock.call(createrepo_c=True))
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
repo.get_createrepo_cmd.mock_calls,
|
repo.get_createrepo_cmd.mock_calls,
|
||||||
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
||||||
database=True, groupfile=None, workers=3,
|
database=True, groupfile=None, workers=3,
|
||||||
@ -179,9 +184,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
pkglist=list_file, skip_stat=True, update=True,
|
pkglist=list_file, skip_stat=True, update=True,
|
||||||
update_md_path="/repo/x86_64",
|
update_md_path="/repo/x86_64",
|
||||||
deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])])
|
deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, [])
|
||||||
repo.get_modifyrepo_cmd.mock_calls,
|
|
||||||
[])
|
|
||||||
with open(list_file) as f:
|
with open(list_file) as f:
|
||||||
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
||||||
|
|
||||||
@ -204,7 +207,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
||||||
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
||||||
mock.call(createrepo_c=True))
|
mock.call(createrepo_c=True))
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
repo.get_createrepo_cmd.mock_calls,
|
repo.get_createrepo_cmd.mock_calls,
|
||||||
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
||||||
database=False, groupfile=None, workers=3,
|
database=False, groupfile=None, workers=3,
|
||||||
@ -212,9 +215,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
pkglist=list_file, skip_stat=True, update=True,
|
pkglist=list_file, skip_stat=True, update=True,
|
||||||
update_md_path="/repo/x86_64",
|
update_md_path="/repo/x86_64",
|
||||||
deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])])
|
deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, [])
|
||||||
repo.get_modifyrepo_cmd.mock_calls,
|
|
||||||
[])
|
|
||||||
with open(list_file) as f:
|
with open(list_file) as f:
|
||||||
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
||||||
|
|
||||||
@ -236,7 +237,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
list_file = self.topdir + '/work/global/repo_package_list/Server.None.srpm.conf'
|
list_file = self.topdir + '/work/global/repo_package_list/Server.None.srpm.conf'
|
||||||
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
||||||
mock.call(createrepo_c=True))
|
mock.call(createrepo_c=True))
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
repo.get_createrepo_cmd.mock_calls,
|
repo.get_createrepo_cmd.mock_calls,
|
||||||
[mock.call(self.topdir + '/compose/Server/source/tree', checksum='sha256',
|
[mock.call(self.topdir + '/compose/Server/source/tree', checksum='sha256',
|
||||||
database=True, groupfile=None, workers=3,
|
database=True, groupfile=None, workers=3,
|
||||||
@ -244,13 +245,9 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
pkglist=list_file, skip_stat=True, update=True,
|
pkglist=list_file, skip_stat=True, update=True,
|
||||||
update_md_path="/repo/global",
|
update_md_path="/repo/global",
|
||||||
deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])])
|
deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, [])
|
||||||
repo.get_modifyrepo_cmd.mock_calls,
|
|
||||||
[])
|
|
||||||
with open(list_file) as f:
|
with open(list_file) as f:
|
||||||
self.assertItemsEqual(
|
self.assertEqual(f.read(), "Packages/b/bash-4.3.30-2.fc21.src.rpm\n")
|
||||||
f.read().strip().split('\n'),
|
|
||||||
['Packages/b/bash-4.3.30-2.fc21.src.rpm'])
|
|
||||||
|
|
||||||
@mock.patch('pungi.phases.createrepo.run')
|
@mock.patch('pungi.phases.createrepo.run')
|
||||||
@mock.patch('pungi.phases.createrepo.CreaterepoWrapper')
|
@mock.patch('pungi.phases.createrepo.CreaterepoWrapper')
|
||||||
@ -271,7 +268,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.debuginfo.conf'
|
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.debuginfo.conf'
|
||||||
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
||||||
mock.call(createrepo_c=True))
|
mock.call(createrepo_c=True))
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
repo.get_createrepo_cmd.mock_calls,
|
repo.get_createrepo_cmd.mock_calls,
|
||||||
[mock.call(self.topdir + '/compose/Server/x86_64/debug/tree', checksum='sha256',
|
[mock.call(self.topdir + '/compose/Server/x86_64/debug/tree', checksum='sha256',
|
||||||
database=True, groupfile=None, workers=3,
|
database=True, groupfile=None, workers=3,
|
||||||
@ -279,9 +276,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
pkglist=list_file, skip_stat=True, update=True,
|
pkglist=list_file, skip_stat=True, update=True,
|
||||||
update_md_path="/repo/x86_64",
|
update_md_path="/repo/x86_64",
|
||||||
deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])])
|
deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, [])
|
||||||
repo.get_modifyrepo_cmd.mock_calls,
|
|
||||||
[])
|
|
||||||
with open(list_file) as f:
|
with open(list_file) as f:
|
||||||
self.assertEqual(f.read(), 'Packages/b/bash-debuginfo-4.3.30-2.fc21.x86_64.rpm\n')
|
self.assertEqual(f.read(), 'Packages/b/bash-debuginfo-4.3.30-2.fc21.x86_64.rpm\n')
|
||||||
|
|
||||||
@ -304,7 +299,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
||||||
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
||||||
mock.call(createrepo_c=False))
|
mock.call(createrepo_c=False))
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
repo.get_createrepo_cmd.mock_calls,
|
repo.get_createrepo_cmd.mock_calls,
|
||||||
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
||||||
database=True, groupfile=None, workers=3,
|
database=True, groupfile=None, workers=3,
|
||||||
@ -312,9 +307,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
pkglist=list_file, skip_stat=True, update=True,
|
pkglist=list_file, skip_stat=True, update=True,
|
||||||
update_md_path="/repo/x86_64",
|
update_md_path="/repo/x86_64",
|
||||||
deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])])
|
deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, [])
|
||||||
repo.get_modifyrepo_cmd.mock_calls,
|
|
||||||
[])
|
|
||||||
with open(list_file) as f:
|
with open(list_file) as f:
|
||||||
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
||||||
|
|
||||||
@ -341,7 +334,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
||||||
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
||||||
mock.call(createrepo_c=True))
|
mock.call(createrepo_c=True))
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
repo.get_createrepo_cmd.mock_calls,
|
repo.get_createrepo_cmd.mock_calls,
|
||||||
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
||||||
database=True, groupfile=None, workers=10,
|
database=True, groupfile=None, workers=10,
|
||||||
@ -349,9 +342,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
pkglist=list_file, skip_stat=True, update=True,
|
pkglist=list_file, skip_stat=True, update=True,
|
||||||
update_md_path="/repo/x86_64",
|
update_md_path="/repo/x86_64",
|
||||||
deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])])
|
deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, [])
|
||||||
repo.get_modifyrepo_cmd.mock_calls,
|
|
||||||
[])
|
|
||||||
with open(list_file) as f:
|
with open(list_file) as f:
|
||||||
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
||||||
|
|
||||||
@ -374,7 +365,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
||||||
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
||||||
mock.call(createrepo_c=True))
|
mock.call(createrepo_c=True))
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
repo.get_createrepo_cmd.mock_calls,
|
repo.get_createrepo_cmd.mock_calls,
|
||||||
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
||||||
database=True, groupfile=None, workers=3,
|
database=True, groupfile=None, workers=3,
|
||||||
@ -382,9 +373,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
pkglist=list_file, skip_stat=True, update=True,
|
pkglist=list_file, skip_stat=True, update=True,
|
||||||
update_md_path="/repo/x86_64", deltas=False,
|
update_md_path="/repo/x86_64", deltas=False,
|
||||||
oldpackagedirs=None, use_xz=True, extra_args=[])])
|
oldpackagedirs=None, use_xz=True, extra_args=[])])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, [])
|
||||||
repo.get_modifyrepo_cmd.mock_calls,
|
|
||||||
[])
|
|
||||||
with open(list_file) as f:
|
with open(list_file) as f:
|
||||||
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
||||||
|
|
||||||
@ -409,7 +398,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
||||||
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
||||||
mock.call(createrepo_c=True))
|
mock.call(createrepo_c=True))
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
repo.get_createrepo_cmd.mock_calls,
|
repo.get_createrepo_cmd.mock_calls,
|
||||||
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
||||||
database=True, groupfile=None, workers=3,
|
database=True, groupfile=None, workers=3,
|
||||||
@ -418,9 +407,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
update_md_path=None, deltas=True,
|
update_md_path=None, deltas=True,
|
||||||
oldpackagedirs=self.topdir + '/old/test-1.0-20151203.0/compose/Server/x86_64/os/Packages',
|
oldpackagedirs=self.topdir + '/old/test-1.0-20151203.0/compose/Server/x86_64/os/Packages',
|
||||||
use_xz=False, extra_args=[])])
|
use_xz=False, extra_args=[])])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, [])
|
||||||
repo.get_modifyrepo_cmd.mock_calls,
|
|
||||||
[])
|
|
||||||
with open(list_file) as f:
|
with open(list_file) as f:
|
||||||
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
||||||
|
|
||||||
@ -445,7 +432,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
||||||
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
||||||
mock.call(createrepo_c=True))
|
mock.call(createrepo_c=True))
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
repo.get_createrepo_cmd.mock_calls,
|
repo.get_createrepo_cmd.mock_calls,
|
||||||
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
||||||
database=True, groupfile=None, workers=3,
|
database=True, groupfile=None, workers=3,
|
||||||
@ -454,9 +441,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
update_md_path=None, deltas=True,
|
update_md_path=None, deltas=True,
|
||||||
oldpackagedirs=self.topdir + '/old/test-1.0-20151203.0/compose/Server/x86_64/os/Packages',
|
oldpackagedirs=self.topdir + '/old/test-1.0-20151203.0/compose/Server/x86_64/os/Packages',
|
||||||
use_xz=False, extra_args=[])])
|
use_xz=False, extra_args=[])])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, [])
|
||||||
repo.get_modifyrepo_cmd.mock_calls,
|
|
||||||
[])
|
|
||||||
with open(list_file) as f:
|
with open(list_file) as f:
|
||||||
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
||||||
|
|
||||||
@ -481,7 +466,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
||||||
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
||||||
mock.call(createrepo_c=True))
|
mock.call(createrepo_c=True))
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
repo.get_createrepo_cmd.mock_calls,
|
repo.get_createrepo_cmd.mock_calls,
|
||||||
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
||||||
database=True, groupfile=None, workers=3,
|
database=True, groupfile=None, workers=3,
|
||||||
@ -489,9 +474,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
pkglist=list_file, skip_stat=True, update=True,
|
pkglist=list_file, skip_stat=True, update=True,
|
||||||
update_md_path="/repo/x86_64",
|
update_md_path="/repo/x86_64",
|
||||||
deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])])
|
deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, [])
|
||||||
repo.get_modifyrepo_cmd.mock_calls,
|
|
||||||
[])
|
|
||||||
with open(list_file) as f:
|
with open(list_file) as f:
|
||||||
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
||||||
|
|
||||||
@ -517,7 +500,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
||||||
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
||||||
mock.call(createrepo_c=True))
|
mock.call(createrepo_c=True))
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
repo.get_createrepo_cmd.mock_calls,
|
repo.get_createrepo_cmd.mock_calls,
|
||||||
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
||||||
database=True, groupfile=None, workers=3,
|
database=True, groupfile=None, workers=3,
|
||||||
@ -525,9 +508,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
pkglist=list_file, skip_stat=True, update=True,
|
pkglist=list_file, skip_stat=True, update=True,
|
||||||
update_md_path="/repo/x86_64",
|
update_md_path="/repo/x86_64",
|
||||||
deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])])
|
deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, [])
|
||||||
repo.get_modifyrepo_cmd.mock_calls,
|
|
||||||
[])
|
|
||||||
with open(list_file) as f:
|
with open(list_file) as f:
|
||||||
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
||||||
|
|
||||||
@ -557,7 +538,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
||||||
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
||||||
mock.call(createrepo_c=True))
|
mock.call(createrepo_c=True))
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
repo.get_createrepo_cmd.mock_calls,
|
repo.get_createrepo_cmd.mock_calls,
|
||||||
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
||||||
database=True, groupfile=None, workers=3,
|
database=True, groupfile=None, workers=3,
|
||||||
@ -569,9 +550,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
self.topdir + '/old/test-1.0-20151203.0/compose/Server/x86_64/os/Packages/b',
|
self.topdir + '/old/test-1.0-20151203.0/compose/Server/x86_64/os/Packages/b',
|
||||||
],
|
],
|
||||||
use_xz=False, extra_args=[])])
|
use_xz=False, extra_args=[])])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, [])
|
||||||
repo.get_modifyrepo_cmd.mock_calls,
|
|
||||||
[])
|
|
||||||
with open(list_file) as f:
|
with open(list_file) as f:
|
||||||
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
||||||
|
|
||||||
@ -598,7 +577,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
||||||
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
||||||
mock.call(createrepo_c=True))
|
mock.call(createrepo_c=True))
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
repo.get_createrepo_cmd.mock_calls,
|
repo.get_createrepo_cmd.mock_calls,
|
||||||
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
||||||
database=True, groupfile=None, workers=3,
|
database=True, groupfile=None, workers=3,
|
||||||
@ -607,9 +586,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
update_md_path="/repo/x86_64", deltas=True,
|
update_md_path="/repo/x86_64", deltas=True,
|
||||||
oldpackagedirs=[],
|
oldpackagedirs=[],
|
||||||
use_xz=False, extra_args=[])])
|
use_xz=False, extra_args=[])])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, [])
|
||||||
repo.get_modifyrepo_cmd.mock_calls,
|
|
||||||
[])
|
|
||||||
with open(list_file) as f:
|
with open(list_file) as f:
|
||||||
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
||||||
|
|
||||||
@ -635,7 +612,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
list_file = self.topdir + '/work/global/repo_package_list/Server.None.srpm.conf'
|
list_file = self.topdir + '/work/global/repo_package_list/Server.None.srpm.conf'
|
||||||
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
||||||
mock.call(createrepo_c=True))
|
mock.call(createrepo_c=True))
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
repo.get_createrepo_cmd.mock_calls,
|
repo.get_createrepo_cmd.mock_calls,
|
||||||
[mock.call(self.topdir + '/compose/Server/source/tree', checksum='sha256',
|
[mock.call(self.topdir + '/compose/Server/source/tree', checksum='sha256',
|
||||||
database=True, groupfile=None, workers=3,
|
database=True, groupfile=None, workers=3,
|
||||||
@ -643,13 +620,9 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
pkglist=list_file, skip_stat=True, update=True,
|
pkglist=list_file, skip_stat=True, update=True,
|
||||||
update_md_path="/repo/global",
|
update_md_path="/repo/global",
|
||||||
deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])])
|
deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, [])
|
||||||
repo.get_modifyrepo_cmd.mock_calls,
|
|
||||||
[])
|
|
||||||
with open(list_file) as f:
|
with open(list_file) as f:
|
||||||
self.assertItemsEqual(
|
self.assertEqual(f.read(), "Packages/b/bash-4.3.30-2.fc21.src.rpm\n")
|
||||||
f.read().strip().split('\n'),
|
|
||||||
['Packages/b/bash-4.3.30-2.fc21.src.rpm'])
|
|
||||||
|
|
||||||
@mock.patch('pungi.phases.createrepo.run')
|
@mock.patch('pungi.phases.createrepo.run')
|
||||||
@mock.patch('pungi.phases.createrepo.CreaterepoWrapper')
|
@mock.patch('pungi.phases.createrepo.CreaterepoWrapper')
|
||||||
@ -673,7 +646,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.debuginfo.conf'
|
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.debuginfo.conf'
|
||||||
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
||||||
mock.call(createrepo_c=True))
|
mock.call(createrepo_c=True))
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
repo.get_createrepo_cmd.mock_calls,
|
repo.get_createrepo_cmd.mock_calls,
|
||||||
[mock.call(self.topdir + '/compose/Server/x86_64/debug/tree', checksum='sha256',
|
[mock.call(self.topdir + '/compose/Server/x86_64/debug/tree', checksum='sha256',
|
||||||
database=True, groupfile=None, workers=3,
|
database=True, groupfile=None, workers=3,
|
||||||
@ -681,9 +654,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
pkglist=list_file, skip_stat=True, update=True,
|
pkglist=list_file, skip_stat=True, update=True,
|
||||||
update_md_path="/repo/x86_64",
|
update_md_path="/repo/x86_64",
|
||||||
deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])])
|
deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, [])
|
||||||
repo.get_modifyrepo_cmd.mock_calls,
|
|
||||||
[])
|
|
||||||
with open(list_file) as f:
|
with open(list_file) as f:
|
||||||
self.assertEqual(f.read(), 'Packages/b/bash-debuginfo-4.3.30-2.fc21.x86_64.rpm\n')
|
self.assertEqual(f.read(), 'Packages/b/bash-debuginfo-4.3.30-2.fc21.x86_64.rpm\n')
|
||||||
|
|
||||||
@ -713,7 +684,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf'
|
||||||
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
||||||
mock.call(createrepo_c=True))
|
mock.call(createrepo_c=True))
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
repo.get_createrepo_cmd.mock_calls,
|
repo.get_createrepo_cmd.mock_calls,
|
||||||
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
[mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256',
|
||||||
database=True, groupfile=None, workers=3,
|
database=True, groupfile=None, workers=3,
|
||||||
@ -722,9 +693,10 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
update_md_path="/repo/x86_64", deltas=False,
|
update_md_path="/repo/x86_64", deltas=False,
|
||||||
oldpackagedirs=None,
|
oldpackagedirs=None,
|
||||||
use_xz=False, extra_args=[])])
|
use_xz=False, extra_args=[])])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
repo.get_modifyrepo_cmd.mock_calls,
|
repo.get_modifyrepo_cmd.mock_calls,
|
||||||
[mock.call(repodata_dir, product_id, compress_type='gz')])
|
[mock.call(repodata_dir, product_id, compress_type="gz")]
|
||||||
|
)
|
||||||
with open(list_file) as f:
|
with open(list_file) as f:
|
||||||
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n')
|
||||||
|
|
||||||
@ -748,7 +720,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.debuginfo.conf'
|
list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.debuginfo.conf'
|
||||||
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
||||||
mock.call(createrepo_c=True))
|
mock.call(createrepo_c=True))
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
repo.get_createrepo_cmd.mock_calls,
|
repo.get_createrepo_cmd.mock_calls,
|
||||||
[mock.call(self.topdir + '/compose/Server/x86_64/debug/tree', checksum='sha256',
|
[mock.call(self.topdir + '/compose/Server/x86_64/debug/tree', checksum='sha256',
|
||||||
database=True, groupfile=None, workers=3,
|
database=True, groupfile=None, workers=3,
|
||||||
@ -757,7 +729,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
update_md_path="/repo/x86_64", deltas=False,
|
update_md_path="/repo/x86_64", deltas=False,
|
||||||
oldpackagedirs=None,
|
oldpackagedirs=None,
|
||||||
use_xz=False, extra_args=[])])
|
use_xz=False, extra_args=[])])
|
||||||
self.assertItemsEqual(repo.get_modifyrepo_cmd.mock_calls, [])
|
self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, [])
|
||||||
with open(list_file) as f:
|
with open(list_file) as f:
|
||||||
self.assertEqual(f.read(), 'Packages/b/bash-debuginfo-4.3.30-2.fc21.x86_64.rpm\n')
|
self.assertEqual(f.read(), 'Packages/b/bash-debuginfo-4.3.30-2.fc21.x86_64.rpm\n')
|
||||||
|
|
||||||
@ -781,7 +753,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
list_file = self.topdir + '/work/global/repo_package_list/Server.None.srpm.conf'
|
list_file = self.topdir + '/work/global/repo_package_list/Server.None.srpm.conf'
|
||||||
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
self.assertEqual(CreaterepoWrapperCls.mock_calls[0],
|
||||||
mock.call(createrepo_c=True))
|
mock.call(createrepo_c=True))
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
repo.get_createrepo_cmd.mock_calls,
|
repo.get_createrepo_cmd.mock_calls,
|
||||||
[mock.call(self.topdir + '/compose/Server/source/tree', checksum='sha256',
|
[mock.call(self.topdir + '/compose/Server/source/tree', checksum='sha256',
|
||||||
database=True, groupfile=None, workers=3,
|
database=True, groupfile=None, workers=3,
|
||||||
@ -790,7 +762,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
update_md_path="/repo/global", deltas=False,
|
update_md_path="/repo/global", deltas=False,
|
||||||
oldpackagedirs=None,
|
oldpackagedirs=None,
|
||||||
use_xz=False, extra_args=[])])
|
use_xz=False, extra_args=[])])
|
||||||
self.assertItemsEqual(repo.get_modifyrepo_cmd.mock_calls, [])
|
self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, [])
|
||||||
with open(list_file) as f:
|
with open(list_file) as f:
|
||||||
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.src.rpm\n')
|
self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.src.rpm\n')
|
||||||
|
|
||||||
@ -829,9 +801,10 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
compose, "x86_64", compose.variants["Server"], "rpm", self.pkgset, modules_metadata
|
compose, "x86_64", compose.variants["Server"], "rpm", self.pkgset, modules_metadata
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
repo.get_modifyrepo_cmd.mock_calls,
|
repo.get_modifyrepo_cmd.mock_calls,
|
||||||
[mock.call(repodata_dir, ANY, compress_type='gz', mdtype='modules')])
|
[mock.call(repodata_dir, ANY, compress_type="gz", mdtype="modules")],
|
||||||
|
)
|
||||||
|
|
||||||
@unittest.skipUnless(Modulemd is not None, 'Skipped test, no module support.')
|
@unittest.skipUnless(Modulemd is not None, 'Skipped test, no module support.')
|
||||||
@mock.patch('pungi.phases.createrepo.find_file_in_repodata')
|
@mock.patch('pungi.phases.createrepo.find_file_in_repodata')
|
||||||
@ -881,9 +854,10 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
compose, "x86_64", compose.variants["Server"], "rpm", self.pkgset, modules_metadata
|
compose, "x86_64", compose.variants["Server"], "rpm", self.pkgset, modules_metadata
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
repo.get_modifyrepo_cmd.mock_calls,
|
repo.get_modifyrepo_cmd.mock_calls,
|
||||||
[mock.call(repodata_dir, ANY, compress_type='gz', mdtype='modules')])
|
[mock.call(repodata_dir, ANY, compress_type="gz", mdtype="modules")],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class ANYSingleton(object):
|
class ANYSingleton(object):
|
||||||
@ -914,7 +888,7 @@ class TestGetProductIds(PungiTestCase):
|
|||||||
'product_id',
|
'product_id',
|
||||||
'%s.%s.pem' % (variant, arch),
|
'%s.%s.pem' % (variant, arch),
|
||||||
'productid'))
|
'productid'))
|
||||||
self.assertItemsEqual(pids, expected)
|
six.assertCountEqual(self, pids, expected)
|
||||||
|
|
||||||
@mock.patch('pungi.phases.createrepo.get_dir_from_scm')
|
@mock.patch('pungi.phases.createrepo.get_dir_from_scm')
|
||||||
def test_not_configured(self, get_dir_from_scm):
|
def test_not_configured(self, get_dir_from_scm):
|
||||||
|
@ -4,6 +4,8 @@ import mock
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
||||||
|
|
||||||
from pungi.phases import extra_files
|
from pungi.phases import extra_files
|
||||||
@ -33,7 +35,8 @@ class TestExtraFilePhase(helpers.PungiTestCase):
|
|||||||
phase = extra_files.ExtraFilesPhase(compose, pkgset_phase)
|
phase = extra_files.ExtraFilesPhase(compose, pkgset_phase)
|
||||||
phase.run()
|
phase.run()
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
copy_extra_files.call_args_list,
|
copy_extra_files.call_args_list,
|
||||||
[mock.call(compose, [cfg], 'x86_64', compose.variants['Server'],
|
[mock.call(compose, [cfg], 'x86_64', compose.variants['Server'],
|
||||||
pkgset_phase.package_sets),
|
pkgset_phase.package_sets),
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
import six
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
@ -45,7 +46,8 @@ class ExtraIsosPhaseTest(helpers.PungiTestCase):
|
|||||||
phase.run()
|
phase.run()
|
||||||
|
|
||||||
self.assertEqual(len(ThreadPool.return_value.add.call_args_list), 3)
|
self.assertEqual(len(ThreadPool.return_value.add.call_args_list), 3)
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
ThreadPool.return_value.queue_put.call_args_list,
|
ThreadPool.return_value.queue_put.call_args_list,
|
||||||
[mock.call((compose, cfg, compose.variants['Server'], 'x86_64')),
|
[mock.call((compose, cfg, compose.variants['Server'], 'x86_64')),
|
||||||
mock.call((compose, cfg, compose.variants['Server'], 'amd64')),
|
mock.call((compose, cfg, compose.variants['Server'], 'amd64')),
|
||||||
@ -67,7 +69,8 @@ class ExtraIsosPhaseTest(helpers.PungiTestCase):
|
|||||||
phase.run()
|
phase.run()
|
||||||
|
|
||||||
self.assertEqual(len(ThreadPool.return_value.add.call_args_list), 2)
|
self.assertEqual(len(ThreadPool.return_value.add.call_args_list), 2)
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
ThreadPool.return_value.queue_put.call_args_list,
|
ThreadPool.return_value.queue_put.call_args_list,
|
||||||
[mock.call((compose, cfg, compose.variants['Server'], 'x86_64')),
|
[mock.call((compose, cfg, compose.variants['Server'], 'x86_64')),
|
||||||
mock.call((compose, cfg, compose.variants['Server'], 'src'))]
|
mock.call((compose, cfg, compose.variants['Server'], 'src'))]
|
||||||
@ -88,7 +91,8 @@ class ExtraIsosPhaseTest(helpers.PungiTestCase):
|
|||||||
phase.run()
|
phase.run()
|
||||||
|
|
||||||
self.assertEqual(len(ThreadPool.return_value.add.call_args_list), 2)
|
self.assertEqual(len(ThreadPool.return_value.add.call_args_list), 2)
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
ThreadPool.return_value.queue_put.call_args_list,
|
ThreadPool.return_value.queue_put.call_args_list,
|
||||||
[mock.call((compose, cfg, compose.variants['Server'], 'x86_64')),
|
[mock.call((compose, cfg, compose.variants['Server'], 'x86_64')),
|
||||||
mock.call((compose, cfg, compose.variants['Server'], 'amd64'))]
|
mock.call((compose, cfg, compose.variants['Server'], 'amd64'))]
|
||||||
@ -582,7 +586,8 @@ class GetIsoContentsTest(helpers.PungiTestCase):
|
|||||||
'Server/repodata/repomd.xml': '/mnt/repodata/repomd.xml',
|
'Server/repodata/repomd.xml': '/mnt/repodata/repomd.xml',
|
||||||
}
|
}
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
ggp.call_args_list,
|
ggp.call_args_list,
|
||||||
[mock.call([os.path.join(self.topdir, x)]) for x in gp]
|
[mock.call([os.path.join(self.topdir, x)]) for x in gp]
|
||||||
)
|
)
|
||||||
@ -644,7 +649,8 @@ class GetIsoContentsTest(helpers.PungiTestCase):
|
|||||||
"Server/repodata/repomd.xml": "/mnt/repodata/repomd.xml",
|
"Server/repodata/repomd.xml": "/mnt/repodata/repomd.xml",
|
||||||
}
|
}
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
ggp.call_args_list,
|
ggp.call_args_list,
|
||||||
[mock.call([os.path.join(self.topdir, x)]) for x in gp]
|
[mock.call([os.path.join(self.topdir, x)]) for x in gp]
|
||||||
)
|
)
|
||||||
@ -702,7 +708,8 @@ class GetIsoContentsTest(helpers.PungiTestCase):
|
|||||||
'Server/repodata/repomd.xml': '/mnt/repodata/repomd.xml',
|
'Server/repodata/repomd.xml': '/mnt/repodata/repomd.xml',
|
||||||
}
|
}
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
ggp.call_args_list,
|
ggp.call_args_list,
|
||||||
[mock.call([os.path.join(self.topdir, x)]) for x in gp]
|
[mock.call([os.path.join(self.topdir, x)]) for x in gp]
|
||||||
)
|
)
|
||||||
@ -780,7 +787,8 @@ class GetIsoContentsTest(helpers.PungiTestCase):
|
|||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
ggp.call_args_list,
|
ggp.call_args_list,
|
||||||
[mock.call([os.path.join(self.topdir, x)]) for x in gp] + [mock.call([bi_dir, iso_dir])]
|
[mock.call([os.path.join(self.topdir, x)]) for x in gp] + [mock.call([bi_dir, iso_dir])]
|
||||||
)
|
)
|
||||||
|
@ -7,6 +7,8 @@ except ImportError:
|
|||||||
import tempfile
|
import tempfile
|
||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -132,29 +134,30 @@ class TestParseOutput(unittest.TestCase):
|
|||||||
def test_skips_debug_line(self):
|
def test_skips_debug_line(self):
|
||||||
touch(self.file, "debug line\n")
|
touch(self.file, "debug line\n")
|
||||||
packages, modules = fus.parse_output(self.file)
|
packages, modules = fus.parse_output(self.file)
|
||||||
self.assertItemsEqual(packages, [])
|
self.assertEqual(packages, set())
|
||||||
self.assertItemsEqual(modules, [])
|
self.assertEqual(modules, set())
|
||||||
|
|
||||||
def test_separates_arch(self):
|
def test_separates_arch(self):
|
||||||
touch(self.file, "pkg-1.0-1.x86_64@repo-0\npkg-1.0-1.i686@repo-0\n")
|
touch(self.file, "pkg-1.0-1.x86_64@repo-0\npkg-1.0-1.i686@repo-0\n")
|
||||||
packages, modules = fus.parse_output(self.file)
|
packages, modules = fus.parse_output(self.file)
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
packages,
|
packages,
|
||||||
[("pkg-1.0-1", "x86_64", frozenset()), ("pkg-1.0-1", "i686", frozenset())],
|
[("pkg-1.0-1", "x86_64", frozenset()), ("pkg-1.0-1", "i686", frozenset())],
|
||||||
)
|
)
|
||||||
self.assertItemsEqual(modules, [])
|
self.assertEqual(modules, set())
|
||||||
|
|
||||||
def test_marks_modular(self):
|
def test_marks_modular(self):
|
||||||
touch(self.file, "*pkg-1.0-1.x86_64@repo-0\n")
|
touch(self.file, "*pkg-1.0-1.x86_64@repo-0\n")
|
||||||
packages, modules = fus.parse_output(self.file)
|
packages, modules = fus.parse_output(self.file)
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
packages,
|
packages,
|
||||||
[("pkg-1.0-1", "x86_64", frozenset(["modular"]))],
|
set([("pkg-1.0-1", "x86_64", frozenset(["modular"]))]),
|
||||||
)
|
)
|
||||||
self.assertItemsEqual(modules, [])
|
self.assertEqual(modules, set())
|
||||||
|
|
||||||
def test_extracts_modules(self):
|
def test_extracts_modules(self):
|
||||||
touch(self.file, "module:mod:master:20181003:cafebeef.x86_64@repo-0\n")
|
touch(self.file, "module:mod:master:20181003:cafebeef.x86_64@repo-0\n")
|
||||||
packages, modules = fus.parse_output(self.file)
|
packages, modules = fus.parse_output(self.file)
|
||||||
self.assertItemsEqual(packages, [])
|
self.assertEqual(packages, set())
|
||||||
self.assertItemsEqual(modules, ["mod:master:20181003:cafebeef"])
|
self.assertEqual(modules, set(["mod:master:20181003:cafebeef"]))
|
||||||
|
1335
tests/test_gather.py
1335
tests/test_gather.py
File diff suppressed because it is too large
Load Diff
@ -6,6 +6,8 @@ import mock
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
||||||
|
|
||||||
from pungi.phases.gather.methods import method_hybrid as hybrid
|
from pungi.phases.gather.methods import method_hybrid as hybrid
|
||||||
@ -205,7 +207,7 @@ class TestMethodHybrid(helpers.PungiTestCase):
|
|||||||
]
|
]
|
||||||
expanded = m.expand_list(["foo*"])
|
expanded = m.expand_list(["foo*"])
|
||||||
|
|
||||||
self.assertItemsEqual([p.name for p in expanded], ["foo", "foo-en"])
|
six.assertCountEqual(self, [p.name for p in expanded], ["foo", "foo-en"])
|
||||||
|
|
||||||
|
|
||||||
class MockModule(object):
|
class MockModule(object):
|
||||||
@ -331,8 +333,8 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
|||||||
filter_packages=[("foo", None)],
|
filter_packages=[("foo", None)],
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertItemsEqual(res[0], [])
|
self.assertEqual(res[0], set())
|
||||||
self.assertItemsEqual(res[1], ["m1"])
|
self.assertEqual(res[1], set(["m1"]))
|
||||||
self.assertEqual(po.call_args_list, [mock.call(self.logfile1)])
|
self.assertEqual(po.call_args_list, [mock.call(self.logfile1)])
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
run.call_args_list,
|
run.call_args_list,
|
||||||
@ -426,8 +428,8 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
|||||||
filter_packages=[],
|
filter_packages=[],
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertItemsEqual(res[0], po.return_value[0])
|
six.assertCountEqual(self, res[0], po.return_value[0])
|
||||||
self.assertItemsEqual(res[1], [])
|
self.assertEqual(res[1], set())
|
||||||
self.assertEqual(po.call_args_list, [mock.call(self.logfile1)])
|
self.assertEqual(po.call_args_list, [mock.call(self.logfile1)])
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
run.call_args_list,
|
run.call_args_list,
|
||||||
@ -481,14 +483,15 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
|||||||
filter_packages=[],
|
filter_packages=[],
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
res[0],
|
res[0],
|
||||||
[
|
[
|
||||||
("pkg-1.0-1", "x86_64", frozenset()),
|
("pkg-1.0-1", "x86_64", frozenset()),
|
||||||
("pkg-debuginfo-1.0-1", "x86_64", frozenset()),
|
("pkg-debuginfo-1.0-1", "x86_64", frozenset()),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
self.assertItemsEqual(res[1], [])
|
self.assertEqual(res[1], set())
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
po.call_args_list, [mock.call(self.logfile1), mock.call(self.logfile2)]
|
po.call_args_list, [mock.call(self.logfile1), mock.call(self.logfile2)]
|
||||||
)
|
)
|
||||||
@ -552,8 +555,8 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
|||||||
filter_packages=["foo"],
|
filter_packages=["foo"],
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertItemsEqual(res[0], final)
|
six.assertCountEqual(self, res[0], final)
|
||||||
self.assertItemsEqual(res[1], [])
|
self.assertEqual(res[1], set())
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
po.call_args_list, [mock.call(self.logfile1), mock.call(self.logfile2)]
|
po.call_args_list, [mock.call(self.logfile1), mock.call(self.logfile2)]
|
||||||
)
|
)
|
||||||
@ -639,7 +642,8 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
|||||||
filter_packages=[],
|
filter_packages=[],
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
res[0],
|
res[0],
|
||||||
[
|
[
|
||||||
("pkg-devel-1.0-1", "x86_64", frozenset()),
|
("pkg-devel-1.0-1", "x86_64", frozenset()),
|
||||||
@ -647,7 +651,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
|||||||
("pkg-devel-1.0-1", "i686", frozenset()),
|
("pkg-devel-1.0-1", "i686", frozenset()),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
self.assertItemsEqual(res[1], [])
|
self.assertEqual(res[1], set())
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
po.call_args_list, [mock.call(self.logfile1), mock.call(self.logfile2)]
|
po.call_args_list, [mock.call(self.logfile1), mock.call(self.logfile2)]
|
||||||
)
|
)
|
||||||
@ -760,7 +764,8 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
|||||||
filter_packages=[],
|
filter_packages=[],
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
res[0],
|
res[0],
|
||||||
[
|
[
|
||||||
("pkg-devel-1.0-1", "x86_64", frozenset()),
|
("pkg-devel-1.0-1", "x86_64", frozenset()),
|
||||||
@ -768,7 +773,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
|||||||
("foo-1.0-1", "i686", frozenset()),
|
("foo-1.0-1", "i686", frozenset()),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
self.assertItemsEqual(res[1], [])
|
self.assertEqual(res[1], set())
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
po.call_args_list, [mock.call(self.logfile1), mock.call(self.logfile2)]
|
po.call_args_list, [mock.call(self.logfile1), mock.call(self.logfile2)]
|
||||||
)
|
)
|
||||||
@ -981,4 +986,4 @@ class TestFilterModules(helpers.PungiTestCase):
|
|||||||
|
|
||||||
hybrid.filter_modules(self.variant, "x86_64", ["mod:1"])
|
hybrid.filter_modules(self.variant, "x86_64", ["mod:1"])
|
||||||
|
|
||||||
self.assertItemsEqual(self.variant.arch_mmds["x86_64"].keys(), ["mod:1"])
|
self.assertEqual(list(self.variant.arch_mmds["x86_64"].keys()), ["mod:1"])
|
||||||
|
@ -4,6 +4,8 @@ import mock
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
||||||
|
|
||||||
from pungi.phases.gather.methods import method_nodeps as nodeps
|
from pungi.phases.gather.methods import method_nodeps as nodeps
|
||||||
@ -20,6 +22,12 @@ class TestWritePungiConfig(helpers.PungiTestCase):
|
|||||||
|
|
||||||
def test_expand_group(self):
|
def test_expand_group(self):
|
||||||
packages = nodeps.expand_groups(self.compose, 'x86_64', None, ['core', 'text-internet'])
|
packages = nodeps.expand_groups(self.compose, 'x86_64', None, ['core', 'text-internet'])
|
||||||
self.assertItemsEqual(packages, [('dummy-bash', 'x86_64'),
|
six.assertCountEqual(
|
||||||
('dummy-elinks', 'x86_64'),
|
self,
|
||||||
('dummy-tftp', 'x86_64')])
|
packages,
|
||||||
|
[
|
||||||
|
("dummy-bash", "x86_64"),
|
||||||
|
("dummy-elinks", "x86_64"),
|
||||||
|
("dummy-tftp", "x86_64"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
@ -10,6 +10,8 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
||||||
|
|
||||||
from pungi.phases import gather
|
from pungi.phases import gather
|
||||||
@ -122,7 +124,8 @@ class TestGatherWrapper(helpers.PungiTestCase):
|
|||||||
|
|
||||||
self.assertEqual(result, {'x86_64': {'Server': expected_server_packages,
|
self.assertEqual(result, {'x86_64': {'Server': expected_server_packages,
|
||||||
'Server-HA': expected_addon_packages}})
|
'Server-HA': expected_addon_packages}})
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
write_packages.call_args_list,
|
write_packages.call_args_list,
|
||||||
[mock.call(self.compose, 'x86_64', self.variant,
|
[mock.call(self.compose, 'x86_64', self.variant,
|
||||||
expected_server_packages, path_prefix='/build'),
|
expected_server_packages, path_prefix='/build'),
|
||||||
@ -149,7 +152,8 @@ class TestGatherWrapper(helpers.PungiTestCase):
|
|||||||
|
|
||||||
self.assertEqual(result, {'x86_64': {'Server': expected_server_packages,
|
self.assertEqual(result, {'x86_64': {'Server': expected_server_packages,
|
||||||
'Server-LP': expected_lp_packages}})
|
'Server-LP': expected_lp_packages}})
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
write_packages.call_args_list,
|
write_packages.call_args_list,
|
||||||
[mock.call(self.compose, 'x86_64', self.variant,
|
[mock.call(self.compose, 'x86_64', self.variant,
|
||||||
expected_server_packages, path_prefix='/build'),
|
expected_server_packages, path_prefix='/build'),
|
||||||
@ -176,7 +180,8 @@ class TestGatherWrapper(helpers.PungiTestCase):
|
|||||||
|
|
||||||
self.assertEqual(result, {'x86_64': {'Server': expected_server_packages,
|
self.assertEqual(result, {'x86_64': {'Server': expected_server_packages,
|
||||||
'Server-optional': expected_optional_packages}})
|
'Server-optional': expected_optional_packages}})
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
write_packages.call_args_list,
|
write_packages.call_args_list,
|
||||||
[mock.call(self.compose, 'x86_64', self.variant,
|
[mock.call(self.compose, 'x86_64', self.variant,
|
||||||
expected_server_packages, path_prefix='/build'),
|
expected_server_packages, path_prefix='/build'),
|
||||||
@ -223,7 +228,8 @@ class TestGatherWrapper(helpers.PungiTestCase):
|
|||||||
'Server-optional': expected_optional_packages,
|
'Server-optional': expected_optional_packages,
|
||||||
'Server-HA': expected_addon_packages,
|
'Server-HA': expected_addon_packages,
|
||||||
'Server-LP': expected_lp_packages}})
|
'Server-LP': expected_lp_packages}})
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
write_packages.call_args_list,
|
write_packages.call_args_list,
|
||||||
[mock.call(self.compose, 'x86_64', self.compose.all_variants['Server'],
|
[mock.call(self.compose, 'x86_64', self.compose.all_variants['Server'],
|
||||||
expected_server_packages, path_prefix='/build'),
|
expected_server_packages, path_prefix='/build'),
|
||||||
@ -263,7 +269,8 @@ class TestGatherWrapper(helpers.PungiTestCase):
|
|||||||
self.assertEqual(result, {'x86_64': {'Server': expected_server_packages,
|
self.assertEqual(result, {'x86_64': {'Server': expected_server_packages,
|
||||||
'Server-HA': expected_addon_packages,
|
'Server-HA': expected_addon_packages,
|
||||||
'Server-LP': expected_lp_packages}})
|
'Server-LP': expected_lp_packages}})
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
write_packages.call_args_list,
|
write_packages.call_args_list,
|
||||||
[mock.call(self.compose, 'x86_64', self.compose.all_variants['Server'],
|
[mock.call(self.compose, 'x86_64', self.compose.all_variants['Server'],
|
||||||
expected_server_packages, path_prefix='/build'),
|
expected_server_packages, path_prefix='/build'),
|
||||||
@ -309,8 +316,8 @@ class TestGetSystemRelease(unittest.TestCase):
|
|||||||
_make_materialized_pkgsets({"x86_64": pkgset}),
|
_make_materialized_pkgsets({"x86_64": pkgset}),
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertItemsEqual(packages, [])
|
self.assertEqual(packages, set())
|
||||||
self.assertItemsEqual(filter_packages, [])
|
self.assertEqual(filter_packages, set())
|
||||||
|
|
||||||
def test_picks_single(self):
|
def test_picks_single(self):
|
||||||
pkgset = MockPackageSet(
|
pkgset = MockPackageSet(
|
||||||
@ -323,8 +330,8 @@ class TestGetSystemRelease(unittest.TestCase):
|
|||||||
_make_materialized_pkgsets({"x86_64": pkgset}),
|
_make_materialized_pkgsets({"x86_64": pkgset}),
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertItemsEqual(packages, [('dummy', None)])
|
self.assertEqual(packages, set([("dummy", None)]))
|
||||||
self.assertItemsEqual(filter_packages, [])
|
self.assertEqual(filter_packages, set())
|
||||||
|
|
||||||
def test_prefers_variant(self):
|
def test_prefers_variant(self):
|
||||||
pkgset = MockPackageSet(
|
pkgset = MockPackageSet(
|
||||||
@ -338,8 +345,8 @@ class TestGetSystemRelease(unittest.TestCase):
|
|||||||
[MaterializedPackageSet({"x86_64": pkgset}, {})],
|
[MaterializedPackageSet({"x86_64": pkgset}, {})],
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertItemsEqual(packages, [('system-release-server', None)])
|
self.assertEqual(packages, set([("system-release-server", None)]))
|
||||||
self.assertItemsEqual(filter_packages, [('system-release', None)])
|
self.assertEqual(filter_packages, set([("system-release", None)]))
|
||||||
|
|
||||||
def test_no_best_match(self):
|
def test_no_best_match(self):
|
||||||
pkgset = MockPackageSet(
|
pkgset = MockPackageSet(
|
||||||
@ -372,10 +379,12 @@ class TestGetSystemRelease(unittest.TestCase):
|
|||||||
[MaterializedPackageSet({"x86_64": pkgset}, {})],
|
[MaterializedPackageSet({"x86_64": pkgset}, {})],
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertItemsEqual(packages, [('system-release-server', None)])
|
self.assertEqual(packages, set([("system-release-server", None)]))
|
||||||
self.assertItemsEqual(filter_packages,
|
six.assertCountEqual(
|
||||||
[('system-release-client', None),
|
self,
|
||||||
('system-release', None)])
|
filter_packages,
|
||||||
|
set([("system-release-client", None), ("system-release", None)]),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class TestTrimPackages(unittest.TestCase):
|
class TestTrimPackages(unittest.TestCase):
|
||||||
@ -465,21 +474,25 @@ class TestWritePackages(helpers.PungiTestCase):
|
|||||||
|
|
||||||
with open(os.path.join(self.topdir, 'work', 'x86_64', 'package_list',
|
with open(os.path.join(self.topdir, 'work', 'x86_64', 'package_list',
|
||||||
'Server.x86_64.rpm.conf')) as f:
|
'Server.x86_64.rpm.conf')) as f:
|
||||||
self.assertItemsEqual(f.read().strip().split('\n'),
|
six.assertCountEqual(
|
||||||
['/build/foo-1.0-1.x86_64.rpm',
|
self,
|
||||||
'/build/foo-common-1.0-1.x86_64.rpm',
|
f.read().strip().split("\n"),
|
||||||
'/build/bar-1.0-1.noarch.rpm'])
|
["/build/foo-1.0-1.x86_64.rpm",
|
||||||
|
"/build/foo-common-1.0-1.x86_64.rpm",
|
||||||
|
"/build/bar-1.0-1.noarch.rpm"]
|
||||||
|
)
|
||||||
|
|
||||||
with open(os.path.join(self.topdir, 'work', 'x86_64', 'package_list',
|
with open(os.path.join(self.topdir, 'work', 'x86_64', 'package_list',
|
||||||
'Server.x86_64.srpm.conf')) as f:
|
'Server.x86_64.srpm.conf')) as f:
|
||||||
self.assertItemsEqual(f.read().strip().split('\n'),
|
six.assertCountEqual(
|
||||||
['/build/foo-1.0-1.src.rpm',
|
self,
|
||||||
'/build/bar-1.0-1.src.rpm'])
|
f.read().strip().split("\n"),
|
||||||
|
["/build/foo-1.0-1.src.rpm", "/build/bar-1.0-1.src.rpm"],
|
||||||
|
)
|
||||||
|
|
||||||
with open(os.path.join(self.topdir, 'work', 'x86_64', 'package_list',
|
with open(os.path.join(self.topdir, 'work', 'x86_64', 'package_list',
|
||||||
'Server.x86_64.debuginfo.conf')) as f:
|
'Server.x86_64.debuginfo.conf')) as f:
|
||||||
self.assertItemsEqual(f.read().strip().split('\n'),
|
self.assertEqual(f.read(), "/build/foo-debuginfo-1.0-1.x86_64.rpm\n")
|
||||||
['/build/foo-debuginfo-1.0-1.x86_64.rpm'])
|
|
||||||
|
|
||||||
|
|
||||||
class TestGetVariantPackages(helpers.PungiTestCase):
|
class TestGetVariantPackages(helpers.PungiTestCase):
|
||||||
@ -487,9 +500,9 @@ class TestGetVariantPackages(helpers.PungiTestCase):
|
|||||||
compose = helpers.DummyCompose(self.topdir, {})
|
compose = helpers.DummyCompose(self.topdir, {})
|
||||||
packages, groups, filter_packages = gather.get_variant_packages(
|
packages, groups, filter_packages = gather.get_variant_packages(
|
||||||
compose, 'x86_64', None, 'comps')
|
compose, 'x86_64', None, 'comps')
|
||||||
self.assertItemsEqual(packages, [])
|
self.assertEqual(packages, set())
|
||||||
self.assertItemsEqual(groups, [])
|
self.assertEqual(groups, set())
|
||||||
self.assertItemsEqual(filter_packages, [])
|
self.assertEqual(filter_packages, set())
|
||||||
|
|
||||||
@mock.patch('pungi.phases.gather.get_gather_source')
|
@mock.patch('pungi.phases.gather.get_gather_source')
|
||||||
def test_just_source(self, get_gather_source):
|
def test_just_source(self, get_gather_source):
|
||||||
@ -500,9 +513,9 @@ class TestGetVariantPackages(helpers.PungiTestCase):
|
|||||||
|
|
||||||
packages, groups, filter_packages = gather.get_variant_packages(
|
packages, groups, filter_packages = gather.get_variant_packages(
|
||||||
compose, 'x86_64', compose.variants['Server'], 'comps')
|
compose, 'x86_64', compose.variants['Server'], 'comps')
|
||||||
self.assertItemsEqual(packages, ['foo'])
|
self.assertEqual(packages, set(["foo"]))
|
||||||
self.assertItemsEqual(groups, ['core'])
|
self.assertEqual(groups, set(["core"]))
|
||||||
self.assertItemsEqual(filter_packages, [])
|
self.assertEqual(filter_packages, set())
|
||||||
|
|
||||||
@mock.patch('pungi.phases.gather.get_gather_source')
|
@mock.patch('pungi.phases.gather.get_gather_source')
|
||||||
def test_filter_system_release(self, get_gather_source):
|
def test_filter_system_release(self, get_gather_source):
|
||||||
@ -521,9 +534,9 @@ class TestGetVariantPackages(helpers.PungiTestCase):
|
|||||||
compose.variants["Server"], "comps",
|
compose.variants["Server"], "comps",
|
||||||
package_sets=[MaterializedPackageSet({"x86_64": pkgset}, {})],
|
package_sets=[MaterializedPackageSet({"x86_64": pkgset}, {})],
|
||||||
)
|
)
|
||||||
self.assertItemsEqual(packages, [('system-release-server', None)])
|
self.assertEqual(packages, set([("system-release-server", None)]))
|
||||||
self.assertItemsEqual(groups, [])
|
self.assertEqual(groups, set())
|
||||||
self.assertItemsEqual(filter_packages, [('system-release', None)])
|
self.assertEqual(filter_packages, set([("system-release", None)]))
|
||||||
|
|
||||||
@mock.patch('pungi.phases.gather.get_gather_source')
|
@mock.patch('pungi.phases.gather.get_gather_source')
|
||||||
def test_disable_filter_system_release(self, get_gather_source):
|
def test_disable_filter_system_release(self, get_gather_source):
|
||||||
@ -545,9 +558,9 @@ class TestGetVariantPackages(helpers.PungiTestCase):
|
|||||||
"comps",
|
"comps",
|
||||||
package_sets=[MaterializedPackageSet({"x86_64": pkgset}, {})],
|
package_sets=[MaterializedPackageSet({"x86_64": pkgset}, {})],
|
||||||
)
|
)
|
||||||
self.assertItemsEqual(packages, [])
|
self.assertEqual(packages, set())
|
||||||
self.assertItemsEqual(groups, [])
|
self.assertEqual(groups, set())
|
||||||
self.assertItemsEqual(filter_packages, [])
|
self.assertEqual(filter_packages, set())
|
||||||
|
|
||||||
@mock.patch('pungi.phases.gather.get_gather_source')
|
@mock.patch('pungi.phases.gather.get_gather_source')
|
||||||
def test_optional_gets_parent_and_addon(self, get_gather_source):
|
def test_optional_gets_parent_and_addon(self, get_gather_source):
|
||||||
@ -570,9 +583,9 @@ class TestGetVariantPackages(helpers.PungiTestCase):
|
|||||||
|
|
||||||
packages, groups, filter_packages = gather.get_variant_packages(
|
packages, groups, filter_packages = gather.get_variant_packages(
|
||||||
compose, 'x86_64', compose.all_variants['Server-optional'], 'comps')
|
compose, 'x86_64', compose.all_variants['Server-optional'], 'comps')
|
||||||
self.assertItemsEqual(packages, ['server-pkg', 'addon-pkg', 'opt-pkg'])
|
six.assertCountEqual(self, packages, ["server-pkg", "addon-pkg", "opt-pkg"])
|
||||||
self.assertItemsEqual(groups, ['server-group', 'addon-group', 'opt-group'])
|
six.assertCountEqual(self, groups, ["server-group", "addon-group", "opt-group"])
|
||||||
self.assertItemsEqual(filter_packages, [])
|
self.assertEqual(filter_packages, set())
|
||||||
|
|
||||||
@mock.patch('pungi.phases.gather.get_gather_source')
|
@mock.patch('pungi.phases.gather.get_gather_source')
|
||||||
def test_optional_does_not_inherit_filters(self, get_gather_source):
|
def test_optional_does_not_inherit_filters(self, get_gather_source):
|
||||||
@ -590,9 +603,9 @@ class TestGetVariantPackages(helpers.PungiTestCase):
|
|||||||
|
|
||||||
packages, groups, filter_packages = gather.get_variant_packages(
|
packages, groups, filter_packages = gather.get_variant_packages(
|
||||||
compose, 'x86_64', compose.all_variants['Server-optional'], 'comps')
|
compose, 'x86_64', compose.all_variants['Server-optional'], 'comps')
|
||||||
self.assertItemsEqual(packages, [])
|
self.assertEqual(packages, set())
|
||||||
self.assertItemsEqual(groups, [])
|
self.assertEqual(groups, set())
|
||||||
self.assertItemsEqual(filter_packages, [])
|
self.assertEqual(filter_packages, set())
|
||||||
|
|
||||||
@mock.patch('pungi.phases.gather.get_gather_source')
|
@mock.patch('pungi.phases.gather.get_gather_source')
|
||||||
def test_additional_packages(self, get_gather_source):
|
def test_additional_packages(self, get_gather_source):
|
||||||
@ -608,9 +621,9 @@ class TestGetVariantPackages(helpers.PungiTestCase):
|
|||||||
|
|
||||||
packages, groups, filter_packages = gather.get_variant_packages(
|
packages, groups, filter_packages = gather.get_variant_packages(
|
||||||
compose, 'x86_64', compose.all_variants['Server'], 'comps')
|
compose, 'x86_64', compose.all_variants['Server'], 'comps')
|
||||||
self.assertItemsEqual(packages, [('pkg', None), ('foo', 'x86_64')])
|
six.assertCountEqual(self, packages, [("pkg", None), ("foo", "x86_64")])
|
||||||
self.assertItemsEqual(groups, [])
|
self.assertEqual(groups, set())
|
||||||
self.assertItemsEqual(filter_packages, [])
|
self.assertEqual(filter_packages, set())
|
||||||
|
|
||||||
@mock.patch('pungi.phases.gather.get_gather_source')
|
@mock.patch('pungi.phases.gather.get_gather_source')
|
||||||
def test_additional_packages_incompatible_arch(self, get_gather_source):
|
def test_additional_packages_incompatible_arch(self, get_gather_source):
|
||||||
@ -767,7 +780,7 @@ class TestGatherPackages(helpers.PungiTestCase):
|
|||||||
variant = compose.variants["Server"]
|
variant = compose.variants["Server"]
|
||||||
pkg_set = mock.Mock()
|
pkg_set = mock.Mock()
|
||||||
gather.gather_packages(compose, "x86_64", variant, pkg_set),
|
gather.gather_packages(compose, "x86_64", variant, pkg_set),
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
get_variant_packages.call_args_list,
|
get_variant_packages.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(compose, "x86_64", variant, "comps", pkg_set)
|
mock.call(compose, "x86_64", variant, "comps", pkg_set)
|
||||||
@ -824,7 +837,8 @@ class TestGetPrepopulate(helpers.PungiTestCase):
|
|||||||
def test_for_one_variant(self):
|
def test_for_one_variant(self):
|
||||||
helpers.copy_fixture('prepopulate.json',
|
helpers.copy_fixture('prepopulate.json',
|
||||||
os.path.join(self.topdir, 'work', 'global', 'prepopulate.json'))
|
os.path.join(self.topdir, 'work', 'global', 'prepopulate.json'))
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
gather.get_prepopulate_packages(self.compose, 'x86_64', self.compose.variants['Server']),
|
gather.get_prepopulate_packages(self.compose, 'x86_64', self.compose.variants['Server']),
|
||||||
["foo-common.noarch",
|
["foo-common.noarch",
|
||||||
"foo.i686",
|
"foo.i686",
|
||||||
@ -834,7 +848,8 @@ class TestGetPrepopulate(helpers.PungiTestCase):
|
|||||||
def test_for_all_variants(self):
|
def test_for_all_variants(self):
|
||||||
helpers.copy_fixture('prepopulate.json',
|
helpers.copy_fixture('prepopulate.json',
|
||||||
os.path.join(self.topdir, 'work', 'global', 'prepopulate.json'))
|
os.path.join(self.topdir, 'work', 'global', 'prepopulate.json'))
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
gather.get_prepopulate_packages(self.compose, 'x86_64', None),
|
gather.get_prepopulate_packages(self.compose, 'x86_64', None),
|
||||||
["foo-common.noarch",
|
["foo-common.noarch",
|
||||||
"foo.i686",
|
"foo.i686",
|
||||||
@ -845,7 +860,8 @@ class TestGetPrepopulate(helpers.PungiTestCase):
|
|||||||
def test_for_all_variants_include_arch_set_to_false(self):
|
def test_for_all_variants_include_arch_set_to_false(self):
|
||||||
helpers.copy_fixture('prepopulate.json',
|
helpers.copy_fixture('prepopulate.json',
|
||||||
os.path.join(self.topdir, 'work', 'global', 'prepopulate.json'))
|
os.path.join(self.topdir, 'work', 'global', 'prepopulate.json'))
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
gather.get_prepopulate_packages(self.compose, 'x86_64', None,
|
gather.get_prepopulate_packages(self.compose, 'x86_64', None,
|
||||||
include_arch=False),
|
include_arch=False),
|
||||||
["foo-common",
|
["foo-common",
|
||||||
@ -875,7 +891,8 @@ class TestGatherPhase(helpers.PungiTestCase):
|
|||||||
|
|
||||||
self.assertEqual(gather_wrapper.call_args_list,
|
self.assertEqual(gather_wrapper.call_args_list,
|
||||||
[mock.call(compose, pkgset_phase.package_sets, pkgset_phase.path_prefix)])
|
[mock.call(compose, pkgset_phase.package_sets, pkgset_phase.path_prefix)])
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
link_files.call_args_list,
|
link_files.call_args_list,
|
||||||
[_mk_link_call('x86_64', 'Server'),
|
[_mk_link_call('x86_64', 'Server'),
|
||||||
_mk_link_call('amd64', 'Server'),
|
_mk_link_call('amd64', 'Server'),
|
||||||
@ -943,8 +960,8 @@ class TestGetPackagesToGather(helpers.PungiTestCase):
|
|||||||
|
|
||||||
packages, groups = gather.get_packages_to_gather(self.compose)
|
packages, groups = gather.get_packages_to_gather(self.compose)
|
||||||
|
|
||||||
self.assertItemsEqual(packages, ["foo", "foo2.x86_64", "pkg"])
|
six.assertCountEqual(self, packages, ["foo", "foo2.x86_64", "pkg"])
|
||||||
self.assertItemsEqual(groups, ["core"])
|
self.assertEqual(groups, ["core"])
|
||||||
|
|
||||||
@mock.patch('pungi.phases.gather.get_gather_source')
|
@mock.patch('pungi.phases.gather.get_gather_source')
|
||||||
def test_all_include_arch_set_to_false(self, get_gather_source):
|
def test_all_include_arch_set_to_false(self, get_gather_source):
|
||||||
@ -954,8 +971,8 @@ class TestGetPackagesToGather(helpers.PungiTestCase):
|
|||||||
|
|
||||||
packages, groups = gather.get_packages_to_gather(self.compose, include_arch=False)
|
packages, groups = gather.get_packages_to_gather(self.compose, include_arch=False)
|
||||||
|
|
||||||
self.assertItemsEqual(packages, ["foo", "foo2", "pkg"])
|
six.assertCountEqual(self, packages, ["foo", "foo2", "pkg"])
|
||||||
self.assertItemsEqual(groups, ["core"])
|
self.assertEqual(groups, ["core"])
|
||||||
|
|
||||||
@mock.patch('pungi.phases.gather.get_gather_source')
|
@mock.patch('pungi.phases.gather.get_gather_source')
|
||||||
def test_all_include_prepopulated(self, get_gather_source):
|
def test_all_include_prepopulated(self, get_gather_source):
|
||||||
@ -965,10 +982,13 @@ class TestGetPackagesToGather(helpers.PungiTestCase):
|
|||||||
|
|
||||||
packages, groups = gather.get_packages_to_gather(self.compose, include_prepopulated=True)
|
packages, groups = gather.get_packages_to_gather(self.compose, include_prepopulated=True)
|
||||||
|
|
||||||
self.assertItemsEqual(packages, ["foo", "pkg", "foo-common.noarch",
|
six.assertCountEqual(
|
||||||
"foo.x86_64", "foo.i686", "foo2.x86_64",
|
self,
|
||||||
"bar.x86_64"])
|
packages,
|
||||||
self.assertItemsEqual(groups, ["core"])
|
["foo", "pkg", "foo-common.noarch", "foo.x86_64", "foo.i686", "foo2.x86_64",
|
||||||
|
"bar.x86_64"],
|
||||||
|
)
|
||||||
|
self.assertEqual(groups, ["core"])
|
||||||
|
|
||||||
@mock.patch('pungi.phases.gather.get_gather_source')
|
@mock.patch('pungi.phases.gather.get_gather_source')
|
||||||
def test_all_include_prepopulated_no_include_arch(self, get_gather_source):
|
def test_all_include_prepopulated_no_include_arch(self, get_gather_source):
|
||||||
@ -979,9 +999,10 @@ class TestGetPackagesToGather(helpers.PungiTestCase):
|
|||||||
packages, groups = gather.get_packages_to_gather(self.compose, include_prepopulated=True,
|
packages, groups = gather.get_packages_to_gather(self.compose, include_prepopulated=True,
|
||||||
include_arch=False)
|
include_arch=False)
|
||||||
|
|
||||||
self.assertItemsEqual(packages, ["foo", "pkg", "foo-common",
|
six.assertCountEqual(
|
||||||
"foo2", "bar"])
|
self, packages, ["foo", "pkg", "foo-common", "foo2", "bar"]
|
||||||
self.assertItemsEqual(groups, ["core"])
|
)
|
||||||
|
self.assertEqual(groups, ["core"])
|
||||||
|
|
||||||
@mock.patch('pungi.phases.gather.get_gather_source')
|
@mock.patch('pungi.phases.gather.get_gather_source')
|
||||||
def test_all_one_arch(self, get_gather_source):
|
def test_all_one_arch(self, get_gather_source):
|
||||||
@ -991,8 +1012,8 @@ class TestGetPackagesToGather(helpers.PungiTestCase):
|
|||||||
|
|
||||||
packages, groups = gather.get_packages_to_gather(self.compose, "x86_64")
|
packages, groups = gather.get_packages_to_gather(self.compose, "x86_64")
|
||||||
|
|
||||||
self.assertItemsEqual(packages, ["foo", "pkg", "foo2.x86_64"])
|
six.assertCountEqual(self, packages, ["foo", "pkg", "foo2.x86_64"])
|
||||||
self.assertItemsEqual(groups, ["core"])
|
self.assertEqual(groups, ["core"])
|
||||||
|
|
||||||
|
|
||||||
class TestUpdateConfig(unittest.TestCase):
|
class TestUpdateConfig(unittest.TestCase):
|
||||||
@ -1091,10 +1112,15 @@ class TestMakeLookasideRepo(helpers.PungiTestCase):
|
|||||||
def assertCorrect(self, repopath, path_prefix, MockCR, mock_run):
|
def assertCorrect(self, repopath, path_prefix, MockCR, mock_run):
|
||||||
with open(self.pkglist) as f:
|
with open(self.pkglist) as f:
|
||||||
packages = f.read().splitlines()
|
packages = f.read().splitlines()
|
||||||
self.assertItemsEqual(packages,
|
six.assertCountEqual(
|
||||||
['pkg/pkg-1.0-1.x86_64.rpm',
|
self,
|
||||||
'pkg/pkg-debuginfo-1.0-1.x86_64.rpm',
|
packages,
|
||||||
'pkg/pkg-1.0-1.src.rpm'])
|
[
|
||||||
|
"pkg/pkg-1.0-1.x86_64.rpm",
|
||||||
|
"pkg/pkg-debuginfo-1.0-1.x86_64.rpm",
|
||||||
|
"pkg/pkg-1.0-1.src.rpm",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
self.assertEqual(self.repodir, repopath)
|
self.assertEqual(self.repodir, repopath)
|
||||||
self.assertEqual(MockCR.return_value.get_createrepo_cmd.call_args_list,
|
self.assertEqual(MockCR.return_value.get_createrepo_cmd.call_args_list,
|
||||||
|
@ -6,6 +6,7 @@ except ImportError:
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
import six
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -41,8 +42,8 @@ class TestGatherSourceModule(helpers.PungiTestCase):
|
|||||||
def test_without_modules(self):
|
def test_without_modules(self):
|
||||||
source = GatherSourceModule(self.compose)
|
source = GatherSourceModule(self.compose)
|
||||||
packages, groups = source("x86_64", self.compose.variants["Server"])
|
packages, groups = source("x86_64", self.compose.variants["Server"])
|
||||||
self.assertItemsEqual(packages, [])
|
self.assertEqual(packages, set())
|
||||||
self.assertItemsEqual(groups, [])
|
self.assertEqual(groups, set())
|
||||||
|
|
||||||
def test_include_two_packages(self):
|
def test_include_two_packages(self):
|
||||||
self.compose.variants["Server"].add_fake_module(
|
self.compose.variants["Server"].add_fake_module(
|
||||||
@ -57,11 +58,12 @@ class TestGatherSourceModule(helpers.PungiTestCase):
|
|||||||
|
|
||||||
source = GatherSourceModule(self.compose)
|
source = GatherSourceModule(self.compose)
|
||||||
packages, groups = source("x86_64", self.compose.variants["Server"])
|
packages, groups = source("x86_64", self.compose.variants["Server"])
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
[(rpm[0].nevra, rpm[1]) for rpm in packages],
|
[(rpm[0].nevra, rpm[1]) for rpm in packages],
|
||||||
[("pkg-0:1.0.0-1.x86_64", None), ("pkg-0:1.0.0-1.i686", None)],
|
[("pkg-0:1.0.0-1.x86_64", None), ("pkg-0:1.0.0-1.i686", None)],
|
||||||
)
|
)
|
||||||
self.assertItemsEqual(groups, [])
|
self.assertEqual(groups, set())
|
||||||
|
|
||||||
def test_does_not_include_unlisted(self):
|
def test_does_not_include_unlisted(self):
|
||||||
self.compose.variants["Server"].add_fake_module(
|
self.compose.variants["Server"].add_fake_module(
|
||||||
@ -75,5 +77,5 @@ class TestGatherSourceModule(helpers.PungiTestCase):
|
|||||||
|
|
||||||
source = GatherSourceModule(self.compose)
|
source = GatherSourceModule(self.compose)
|
||||||
packages, groups = source("x86_64", self.compose.variants["Server"])
|
packages, groups = source("x86_64", self.compose.variants["Server"])
|
||||||
self.assertItemsEqual(packages, [])
|
self.assertEqual(packages, set())
|
||||||
self.assertItemsEqual(groups, [])
|
self.assertEqual(groups, set())
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -96,9 +98,11 @@ class TestImageBuildPhase(PungiTestCase):
|
|||||||
"link_type": 'hardlink-or-copy',
|
"link_type": 'hardlink-or-copy',
|
||||||
"scratch": False,
|
"scratch": False,
|
||||||
}
|
}
|
||||||
self.assertItemsEqual(phase.pool.queue_put.mock_calls,
|
six.assertCountEqual(
|
||||||
[mock.call((compose, client_args)),
|
self,
|
||||||
mock.call((compose, server_args))])
|
phase.pool.queue_put.mock_calls,
|
||||||
|
[mock.call((compose, client_args)), mock.call((compose, server_args))],
|
||||||
|
)
|
||||||
|
|
||||||
@mock.patch('pungi.phases.image_build.ThreadPool')
|
@mock.patch('pungi.phases.image_build.ThreadPool')
|
||||||
def test_image_build_phase_global_options(self, ThreadPool):
|
def test_image_build_phase_global_options(self, ThreadPool):
|
||||||
@ -155,8 +159,9 @@ class TestImageBuildPhase(PungiTestCase):
|
|||||||
"link_type": 'hardlink-or-copy',
|
"link_type": 'hardlink-or-copy',
|
||||||
"scratch": False,
|
"scratch": False,
|
||||||
}
|
}
|
||||||
self.assertItemsEqual(phase.pool.queue_put.mock_calls,
|
self.assertEqual(
|
||||||
[mock.call((compose, server_args))])
|
phase.pool.queue_put.mock_calls, [mock.call((compose, server_args))]
|
||||||
|
)
|
||||||
|
|
||||||
@mock.patch('pungi.phases.image_build.ThreadPool')
|
@mock.patch('pungi.phases.image_build.ThreadPool')
|
||||||
def test_image_build_phase_missing_version(self, ThreadPool):
|
def test_image_build_phase_missing_version(self, ThreadPool):
|
||||||
@ -210,8 +215,9 @@ class TestImageBuildPhase(PungiTestCase):
|
|||||||
"link_type": 'hardlink-or-copy',
|
"link_type": 'hardlink-or-copy',
|
||||||
"scratch": False,
|
"scratch": False,
|
||||||
}
|
}
|
||||||
self.assertItemsEqual(phase.pool.queue_put.mock_calls,
|
self.assertEqual(
|
||||||
[mock.call((compose, server_args))])
|
phase.pool.queue_put.mock_calls, [mock.call((compose, server_args))]
|
||||||
|
)
|
||||||
|
|
||||||
@mock.patch('pungi.phases.image_build.ThreadPool')
|
@mock.patch('pungi.phases.image_build.ThreadPool')
|
||||||
def test_image_build_filter_all_variants(self, ThreadPool):
|
def test_image_build_filter_all_variants(self, ThreadPool):
|
||||||
@ -660,8 +666,9 @@ class TestImageBuildPhase(PungiTestCase):
|
|||||||
"link_type": 'hardlink-or-copy',
|
"link_type": 'hardlink-or-copy',
|
||||||
"scratch": False,
|
"scratch": False,
|
||||||
}
|
}
|
||||||
self.assertItemsEqual(phase.pool.queue_put.mock_calls,
|
self.assertEqual(
|
||||||
[mock.call((compose, server_args))])
|
phase.pool.queue_put.mock_calls, [mock.call((compose, server_args))]
|
||||||
|
)
|
||||||
|
|
||||||
@mock.patch('pungi.phases.image_build.ThreadPool')
|
@mock.patch('pungi.phases.image_build.ThreadPool')
|
||||||
def test_failable_star(self, ThreadPool):
|
def test_failable_star(self, ThreadPool):
|
||||||
@ -719,8 +726,9 @@ class TestImageBuildPhase(PungiTestCase):
|
|||||||
"link_type": 'hardlink-or-copy',
|
"link_type": 'hardlink-or-copy',
|
||||||
"scratch": False,
|
"scratch": False,
|
||||||
}
|
}
|
||||||
self.assertItemsEqual(phase.pool.queue_put.mock_calls,
|
self.assertEqual(
|
||||||
[mock.call((compose, server_args))])
|
phase.pool.queue_put.mock_calls, [mock.call((compose, server_args))]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class TestCreateImageBuildThread(PungiTestCase):
|
class TestCreateImageBuildThread(PungiTestCase):
|
||||||
@ -785,20 +793,21 @@ class TestCreateImageBuildThread(PungiTestCase):
|
|||||||
with mock.patch('time.sleep'):
|
with mock.patch('time.sleep'):
|
||||||
t.process((compose, cmd), 1)
|
t.process((compose, cmd), 1)
|
||||||
|
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
koji_wrapper.get_image_build_cmd.call_args_list,
|
koji_wrapper.get_image_build_cmd.call_args_list,
|
||||||
[mock.call(cmd['image_conf'],
|
[mock.call(cmd['image_conf'],
|
||||||
conf_file_dest='amd64,x86_64-Client-Fedora-Docker-Base-docker',
|
conf_file_dest='amd64,x86_64-Client-Fedora-Docker-Base-docker',
|
||||||
scratch=False)]
|
scratch=False)]
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
koji_wrapper.run_blocking_cmd.call_args_list,
|
koji_wrapper.run_blocking_cmd.call_args_list,
|
||||||
[mock.call(koji_wrapper.get_image_build_cmd.return_value,
|
[mock.call(koji_wrapper.get_image_build_cmd.return_value,
|
||||||
log_file=self.topdir + '/logs/amd64-x86_64/imagebuild-Client-KDE-docker-qcow2.amd64-x86_64.log')]
|
log_file=self.topdir + '/logs/amd64-x86_64/imagebuild-Client-KDE-docker-qcow2.amd64-x86_64.log')]
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
linker.mock_calls,
|
linker.mock_calls,
|
||||||
[mock.call.link(
|
[mock.call.link(
|
||||||
'/koji/task/1235/Fedora-Docker-Base-20160103.amd64.qcow2',
|
'/koji/task/1235/Fedora-Docker-Base-20160103.amd64.qcow2',
|
||||||
|
@ -7,6 +7,8 @@ except ImportError:
|
|||||||
import unittest
|
import unittest
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -48,25 +50,34 @@ class TestInitPhase(PungiTestCase):
|
|||||||
|
|
||||||
self.assertEqual(write_global.mock_calls, [mock.call(compose)])
|
self.assertEqual(write_global.mock_calls, [mock.call(compose)])
|
||||||
self.assertEqual(write_prepopulate.mock_calls, [mock.call(compose)])
|
self.assertEqual(write_prepopulate.mock_calls, [mock.call(compose)])
|
||||||
self.assertItemsEqual(write_arch.mock_calls,
|
six.assertCountEqual(
|
||||||
[mock.call(compose, 'x86_64'), mock.call(compose, 'amd64')])
|
self,
|
||||||
self.assertItemsEqual(create_comps.mock_calls,
|
write_arch.mock_calls,
|
||||||
[mock.call(compose, 'x86_64', None), mock.call(compose, 'amd64', None),
|
[mock.call(compose, "x86_64"), mock.call(compose, "amd64")],
|
||||||
mock.call(compose, 'x86_64', compose.variants['Server']),
|
)
|
||||||
mock.call(compose, 'amd64', compose.variants['Server']),
|
six.assertCountEqual(
|
||||||
mock.call(compose, 'amd64', compose.variants['Client']),
|
self,
|
||||||
mock.call(compose, 'x86_64', compose.variants['Everything']),
|
create_comps.mock_calls,
|
||||||
mock.call(compose, 'amd64', compose.variants['Everything']),
|
[mock.call(compose, "x86_64", None), mock.call(compose, "amd64", None),
|
||||||
mock.call(compose, 'x86_64', compose.all_variants['Server-optional'])])
|
mock.call(compose, "x86_64", compose.variants["Server"]),
|
||||||
self.assertItemsEqual(write_variant.mock_calls,
|
mock.call(compose, "amd64", compose.variants["Server"]),
|
||||||
[mock.call(compose, 'x86_64', compose.variants['Server']),
|
mock.call(compose, "amd64", compose.variants["Client"]),
|
||||||
mock.call(compose, 'amd64', compose.variants['Server']),
|
mock.call(compose, "x86_64", compose.variants["Everything"]),
|
||||||
mock.call(compose, 'amd64', compose.variants['Client']),
|
mock.call(compose, "amd64", compose.variants["Everything"]),
|
||||||
mock.call(compose, 'x86_64', compose.variants['Everything']),
|
mock.call(compose, "x86_64", compose.all_variants["Server-optional"])],
|
||||||
mock.call(compose, 'amd64', compose.variants['Everything']),
|
)
|
||||||
mock.call(compose, 'x86_64', compose.all_variants['Server-optional'])])
|
six.assertCountEqual(
|
||||||
self.assertItemsEqual(write_defaults, [])
|
self,
|
||||||
self.assertItemsEqual(validate_defaults, [])
|
write_variant.mock_calls,
|
||||||
|
[mock.call(compose, "x86_64", compose.variants["Server"]),
|
||||||
|
mock.call(compose, "amd64", compose.variants["Server"]),
|
||||||
|
mock.call(compose, "amd64", compose.variants["Client"]),
|
||||||
|
mock.call(compose, "x86_64", compose.variants["Everything"]),
|
||||||
|
mock.call(compose, "amd64", compose.variants["Everything"]),
|
||||||
|
mock.call(compose, "x86_64", compose.all_variants["Server-optional"])],
|
||||||
|
)
|
||||||
|
self.assertEqual(write_defaults.call_args_list, [])
|
||||||
|
self.assertEqual(validate_defaults.call_args_list, [])
|
||||||
|
|
||||||
def test_run_with_preserve(
|
def test_run_with_preserve(
|
||||||
self,
|
self,
|
||||||
@ -92,23 +103,32 @@ class TestInitPhase(PungiTestCase):
|
|||||||
validate_comps.call_args_list, [mock.call(write_global.return_value)]
|
validate_comps.call_args_list, [mock.call(write_global.return_value)]
|
||||||
)
|
)
|
||||||
self.assertEqual(write_prepopulate.mock_calls, [mock.call(compose)])
|
self.assertEqual(write_prepopulate.mock_calls, [mock.call(compose)])
|
||||||
self.assertItemsEqual(write_arch.mock_calls,
|
six.assertCountEqual(
|
||||||
[mock.call(compose, 'x86_64'), mock.call(compose, 'amd64')])
|
self,
|
||||||
self.assertItemsEqual(create_comps.mock_calls,
|
write_arch.mock_calls,
|
||||||
[mock.call(compose, 'x86_64', None), mock.call(compose, 'amd64', None),
|
[mock.call(compose, "x86_64"), mock.call(compose, "amd64")],
|
||||||
mock.call(compose, 'x86_64', compose.variants['Server']),
|
)
|
||||||
mock.call(compose, 'amd64', compose.variants['Server']),
|
six.assertCountEqual(
|
||||||
mock.call(compose, 'amd64', compose.variants['Client']),
|
self,
|
||||||
mock.call(compose, 'x86_64', compose.variants['Everything']),
|
create_comps.mock_calls,
|
||||||
mock.call(compose, 'amd64', compose.variants['Everything'])])
|
[mock.call(compose, "x86_64", None), mock.call(compose, "amd64", None),
|
||||||
self.assertItemsEqual(write_variant.mock_calls,
|
mock.call(compose, "x86_64", compose.variants["Server"]),
|
||||||
[mock.call(compose, 'x86_64', compose.variants['Server']),
|
mock.call(compose, "amd64", compose.variants["Server"]),
|
||||||
mock.call(compose, 'amd64', compose.variants['Server']),
|
mock.call(compose, "amd64", compose.variants["Client"]),
|
||||||
mock.call(compose, 'amd64', compose.variants['Client']),
|
mock.call(compose, "x86_64", compose.variants["Everything"]),
|
||||||
mock.call(compose, 'x86_64', compose.variants['Everything']),
|
mock.call(compose, "amd64", compose.variants["Everything"])],
|
||||||
mock.call(compose, 'amd64', compose.variants['Everything'])])
|
)
|
||||||
self.assertItemsEqual(write_defaults, [])
|
six.assertCountEqual(
|
||||||
self.assertItemsEqual(validate_defaults, [])
|
self,
|
||||||
|
write_variant.mock_calls,
|
||||||
|
[mock.call(compose, "x86_64", compose.variants["Server"]),
|
||||||
|
mock.call(compose, "amd64", compose.variants["Server"]),
|
||||||
|
mock.call(compose, "amd64", compose.variants["Client"]),
|
||||||
|
mock.call(compose, "x86_64", compose.variants["Everything"]),
|
||||||
|
mock.call(compose, "amd64", compose.variants["Everything"])],
|
||||||
|
)
|
||||||
|
self.assertEqual(write_defaults.call_args_list, [])
|
||||||
|
self.assertEqual(validate_defaults.call_args_list, [])
|
||||||
|
|
||||||
def test_run_without_comps(
|
def test_run_without_comps(
|
||||||
self,
|
self,
|
||||||
@ -127,14 +147,14 @@ class TestInitPhase(PungiTestCase):
|
|||||||
phase = init.InitPhase(compose)
|
phase = init.InitPhase(compose)
|
||||||
phase.run()
|
phase.run()
|
||||||
|
|
||||||
self.assertItemsEqual(write_global.mock_calls, [])
|
self.assertEqual(write_global.mock_calls, [])
|
||||||
self.assertEqual(validate_comps.call_args_list, [])
|
self.assertEqual(validate_comps.call_args_list, [])
|
||||||
self.assertItemsEqual(write_prepopulate.mock_calls, [mock.call(compose)])
|
self.assertEqual(write_prepopulate.mock_calls, [mock.call(compose)])
|
||||||
self.assertItemsEqual(write_arch.mock_calls, [])
|
self.assertEqual(write_arch.mock_calls, [])
|
||||||
self.assertItemsEqual(create_comps.mock_calls, [])
|
self.assertEqual(create_comps.mock_calls, [])
|
||||||
self.assertItemsEqual(write_variant.mock_calls, [])
|
self.assertEqual(write_variant.mock_calls, [])
|
||||||
self.assertItemsEqual(write_defaults, [])
|
self.assertEqual(write_defaults.call_args_list, [])
|
||||||
self.assertItemsEqual(validate_defaults, [])
|
self.assertEqual(validate_defaults.call_args_list, [])
|
||||||
|
|
||||||
def test_with_module_defaults(
|
def test_with_module_defaults(
|
||||||
self,
|
self,
|
||||||
@ -153,14 +173,14 @@ class TestInitPhase(PungiTestCase):
|
|||||||
phase = init.InitPhase(compose)
|
phase = init.InitPhase(compose)
|
||||||
phase.run()
|
phase.run()
|
||||||
|
|
||||||
self.assertItemsEqual(write_global.mock_calls, [])
|
self.assertEqual(write_global.mock_calls, [])
|
||||||
self.assertEqual(validate_comps.call_args_list, [])
|
self.assertEqual(validate_comps.call_args_list, [])
|
||||||
self.assertItemsEqual(write_prepopulate.mock_calls, [mock.call(compose)])
|
self.assertEqual(write_prepopulate.mock_calls, [mock.call(compose)])
|
||||||
self.assertItemsEqual(write_arch.mock_calls, [])
|
self.assertEqual(write_arch.mock_calls, [])
|
||||||
self.assertItemsEqual(create_comps.mock_calls, [])
|
self.assertEqual(create_comps.mock_calls, [])
|
||||||
self.assertItemsEqual(write_variant.mock_calls, [])
|
self.assertEqual(write_variant.mock_calls, [])
|
||||||
self.assertItemsEqual(write_defaults.call_args_list, [mock.call(compose)])
|
self.assertEqual(write_defaults.call_args_list, [mock.call(compose)])
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
validate_defaults.call_args_list,
|
validate_defaults.call_args_list,
|
||||||
[mock.call(compose.paths.work.module_defaults_dir())],
|
[mock.call(compose.paths.work.module_defaults_dir())],
|
||||||
)
|
)
|
||||||
@ -381,17 +401,17 @@ class TestWriteVariantComps(PungiTestCase):
|
|||||||
class TestGetLookasideGroups(PungiTestCase):
|
class TestGetLookasideGroups(PungiTestCase):
|
||||||
def test_toplevel_variant(self):
|
def test_toplevel_variant(self):
|
||||||
compose = DummyCompose(self.topdir, {})
|
compose = DummyCompose(self.topdir, {})
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
init.get_lookaside_groups(compose, compose.variants["Server"]), []
|
init.get_lookaside_groups(compose, compose.variants["Server"]), set()
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_classic_addon(self):
|
def test_classic_addon(self):
|
||||||
compose = DummyCompose(self.topdir, {})
|
compose = DummyCompose(self.topdir, {})
|
||||||
compose.setup_addon()
|
compose.setup_addon()
|
||||||
compose.variants["Server"].groups = [{"name": "foo"}]
|
compose.variants["Server"].groups = [{"name": "foo"}]
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
init.get_lookaside_groups(compose, compose.all_variants["Server-HA"]),
|
init.get_lookaside_groups(compose, compose.all_variants["Server-HA"]),
|
||||||
["foo"],
|
set(["foo"]),
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_variant_as_lookaside(self):
|
def test_variant_as_lookaside(self):
|
||||||
@ -399,9 +419,9 @@ class TestGetLookasideGroups(PungiTestCase):
|
|||||||
self.topdir, {"variant_as_lookaside": [("Server", "Client")]}
|
self.topdir, {"variant_as_lookaside": [("Server", "Client")]}
|
||||||
)
|
)
|
||||||
compose.variants["Client"].groups = [{"name": "foo"}]
|
compose.variants["Client"].groups = [{"name": "foo"}]
|
||||||
self.assertItemsEqual(
|
self.assertEqual(
|
||||||
init.get_lookaside_groups(compose, compose.variants["Server"]),
|
init.get_lookaside_groups(compose, compose.variants["Server"]),
|
||||||
["foo"],
|
set(["foo"]),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@ import tempfile
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
||||||
|
|
||||||
from pungi.wrappers.kojiwrapper import KojiWrapper, get_buildroot_rpms
|
from pungi.wrappers.kojiwrapper import KojiWrapper, get_buildroot_rpms
|
||||||
@ -98,24 +100,26 @@ class KojiWrapperTest(KojiWrapperBaseTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(cmd[:3], ['koji', '--profile=custom-koji', 'image-build'])
|
self.assertEqual(cmd[:3], ['koji', '--profile=custom-koji', 'image-build'])
|
||||||
self.assertItemsEqual(cmd[3:],
|
six.assertCountEqual(self, cmd[3:], ["--config=" + self.tmpfile, "--wait"])
|
||||||
['--config=' + self.tmpfile, '--wait'])
|
|
||||||
|
|
||||||
with open(self.tmpfile, 'r') as f:
|
with open(self.tmpfile, 'r') as f:
|
||||||
lines = f.read().strip().split('\n')
|
lines = f.read().strip().split('\n')
|
||||||
self.assertEqual(lines[0], '[image-build]')
|
self.assertEqual(lines[0], '[image-build]')
|
||||||
self.assertItemsEqual(lines[1:],
|
six.assertCountEqual(
|
||||||
['name = test-name',
|
self,
|
||||||
'version = 1',
|
lines[1:],
|
||||||
'target = test-target',
|
["name = test-name",
|
||||||
'install_tree = /tmp/test/install_tree',
|
"version = 1",
|
||||||
'arches = x86_64',
|
"target = test-target",
|
||||||
'format = docker,qcow2',
|
"install_tree = /tmp/test/install_tree",
|
||||||
'kickstart = test-kickstart',
|
"arches = x86_64",
|
||||||
'ksurl = git://example.com/ks.git',
|
"format = docker,qcow2",
|
||||||
'distro = test-distro',
|
"kickstart = test-kickstart",
|
||||||
'release = 20160222.0',
|
"ksurl = git://example.com/ks.git",
|
||||||
'disk_size = 4'])
|
"distro = test-distro",
|
||||||
|
"release = 20160222.0",
|
||||||
|
"disk_size = 4"],
|
||||||
|
)
|
||||||
|
|
||||||
def test_get_image_paths(self):
|
def test_get_image_paths(self):
|
||||||
|
|
||||||
@ -276,24 +280,30 @@ class KojiWrapperTest(KojiWrapperBaseTestCase):
|
|||||||
getTaskResult=mock.Mock(side_effect=lambda task_id: getTaskResult_data.get(task_id))
|
getTaskResult=mock.Mock(side_effect=lambda task_id: getTaskResult_data.get(task_id))
|
||||||
)
|
)
|
||||||
result = self.koji.get_image_paths(12387273)
|
result = self.koji.get_image_paths(12387273)
|
||||||
self.assertItemsEqual(result.keys(), ['i386', 'x86_64'])
|
six.assertCountEqual(self, result.keys(), ["i386", "x86_64"])
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
self.assertItemsEqual(result['i386'],
|
six.assertCountEqual(
|
||||||
['/koji/task/12387276/tdl-i386.xml',
|
self,
|
||||||
'/koji/task/12387276/fedora-cloud-base-2878aa0.ks',
|
result["i386"],
|
||||||
'/koji/task/12387276/koji-f23-build-12387276-base.ks',
|
["/koji/task/12387276/tdl-i386.xml",
|
||||||
'/koji/task/12387276/libvirt-qcow2-i386.xml',
|
"/koji/task/12387276/fedora-cloud-base-2878aa0.ks",
|
||||||
'/koji/task/12387276/Fedora-Cloud-Base-23-20160103.i386.qcow2',
|
"/koji/task/12387276/koji-f23-build-12387276-base.ks",
|
||||||
'/koji/task/12387276/libvirt-raw-xz-i386.xml',
|
"/koji/task/12387276/libvirt-qcow2-i386.xml",
|
||||||
'/koji/task/12387276/Fedora-Cloud-Base-23-20160103.i386.raw.xz'])
|
"/koji/task/12387276/Fedora-Cloud-Base-23-20160103.i386.qcow2",
|
||||||
self.assertItemsEqual(result['x86_64'],
|
"/koji/task/12387276/libvirt-raw-xz-i386.xml",
|
||||||
['/koji/task/12387277/tdl-x86_64.xml',
|
"/koji/task/12387276/Fedora-Cloud-Base-23-20160103.i386.raw.xz"],
|
||||||
'/koji/task/12387277/fedora-cloud-base-2878aa0.ks',
|
)
|
||||||
'/koji/task/12387277/koji-f23-build-12387277-base.ks',
|
six.assertCountEqual(
|
||||||
'/koji/task/12387277/libvirt-qcow2-x86_64.xml',
|
self,
|
||||||
'/koji/task/12387277/Fedora-Cloud-Base-23-20160103.x86_64.qcow2',
|
result["x86_64"],
|
||||||
'/koji/task/12387277/libvirt-raw-xz-x86_64.xml',
|
["/koji/task/12387277/tdl-x86_64.xml",
|
||||||
'/koji/task/12387277/Fedora-Cloud-Base-23-20160103.x86_64.raw.xz'])
|
"/koji/task/12387277/fedora-cloud-base-2878aa0.ks",
|
||||||
|
"/koji/task/12387277/koji-f23-build-12387277-base.ks",
|
||||||
|
"/koji/task/12387277/libvirt-qcow2-x86_64.xml",
|
||||||
|
"/koji/task/12387277/Fedora-Cloud-Base-23-20160103.x86_64.qcow2",
|
||||||
|
"/koji/task/12387277/libvirt-raw-xz-x86_64.xml",
|
||||||
|
"/koji/task/12387277/Fedora-Cloud-Base-23-20160103.x86_64.raw.xz"],
|
||||||
|
)
|
||||||
|
|
||||||
def test_get_image_paths_failed_subtask(self):
|
def test_get_image_paths_failed_subtask(self):
|
||||||
|
|
||||||
@ -316,8 +326,8 @@ class KojiWrapperTest(KojiWrapperBaseTestCase):
|
|||||||
|
|
||||||
result = self.koji.get_image_paths(25643870, callback=failed_callback)
|
result = self.koji.get_image_paths(25643870, callback=failed_callback)
|
||||||
|
|
||||||
self.assertItemsEqual(result.keys(), ['aarch64', 'armhfp', 'x86_64'])
|
six.assertCountEqual(self, result.keys(), ["aarch64", "armhfp", "x86_64"])
|
||||||
self.assertItemsEqual(failed, ['ppc64le', 's390x'])
|
six.assertCountEqual(self, failed, ["ppc64le", "s390x"])
|
||||||
|
|
||||||
def test_multicall_map(self):
|
def test_multicall_map(self):
|
||||||
self.koji.koji_proxy = mock.Mock()
|
self.koji.koji_proxy = mock.Mock()
|
||||||
@ -327,7 +337,8 @@ class KojiWrapperTest(KojiWrapperBaseTestCase):
|
|||||||
self.koji.koji_proxy, self.koji.koji_proxy.getBuild, ["foo", "bar"],
|
self.koji.koji_proxy, self.koji.koji_proxy.getBuild, ["foo", "bar"],
|
||||||
[{"x":1}, {"x":2}])
|
[{"x":1}, {"x":2}])
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
self.koji.koji_proxy.getBuild.mock_calls,
|
self.koji.koji_proxy.getBuild.mock_calls,
|
||||||
[mock.call("foo", x=1), mock.call("bar", x=2)])
|
[mock.call("foo", x=1), mock.call("bar", x=2)])
|
||||||
self.koji.koji_proxy.multiCall.assert_called_with(strict=True)
|
self.koji.koji_proxy.multiCall.assert_called_with(strict=True)
|
||||||
@ -356,9 +367,12 @@ class LiveMediaTestCase(KojiWrapperBaseTestCase):
|
|||||||
self.assertEqual(cmd[:9],
|
self.assertEqual(cmd[:9],
|
||||||
['koji', '--profile=custom-koji', 'spin-livemedia', 'name', '1', 'tgt', 'x,y,z', 'kickstart',
|
['koji', '--profile=custom-koji', 'spin-livemedia', 'name', '1', 'tgt', 'x,y,z', 'kickstart',
|
||||||
'--install-tree=/mnt/os'])
|
'--install-tree=/mnt/os'])
|
||||||
self.assertItemsEqual(cmd[9:],
|
six.assertCountEqual(
|
||||||
['--repo=repo-1', '--repo=repo-2', '--skip-tag', '--scratch', '--wait',
|
self,
|
||||||
'--ksurl=git://example.com/ksurl.git', '--release=20160222.1'])
|
cmd[9:],
|
||||||
|
["--repo=repo-1", "--repo=repo-2", "--skip-tag", "--scratch", "--wait",
|
||||||
|
"--ksurl=git://example.com/ksurl.git", "--release=20160222.1"],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class LiveImageKojiWrapperTest(KojiWrapperBaseTestCase):
|
class LiveImageKojiWrapperTest(KojiWrapperBaseTestCase):
|
||||||
@ -366,7 +380,9 @@ class LiveImageKojiWrapperTest(KojiWrapperBaseTestCase):
|
|||||||
cmd = self.koji.get_create_image_cmd('my_name', '1.0', 'f24-candidate',
|
cmd = self.koji.get_create_image_cmd('my_name', '1.0', 'f24-candidate',
|
||||||
'x86_64', '/path/to/ks', ['/repo/1'])
|
'x86_64', '/path/to/ks', ['/repo/1'])
|
||||||
self.assertEqual(cmd[0:3], ['koji', '--profile=custom-koji', 'spin-livecd'])
|
self.assertEqual(cmd[0:3], ['koji', '--profile=custom-koji', 'spin-livecd'])
|
||||||
self.assertItemsEqual(cmd[3:7], ['--noprogress', '--scratch', '--wait', '--repo=/repo/1'])
|
six.assertCountEqual(
|
||||||
|
self, cmd[3:7], ["--noprogress", "--scratch", "--wait", "--repo=/repo/1"]
|
||||||
|
)
|
||||||
self.assertEqual(cmd[7:], ['my_name', '1.0', 'f24-candidate', 'x86_64', '/path/to/ks'])
|
self.assertEqual(cmd[7:], ['my_name', '1.0', 'f24-candidate', 'x86_64', '/path/to/ks'])
|
||||||
|
|
||||||
def test_get_create_image_cmd_full(self):
|
def test_get_create_image_cmd_full(self):
|
||||||
@ -376,9 +392,12 @@ class LiveImageKojiWrapperTest(KojiWrapperBaseTestCase):
|
|||||||
ksurl='https://git.example.com/')
|
ksurl='https://git.example.com/')
|
||||||
self.assertEqual(cmd[0:3], ['koji', '--profile=custom-koji', 'spin-livecd'])
|
self.assertEqual(cmd[0:3], ['koji', '--profile=custom-koji', 'spin-livecd'])
|
||||||
self.assertEqual(cmd[-5:], ['my_name', '1.0', 'f24-candidate', 'x86_64', '/path/to/ks'])
|
self.assertEqual(cmd[-5:], ['my_name', '1.0', 'f24-candidate', 'x86_64', '/path/to/ks'])
|
||||||
self.assertItemsEqual(cmd[3:-5],
|
six.assertCountEqual(
|
||||||
['--noprogress', '--nowait', '--repo=/repo/1', '--repo=/repo/2',
|
self,
|
||||||
'--release=1', '--specfile=foo.spec', '--ksurl=https://git.example.com/'])
|
cmd[3:-5],
|
||||||
|
["--noprogress", "--nowait", "--repo=/repo/1", "--repo=/repo/2",
|
||||||
|
"--release=1", "--specfile=foo.spec", "--ksurl=https://git.example.com/"],
|
||||||
|
)
|
||||||
|
|
||||||
def test_spin_livecd_with_format(self):
|
def test_spin_livecd_with_format(self):
|
||||||
with self.assertRaises(ValueError):
|
with self.assertRaises(ValueError):
|
||||||
@ -392,7 +411,9 @@ class LiveImageKojiWrapperTest(KojiWrapperBaseTestCase):
|
|||||||
image_type='appliance',
|
image_type='appliance',
|
||||||
image_format='qcow')
|
image_format='qcow')
|
||||||
self.assertEqual(cmd[0:3], ['koji', '--profile=custom-koji', 'spin-appliance'])
|
self.assertEqual(cmd[0:3], ['koji', '--profile=custom-koji', 'spin-appliance'])
|
||||||
self.assertItemsEqual(cmd[3:7], ['--noprogress', '--scratch', '--wait', '--format=qcow'])
|
six.assertCountEqual(
|
||||||
|
self, cmd[3:7], ["--noprogress", "--scratch", "--wait", "--format=qcow"]
|
||||||
|
)
|
||||||
self.assertEqual(cmd[7:], ['my_name', '1.0', 'f24-candidate', 'x86_64', '/path/to/ks'])
|
self.assertEqual(cmd[7:], ['my_name', '1.0', 'f24-candidate', 'x86_64', '/path/to/ks'])
|
||||||
|
|
||||||
def test_spin_appliance_with_wrong_format(self):
|
def test_spin_appliance_with_wrong_format(self):
|
||||||
@ -411,8 +432,7 @@ class RunrootKojiWrapperTest(KojiWrapperBaseTestCase):
|
|||||||
self.assertEqual(cmd[-3], 'tgt')
|
self.assertEqual(cmd[-3], 'tgt')
|
||||||
self.assertEqual(cmd[-2], 's390x')
|
self.assertEqual(cmd[-2], 's390x')
|
||||||
self.assertEqual(cmd[-1], 'rm -f /var/lib/rpm/__db*; rm -rf /var/cache/yum/*; set -x; date')
|
self.assertEqual(cmd[-1], 'rm -f /var/lib/rpm/__db*; rm -rf /var/cache/yum/*; set -x; date')
|
||||||
self.assertItemsEqual(cmd[3:-3],
|
six.assertCountEqual(self, cmd[3:-3], ["--channel-override=runroot-local"])
|
||||||
['--channel-override=runroot-local'])
|
|
||||||
|
|
||||||
def test_get_cmd_full(self):
|
def test_get_cmd_full(self):
|
||||||
cmd = self.koji.get_runroot_cmd('tgt', 's390x', ['/bin/echo', '&'],
|
cmd = self.koji.get_runroot_cmd('tgt', 's390x', ['/bin/echo', '&'],
|
||||||
@ -424,10 +444,13 @@ class RunrootKojiWrapperTest(KojiWrapperBaseTestCase):
|
|||||||
self.assertEqual(cmd[-3], 'tgt')
|
self.assertEqual(cmd[-3], 'tgt')
|
||||||
self.assertEqual(cmd[-2], 's390x')
|
self.assertEqual(cmd[-2], 's390x')
|
||||||
self.assertEqual(cmd[-1], 'rm -f /var/lib/rpm/__db*; rm -rf /var/cache/yum/*; set -x; /bin/echo \'&\'')
|
self.assertEqual(cmd[-1], 'rm -f /var/lib/rpm/__db*; rm -rf /var/cache/yum/*; set -x; /bin/echo \'&\'')
|
||||||
self.assertItemsEqual(cmd[3:-3],
|
six.assertCountEqual(
|
||||||
['--channel-override=chan', '--quiet', '--use-shell',
|
self,
|
||||||
'--task-id', '--weight=1000', '--package=some_other_package',
|
cmd[3:-3],
|
||||||
'--package=lorax', '--mount=/tmp'])
|
["--channel-override=chan", "--quiet", "--use-shell",
|
||||||
|
"--task-id", "--weight=1000", "--package=some_other_package",
|
||||||
|
"--package=lorax", "--mount=/tmp"],
|
||||||
|
)
|
||||||
|
|
||||||
@mock.patch("os.getuid", new=lambda: 1010)
|
@mock.patch("os.getuid", new=lambda: 1010)
|
||||||
def test_with_chown_paths(self):
|
def test_with_chown_paths(self):
|
||||||
@ -443,10 +466,13 @@ class RunrootKojiWrapperTest(KojiWrapperBaseTestCase):
|
|||||||
cmd[-1],
|
cmd[-1],
|
||||||
"rm -f /var/lib/rpm/__db*; rm -rf /var/cache/yum/*; set -x; /bin/echo '&' && chmod -R a+r '/output dir' /foo && chown -R 1010 '/output dir' /foo"
|
"rm -f /var/lib/rpm/__db*; rm -rf /var/cache/yum/*; set -x; /bin/echo '&' && chmod -R a+r '/output dir' /foo && chown -R 1010 '/output dir' /foo"
|
||||||
)
|
)
|
||||||
self.assertItemsEqual(cmd[3:-3],
|
six.assertCountEqual(
|
||||||
['--channel-override=chan', '--quiet', '--use-shell',
|
self,
|
||||||
'--task-id', '--weight=1000', '--package=some_other_package',
|
cmd[3:-3],
|
||||||
'--package=lorax', '--mount=/tmp'])
|
["--channel-override=chan", "--quiet", "--use-shell",
|
||||||
|
"--task-id", "--weight=1000", "--package=some_other_package",
|
||||||
|
"--package=lorax", "--mount=/tmp"],
|
||||||
|
)
|
||||||
|
|
||||||
@mock.patch('pungi.wrappers.kojiwrapper.run')
|
@mock.patch('pungi.wrappers.kojiwrapper.run')
|
||||||
def test_run_runroot_cmd_no_task_id(self, run):
|
def test_run_runroot_cmd_no_task_id(self, run):
|
||||||
@ -534,9 +560,11 @@ class RunBlockingCmdTest(KojiWrapperBaseTestCase):
|
|||||||
result = self.koji.run_blocking_cmd('cmd')
|
result = self.koji.run_blocking_cmd('cmd')
|
||||||
|
|
||||||
self.assertDictEqual(result, {'retcode': 0, 'output': output, 'task_id': 1234})
|
self.assertDictEqual(result, {'retcode': 0, 'output': output, 'task_id': 1234})
|
||||||
self.assertItemsEqual(run.mock_calls,
|
six.assertCountEqual(
|
||||||
[mock.call('cmd', can_fail=True, logfile=None, env=None,
|
self,
|
||||||
universal_newlines=True)])
|
run.mock_calls,
|
||||||
|
[mock.call('cmd', can_fail=True, logfile=None, env=None, universal_newlines=True)],
|
||||||
|
)
|
||||||
|
|
||||||
@mock.patch.dict('os.environ', {'FOO': 'BAR'}, clear=True)
|
@mock.patch.dict('os.environ', {'FOO': 'BAR'}, clear=True)
|
||||||
@mock.patch('pungi.util.temp_dir')
|
@mock.patch('pungi.util.temp_dir')
|
||||||
@ -550,10 +578,13 @@ class RunBlockingCmdTest(KojiWrapperBaseTestCase):
|
|||||||
result = self.koji.run_blocking_cmd('cmd')
|
result = self.koji.run_blocking_cmd('cmd')
|
||||||
|
|
||||||
self.assertDictEqual(result, {'retcode': 0, 'output': output, 'task_id': 1234})
|
self.assertDictEqual(result, {'retcode': 0, 'output': output, 'task_id': 1234})
|
||||||
self.assertItemsEqual(run.mock_calls,
|
six.assertCountEqual(
|
||||||
[mock.call('cmd', can_fail=True, logfile=None,
|
self,
|
||||||
env={'KRB5CCNAME': 'DIR:/tmp/foo', 'FOO': 'BAR'},
|
run.mock_calls,
|
||||||
universal_newlines=True)])
|
[mock.call("cmd", can_fail=True, logfile=None,
|
||||||
|
env={"KRB5CCNAME": "DIR:/tmp/foo", "FOO": "BAR"},
|
||||||
|
universal_newlines=True)],
|
||||||
|
)
|
||||||
|
|
||||||
@mock.patch('pungi.wrappers.kojiwrapper.run')
|
@mock.patch('pungi.wrappers.kojiwrapper.run')
|
||||||
def test_with_log(self, run):
|
def test_with_log(self, run):
|
||||||
@ -563,9 +594,12 @@ class RunBlockingCmdTest(KojiWrapperBaseTestCase):
|
|||||||
result = self.koji.run_blocking_cmd('cmd', log_file='logfile')
|
result = self.koji.run_blocking_cmd('cmd', log_file='logfile')
|
||||||
|
|
||||||
self.assertDictEqual(result, {'retcode': 0, 'output': output, 'task_id': 1234})
|
self.assertDictEqual(result, {'retcode': 0, 'output': output, 'task_id': 1234})
|
||||||
self.assertItemsEqual(run.mock_calls,
|
six.assertCountEqual(
|
||||||
[mock.call('cmd', can_fail=True, logfile='logfile', env=None,
|
self,
|
||||||
universal_newlines=True)])
|
run.mock_calls,
|
||||||
|
[mock.call("cmd", can_fail=True, logfile="logfile", env=None,
|
||||||
|
universal_newlines=True)]
|
||||||
|
)
|
||||||
|
|
||||||
@mock.patch('pungi.wrappers.kojiwrapper.run')
|
@mock.patch('pungi.wrappers.kojiwrapper.run')
|
||||||
def test_fail_with_task_id(self, run):
|
def test_fail_with_task_id(self, run):
|
||||||
@ -575,9 +609,11 @@ class RunBlockingCmdTest(KojiWrapperBaseTestCase):
|
|||||||
result = self.koji.run_blocking_cmd('cmd')
|
result = self.koji.run_blocking_cmd('cmd')
|
||||||
|
|
||||||
self.assertDictEqual(result, {'retcode': 1, 'output': output, 'task_id': 1234})
|
self.assertDictEqual(result, {'retcode': 1, 'output': output, 'task_id': 1234})
|
||||||
self.assertItemsEqual(run.mock_calls,
|
six.assertCountEqual(
|
||||||
[mock.call('cmd', can_fail=True, logfile=None, env=None,
|
self, run.mock_calls,
|
||||||
universal_newlines=True)])
|
[mock.call("cmd", can_fail=True, logfile=None, env=None,
|
||||||
|
universal_newlines=True)],
|
||||||
|
)
|
||||||
|
|
||||||
@mock.patch('pungi.wrappers.kojiwrapper.run')
|
@mock.patch('pungi.wrappers.kojiwrapper.run')
|
||||||
def test_fail_without_task_id(self, run):
|
def test_fail_without_task_id(self, run):
|
||||||
@ -587,9 +623,11 @@ class RunBlockingCmdTest(KojiWrapperBaseTestCase):
|
|||||||
with self.assertRaises(RuntimeError) as ctx:
|
with self.assertRaises(RuntimeError) as ctx:
|
||||||
self.koji.run_blocking_cmd('cmd')
|
self.koji.run_blocking_cmd('cmd')
|
||||||
|
|
||||||
self.assertItemsEqual(run.mock_calls,
|
six.assertCountEqual(
|
||||||
[mock.call('cmd', can_fail=True, logfile=None, env=None,
|
self, run.mock_calls,
|
||||||
universal_newlines=True)])
|
[mock.call("cmd", can_fail=True, logfile=None, env=None,
|
||||||
|
universal_newlines=True)],
|
||||||
|
)
|
||||||
self.assertIn('Could not find task ID', str(ctx.exception))
|
self.assertIn('Could not find task ID', str(ctx.exception))
|
||||||
|
|
||||||
@mock.patch('pungi.wrappers.kojiwrapper.run')
|
@mock.patch('pungi.wrappers.kojiwrapper.run')
|
||||||
@ -779,11 +817,15 @@ class TestGetBuildrootRPMs(unittest.TestCase):
|
|||||||
[mock.call.koji_proxy.listBuildroots(taskID=1234),
|
[mock.call.koji_proxy.listBuildroots(taskID=1234),
|
||||||
mock.call.koji_proxy.listRPMs(componentBuildrootID=5458481)])
|
mock.call.koji_proxy.listRPMs(componentBuildrootID=5458481)])
|
||||||
|
|
||||||
self.assertItemsEqual(rpms, [
|
six.assertCountEqual(
|
||||||
'python3-kickstart-2.25-2.fc24.noarch',
|
self,
|
||||||
'binutils-2.26-18.fc24.x86_64',
|
rpms,
|
||||||
'kernel-headers-4.5.2-301.fc24.x86_64'
|
[
|
||||||
])
|
"python3-kickstart-2.25-2.fc24.noarch",
|
||||||
|
"binutils-2.26-18.fc24.x86_64",
|
||||||
|
"kernel-headers-4.5.2-301.fc24.x86_64",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
@mock.patch('pungi.wrappers.kojiwrapper.run')
|
@mock.patch('pungi.wrappers.kojiwrapper.run')
|
||||||
def test_get_local(self, mock_run):
|
def test_get_local(self, mock_run):
|
||||||
@ -793,10 +835,14 @@ class TestGetBuildrootRPMs(unittest.TestCase):
|
|||||||
|
|
||||||
rpms = get_buildroot_rpms(compose, None)
|
rpms = get_buildroot_rpms(compose, None)
|
||||||
|
|
||||||
self.assertItemsEqual(rpms, [
|
six.assertCountEqual(
|
||||||
'cjkuni-uming-fonts-0.2.20080216.1-56.fc23.noarch',
|
self,
|
||||||
'libmount-2.28-1.fc23.x86_64',
|
rpms,
|
||||||
'ed-1.10-5.fc23.x86_64',
|
[
|
||||||
'kbd-2.0.2-8.fc23.x86_64',
|
"cjkuni-uming-fonts-0.2.20080216.1-56.fc23.noarch",
|
||||||
'coreutils-8.24-6.fc23.x86_64',
|
"libmount-2.28-1.fc23.x86_64",
|
||||||
])
|
"ed-1.10-5.fc23.x86_64",
|
||||||
|
"kbd-2.0.2-8.fc23.x86_64",
|
||||||
|
"coreutils-8.24-6.fc23.x86_64",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
@ -6,6 +6,8 @@ import mock
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
||||||
|
|
||||||
from pungi.phases.live_images import LiveImagesPhase, CreateLiveImageThread
|
from pungi.phases.live_images import LiveImagesPhase, CreateLiveImageThread
|
||||||
@ -39,34 +41,39 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
# assert at least one thread was started
|
# assert at least one thread was started
|
||||||
self.assertTrue(phase.pool.add.called)
|
self.assertTrue(phase.pool.add.called)
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
self.assertItemsEqual(phase.pool.queue_put.mock_calls,
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
|
phase.pool.queue_put.mock_calls,
|
||||||
[mock.call((compose,
|
[mock.call((compose,
|
||||||
{'ks_file': 'test.ks',
|
{"ks_file": "test.ks",
|
||||||
'build_arch': 'amd64',
|
"build_arch": "amd64",
|
||||||
'dest_dir': self.topdir + '/compose/Client/amd64/iso',
|
"dest_dir": self.topdir + "/compose/Client/amd64/iso",
|
||||||
'scratch': False,
|
"scratch": False,
|
||||||
'repos': [self.topdir + '/compose/Client/amd64/os',
|
"repos": [self.topdir + "/compose/Client/amd64/os",
|
||||||
'http://example.com/repo/',
|
"http://example.com/repo/",
|
||||||
self.topdir + '/compose/Everything/amd64/os',
|
self.topdir + "/compose/Everything/amd64/os",
|
||||||
self.topdir + '/compose/Server-optional/amd64/os'],
|
self.topdir + "/compose/Server-optional/amd64/os"],
|
||||||
'label': '',
|
"label": "",
|
||||||
'name': None,
|
"name": None,
|
||||||
'filename': 'image-name',
|
"filename": "image-name",
|
||||||
'version': '25',
|
"version": "25",
|
||||||
'specfile': None,
|
"specfile": None,
|
||||||
'sign': False,
|
"sign": False,
|
||||||
'type': 'live',
|
"type": "live",
|
||||||
'release': '20151203.t.0',
|
"release": "20151203.t.0",
|
||||||
'subvariant': 'Client',
|
"subvariant": "Client",
|
||||||
'failable_arches': [],
|
"failable_arches": [],
|
||||||
'ksurl': None,
|
"ksurl": None,
|
||||||
'target': 'f27'},
|
"target": "f27"},
|
||||||
compose.variants['Client'],
|
compose.variants["Client"],
|
||||||
'amd64'))])
|
"amd64"))],
|
||||||
self.assertItemsEqual(
|
)
|
||||||
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
compose.get_image_name.mock_calls,
|
compose.get_image_name.mock_calls,
|
||||||
[mock.call('amd64', compose.variants['Client'], disc_num=None, disc_type='live',
|
[mock.call("amd64", compose.variants["Client"], disc_num=None, disc_type="live",
|
||||||
format='%(compose_id)s-%(variant)s-%(arch)s-%(disc_type)s%(disc_num)s%(suffix)s')])
|
format="%(compose_id)s-%(variant)s-%(arch)s-%(disc_type)s%(disc_num)s%(suffix)s")]
|
||||||
|
)
|
||||||
|
|
||||||
@mock.patch('pungi.phases.live_images.ThreadPool')
|
@mock.patch('pungi.phases.live_images.ThreadPool')
|
||||||
def test_live_image_build_single_repo_from(self, ThreadPool):
|
def test_live_image_build_single_repo_from(self, ThreadPool):
|
||||||
@ -92,7 +99,9 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
# assert at least one thread was started
|
# assert at least one thread was started
|
||||||
self.assertTrue(phase.pool.add.called)
|
self.assertTrue(phase.pool.add.called)
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
self.assertItemsEqual(phase.pool.queue_put.mock_calls,
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
|
phase.pool.queue_put.mock_calls,
|
||||||
[mock.call((compose,
|
[mock.call((compose,
|
||||||
{'ks_file': 'test.ks',
|
{'ks_file': 'test.ks',
|
||||||
'build_arch': 'amd64',
|
'build_arch': 'amd64',
|
||||||
@ -114,7 +123,8 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'ksurl': None,
|
'ksurl': None,
|
||||||
'target': 'f27'},
|
'target': 'f27'},
|
||||||
compose.variants['Client'],
|
compose.variants['Client'],
|
||||||
'amd64'))])
|
'amd64'))],
|
||||||
|
)
|
||||||
|
|
||||||
@mock.patch('pungi.phases.live_images.ThreadPool')
|
@mock.patch('pungi.phases.live_images.ThreadPool')
|
||||||
def test_live_image_build_without_rename(self, ThreadPool):
|
def test_live_image_build_without_rename(self, ThreadPool):
|
||||||
@ -141,7 +151,9 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
# assert at least one thread was started
|
# assert at least one thread was started
|
||||||
self.assertTrue(phase.pool.add.called)
|
self.assertTrue(phase.pool.add.called)
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
self.assertItemsEqual(phase.pool.queue_put.mock_calls,
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
|
phase.pool.queue_put.mock_calls,
|
||||||
[mock.call((compose,
|
[mock.call((compose,
|
||||||
{'ks_file': 'test.ks',
|
{'ks_file': 'test.ks',
|
||||||
'build_arch': 'amd64',
|
'build_arch': 'amd64',
|
||||||
@ -163,7 +175,8 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'ksurl': None,
|
'ksurl': None,
|
||||||
'target': 'f27'},
|
'target': 'f27'},
|
||||||
compose.variants['Client'],
|
compose.variants['Client'],
|
||||||
'amd64'))])
|
'amd64'))],
|
||||||
|
)
|
||||||
|
|
||||||
@mock.patch('pungi.phases.live_images.ThreadPool')
|
@mock.patch('pungi.phases.live_images.ThreadPool')
|
||||||
def test_live_image_build_two_images(self, ThreadPool):
|
def test_live_image_build_two_images(self, ThreadPool):
|
||||||
@ -192,7 +205,9 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
# assert at least one thread was started
|
# assert at least one thread was started
|
||||||
self.assertTrue(phase.pool.add.called)
|
self.assertTrue(phase.pool.add.called)
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
self.assertItemsEqual(phase.pool.queue_put.mock_calls,
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
|
phase.pool.queue_put.mock_calls,
|
||||||
[mock.call((compose,
|
[mock.call((compose,
|
||||||
{'ks_file': 'test.ks',
|
{'ks_file': 'test.ks',
|
||||||
'build_arch': 'amd64',
|
'build_arch': 'amd64',
|
||||||
@ -236,7 +251,8 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'target': 'f27',
|
'target': 'f27',
|
||||||
'ksurl': None},
|
'ksurl': None},
|
||||||
compose.variants['Client'],
|
compose.variants['Client'],
|
||||||
'amd64'))])
|
'amd64'))],
|
||||||
|
)
|
||||||
|
|
||||||
@mock.patch('pungi.phases.live_images.ThreadPool')
|
@mock.patch('pungi.phases.live_images.ThreadPool')
|
||||||
def test_spin_appliance(self, ThreadPool):
|
def test_spin_appliance(self, ThreadPool):
|
||||||
@ -263,7 +279,9 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
# assert at least one thread was started
|
# assert at least one thread was started
|
||||||
self.assertTrue(phase.pool.add.called)
|
self.assertTrue(phase.pool.add.called)
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
self.assertItemsEqual(phase.pool.queue_put.mock_calls,
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
|
phase.pool.queue_put.mock_calls,
|
||||||
[mock.call((compose,
|
[mock.call((compose,
|
||||||
{'ks_file': 'test.ks',
|
{'ks_file': 'test.ks',
|
||||||
'build_arch': 'amd64',
|
'build_arch': 'amd64',
|
||||||
@ -285,7 +303,8 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'target': 'f27',
|
'target': 'f27',
|
||||||
'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'},
|
'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'},
|
||||||
compose.variants['Client'],
|
compose.variants['Client'],
|
||||||
'amd64'))])
|
'amd64'))],
|
||||||
|
)
|
||||||
|
|
||||||
@mock.patch('pungi.phases.live_images.ThreadPool')
|
@mock.patch('pungi.phases.live_images.ThreadPool')
|
||||||
def test_spin_appliance_phase_global_settings(self, ThreadPool):
|
def test_spin_appliance_phase_global_settings(self, ThreadPool):
|
||||||
@ -314,7 +333,9 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
# assert at least one thread was started
|
# assert at least one thread was started
|
||||||
self.assertTrue(phase.pool.add.called)
|
self.assertTrue(phase.pool.add.called)
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
self.assertItemsEqual(phase.pool.queue_put.mock_calls,
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
|
phase.pool.queue_put.mock_calls,
|
||||||
[mock.call((compose,
|
[mock.call((compose,
|
||||||
{'ks_file': 'test.ks',
|
{'ks_file': 'test.ks',
|
||||||
'build_arch': 'amd64',
|
'build_arch': 'amd64',
|
||||||
@ -336,7 +357,8 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'target': 'f27',
|
'target': 'f27',
|
||||||
'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'},
|
'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'},
|
||||||
compose.variants['Client'],
|
compose.variants['Client'],
|
||||||
'amd64'))])
|
'amd64'))],
|
||||||
|
)
|
||||||
|
|
||||||
@mock.patch('pungi.phases.live_images.ThreadPool')
|
@mock.patch('pungi.phases.live_images.ThreadPool')
|
||||||
def test_spin_appliance_global_settings(self, ThreadPool):
|
def test_spin_appliance_global_settings(self, ThreadPool):
|
||||||
@ -365,7 +387,9 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
# assert at least one thread was started
|
# assert at least one thread was started
|
||||||
self.assertTrue(phase.pool.add.called)
|
self.assertTrue(phase.pool.add.called)
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
self.assertItemsEqual(phase.pool.queue_put.mock_calls,
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
|
phase.pool.queue_put.mock_calls,
|
||||||
[mock.call((compose,
|
[mock.call((compose,
|
||||||
{'ks_file': 'test.ks',
|
{'ks_file': 'test.ks',
|
||||||
'build_arch': 'amd64',
|
'build_arch': 'amd64',
|
||||||
@ -387,7 +411,8 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'target': 'f27',
|
'target': 'f27',
|
||||||
'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'},
|
'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'},
|
||||||
compose.variants['Client'],
|
compose.variants['Client'],
|
||||||
'amd64'))])
|
'amd64'))],
|
||||||
|
)
|
||||||
|
|
||||||
@mock.patch('pungi.phases.live_images.ThreadPool')
|
@mock.patch('pungi.phases.live_images.ThreadPool')
|
||||||
def test_live_image_build_custom_type(self, ThreadPool):
|
def test_live_image_build_custom_type(self, ThreadPool):
|
||||||
@ -414,7 +439,9 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
# assert at least one thread was started
|
# assert at least one thread was started
|
||||||
self.assertTrue(phase.pool.add.called)
|
self.assertTrue(phase.pool.add.called)
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
self.assertItemsEqual(phase.pool.queue_put.mock_calls,
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
|
phase.pool.queue_put.mock_calls,
|
||||||
[mock.call((compose,
|
[mock.call((compose,
|
||||||
{'ks_file': 'test.ks',
|
{'ks_file': 'test.ks',
|
||||||
'build_arch': 'amd64',
|
'build_arch': 'amd64',
|
||||||
@ -436,11 +463,14 @@ class TestLiveImagesPhase(PungiTestCase):
|
|||||||
'target': 'f27',
|
'target': 'f27',
|
||||||
'ksurl': None},
|
'ksurl': None},
|
||||||
compose.variants['Client'],
|
compose.variants['Client'],
|
||||||
'amd64'))])
|
'amd64'))],
|
||||||
self.assertItemsEqual(
|
)
|
||||||
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
compose.get_image_name.mock_calls,
|
compose.get_image_name.mock_calls,
|
||||||
[mock.call('amd64', compose.variants['Client'], disc_num=None, disc_type='Live',
|
[mock.call('amd64', compose.variants['Client'], disc_num=None, disc_type='Live',
|
||||||
format='%(compose_id)s-%(variant)s-%(arch)s-%(disc_type)s%(disc_num)s%(suffix)s')])
|
format='%(compose_id)s-%(variant)s-%(arch)s-%(disc_type)s%(disc_num)s%(suffix)s')],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class TestCreateLiveImageThread(PungiTestCase):
|
class TestCreateLiveImageThread(PungiTestCase):
|
||||||
|
@ -5,6 +5,8 @@ import mock
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
||||||
|
|
||||||
from pungi.phases.livemedia_phase import LiveMediaPhase, LiveMediaThread
|
from pungi.phases.livemedia_phase import LiveMediaPhase, LiveMediaThread
|
||||||
@ -480,13 +482,22 @@ class TestLiveMediaThread(PungiTestCase):
|
|||||||
self.assertTrue(os.path.isdir(self.topdir + '/compose/Server/x86_64/iso'))
|
self.assertTrue(os.path.isdir(self.topdir + '/compose/Server/x86_64/iso'))
|
||||||
self.assertTrue(os.path.isdir(self.topdir + '/compose/Server/amd64/iso'))
|
self.assertTrue(os.path.isdir(self.topdir + '/compose/Server/amd64/iso'))
|
||||||
link = Linker.return_value.link
|
link = Linker.return_value.link
|
||||||
self.assertItemsEqual(link.mock_calls,
|
six.assertCountEqual(
|
||||||
[mock.call('/koji/task/1235/Live-20160103.amd64.iso',
|
self,
|
||||||
self.topdir + '/compose/Server/amd64/iso/Live-20160103.amd64.iso',
|
link.mock_calls,
|
||||||
link_type='hardlink-or-copy'),
|
[
|
||||||
mock.call('/koji/task/1235/Live-20160103.x86_64.iso',
|
mock.call(
|
||||||
self.topdir + '/compose/Server/x86_64/iso/Live-20160103.x86_64.iso',
|
"/koji/task/1235/Live-20160103.amd64.iso",
|
||||||
link_type='hardlink-or-copy')])
|
self.topdir + "/compose/Server/amd64/iso/Live-20160103.amd64.iso",
|
||||||
|
link_type="hardlink-or-copy",
|
||||||
|
),
|
||||||
|
mock.call(
|
||||||
|
"/koji/task/1235/Live-20160103.x86_64.iso",
|
||||||
|
self.topdir + "/compose/Server/x86_64/iso/Live-20160103.x86_64.iso",
|
||||||
|
link_type="hardlink-or-copy",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
image_relative_paths = [
|
image_relative_paths = [
|
||||||
'Server/amd64/iso/Live-20160103.amd64.iso',
|
'Server/amd64/iso/Live-20160103.amd64.iso',
|
||||||
|
@ -8,6 +8,8 @@ except ImportError:
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
||||||
|
|
||||||
from pungi.wrappers.lorax import LoraxWrapper
|
from pungi.wrappers.lorax import LoraxWrapper
|
||||||
@ -23,12 +25,15 @@ class LoraxWrapperTest(unittest.TestCase):
|
|||||||
"/mnt/repo_baseurl", "/mnt/output_dir")
|
"/mnt/repo_baseurl", "/mnt/output_dir")
|
||||||
|
|
||||||
self.assertEqual(cmd[0], 'lorax')
|
self.assertEqual(cmd[0], 'lorax')
|
||||||
self.assertItemsEqual(cmd[1:],
|
six.assertCountEqual(
|
||||||
['--product=product',
|
self,
|
||||||
'--version=version',
|
cmd[1:],
|
||||||
'--release=release',
|
["--product=product",
|
||||||
'--source=file:///mnt/repo_baseurl',
|
"--version=version",
|
||||||
'/mnt/output_dir'])
|
"--release=release",
|
||||||
|
"--source=file:///mnt/repo_baseurl",
|
||||||
|
"/mnt/output_dir"],
|
||||||
|
)
|
||||||
|
|
||||||
def test_get_command_with_all_arguments(self):
|
def test_get_command_with_all_arguments(self):
|
||||||
cmd = self.lorax.get_lorax_cmd("product", "version", "release",
|
cmd = self.lorax.get_lorax_cmd("product", "version", "release",
|
||||||
@ -44,17 +49,20 @@ class LoraxWrapperTest(unittest.TestCase):
|
|||||||
log_dir='/tmp')
|
log_dir='/tmp')
|
||||||
|
|
||||||
self.assertEqual(cmd[0], 'lorax')
|
self.assertEqual(cmd[0], 'lorax')
|
||||||
self.assertItemsEqual(cmd[1:],
|
six.assertCountEqual(
|
||||||
['--product=product', '--version=version',
|
self,
|
||||||
'--release=release', '--variant=Server',
|
cmd[1:],
|
||||||
'--source=file:///mnt/repo_baseurl',
|
["--product=product", "--version=version",
|
||||||
'--bugurl=http://example.com/',
|
"--release=release", "--variant=Server",
|
||||||
'--buildarch=x86_64', '--volid=VOLUME_ID',
|
"--source=file:///mnt/repo_baseurl",
|
||||||
'--nomacboot', '--noupgrade', '--isfinal',
|
"--bugurl=http://example.com/",
|
||||||
'--installpkgs=bash', '--installpkgs=vim',
|
"--buildarch=x86_64", "--volid=VOLUME_ID",
|
||||||
'--add-template=t1', '--add-template=t2',
|
"--nomacboot", "--noupgrade", "--isfinal",
|
||||||
'--add-arch-template=ta1', '--add-arch-template=ta2',
|
"--installpkgs=bash", "--installpkgs=vim",
|
||||||
'--add-template-var=v1', '--add-template-var=v2',
|
"--add-template=t1", "--add-template=t2",
|
||||||
'--add-arch-template-var=va1', '--add-arch-template-var=va2',
|
"--add-arch-template=ta1", "--add-arch-template=ta2",
|
||||||
'--logfile=/tmp/lorax.log',
|
"--add-template-var=v1", "--add-template-var=v2",
|
||||||
'/mnt/output_dir'])
|
"--add-arch-template-var=va1", "--add-arch-template-var=va2",
|
||||||
|
"--logfile=/tmp/lorax.log",
|
||||||
|
"/mnt/output_dir"],
|
||||||
|
)
|
||||||
|
@ -3,6 +3,8 @@ import mock
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
||||||
|
|
||||||
from tests import helpers
|
from tests import helpers
|
||||||
@ -125,12 +127,17 @@ class MediaRepoTestCase(helpers.PungiTestCase):
|
|||||||
with open(self.path) as f:
|
with open(self.path) as f:
|
||||||
lines = f.read().strip().split('\n')
|
lines = f.read().strip().split('\n')
|
||||||
self.assertEqual(lines[0], '[InstallMedia]')
|
self.assertEqual(lines[0], '[InstallMedia]')
|
||||||
self.assertItemsEqual(lines[1:],
|
six.assertCountEqual(
|
||||||
['name=Test 1.0',
|
self,
|
||||||
'mediaid=123456',
|
lines[1:],
|
||||||
'metadata_expire=-1',
|
[
|
||||||
'gpgcheck=0',
|
"name=Test 1.0",
|
||||||
'cost=500'])
|
"mediaid=123456",
|
||||||
|
"metadata_expire=-1",
|
||||||
|
"gpgcheck=0",
|
||||||
|
"cost=500",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
def test_addons_dont_have_media_repo(self):
|
def test_addons_dont_have_media_repo(self):
|
||||||
compose = helpers.DummyCompose(self.topdir, {
|
compose = helpers.DummyCompose(self.topdir, {
|
||||||
|
@ -211,7 +211,7 @@ class TestComposePart(PungiTestCase):
|
|||||||
def test_unblock_on(self, deps, blockers, status):
|
def test_unblock_on(self, deps, blockers, status):
|
||||||
part = o.ComposePart("test", "/tmp/my.conf", dependencies=deps)
|
part = o.ComposePart("test", "/tmp/my.conf", dependencies=deps)
|
||||||
part.unblock_on("finished")
|
part.unblock_on("finished")
|
||||||
self.assertItemsEqual(part.blocked_on, blockers)
|
six.assertCountEqual(self, part.blocked_on, blockers)
|
||||||
self.assertEqual(part.status, status)
|
self.assertEqual(part.status, status)
|
||||||
|
|
||||||
|
|
||||||
@ -338,7 +338,8 @@ class TestCopyPart(PungiTestCase):
|
|||||||
|
|
||||||
o.copy_part(conf, linker, part)
|
o.copy_part(conf, linker, part)
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
hd.call_args_list,
|
hd.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -363,7 +364,8 @@ class TestHardlinkDir(PungiTestCase):
|
|||||||
|
|
||||||
o.hardlink_dir(linker, src, dst)
|
o.hardlink_dir(linker, src, dst)
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
linker.queue_put.call_args_list,
|
linker.queue_put.call_args_list,
|
||||||
[mock.call((os.path.join(src, f), os.path.join(dst, f))) for f in files],
|
[mock.call((os.path.join(src, f), os.path.join(dst, f))) for f in files],
|
||||||
)
|
)
|
||||||
@ -375,7 +377,7 @@ class TestCheckFinishedProcesses(BaseTestCase):
|
|||||||
v1 = mock.Mock()
|
v1 = mock.Mock()
|
||||||
processes = {k1: v1}
|
processes = {k1: v1}
|
||||||
|
|
||||||
self.assertItemsEqual(o.check_finished_processes(processes), [])
|
six.assertCountEqual(self, o.check_finished_processes(processes), [])
|
||||||
|
|
||||||
def test_yields_finished(self):
|
def test_yields_finished(self):
|
||||||
k1 = mock.Mock(returncode=None)
|
k1 = mock.Mock(returncode=None)
|
||||||
@ -384,14 +386,14 @@ class TestCheckFinishedProcesses(BaseTestCase):
|
|||||||
v2 = mock.Mock()
|
v2 = mock.Mock()
|
||||||
processes = {k1: v1, k2: v2}
|
processes = {k1: v1, k2: v2}
|
||||||
|
|
||||||
self.assertItemsEqual(o.check_finished_processes(processes), [(k2, v2)])
|
six.assertCountEqual(self, o.check_finished_processes(processes), [(k2, v2)])
|
||||||
|
|
||||||
def test_yields_failed(self):
|
def test_yields_failed(self):
|
||||||
k1 = mock.Mock(returncode=1)
|
k1 = mock.Mock(returncode=1)
|
||||||
v1 = mock.Mock()
|
v1 = mock.Mock()
|
||||||
processes = {k1: v1}
|
processes = {k1: v1}
|
||||||
|
|
||||||
self.assertItemsEqual(o.check_finished_processes(processes), [(k1, v1)])
|
six.assertCountEqual(self, o.check_finished_processes(processes), [(k1, v1)])
|
||||||
|
|
||||||
|
|
||||||
class _Part(object):
|
class _Part(object):
|
||||||
|
@ -6,6 +6,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
import six
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
||||||
@ -36,7 +37,8 @@ class OstreeTreeScriptTest(helpers.PungiTestCase):
|
|||||||
'[fedora-23]\nbaseurl=why-not-zoidberg?')
|
'[fedora-23]\nbaseurl=why-not-zoidberg?')
|
||||||
|
|
||||||
def assertCorrectCall(self, mock_run, extra_calls=[], extra_args=[]):
|
def assertCorrectCall(self, mock_run, extra_calls=[], extra_args=[]):
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
mock_run.call_args_list,
|
mock_run.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -344,23 +346,32 @@ class OstreeInstallerScriptTest(helpers.PungiTestCase):
|
|||||||
args.append('--add-arch-template-var=ostree_repo=http://www.example.com/ostree')
|
args.append('--add-arch-template-var=ostree_repo=http://www.example.com/ostree')
|
||||||
ostree.main(args)
|
ostree.main(args)
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
self.assertItemsEqual(run.mock_calls,
|
six.assertCountEqual(
|
||||||
[mock.call(['lorax',
|
self,
|
||||||
'--product=dummyproduct',
|
run.mock_calls,
|
||||||
'--version=1.0',
|
[
|
||||||
'--release=20160101.t.0',
|
mock.call(
|
||||||
'--source=http://www.example.com/dummy/repo',
|
[
|
||||||
'--variant=dummy',
|
"lorax",
|
||||||
'--nomacboot',
|
"--product=dummyproduct",
|
||||||
'--isfinal',
|
"--version=1.0",
|
||||||
'--installpkgs=dummy-foo',
|
"--release=20160101.t.0",
|
||||||
'--installpkgs=dummy-bar',
|
"--source=http://www.example.com/dummy/repo",
|
||||||
'--add-template=/path/to/lorax.tmpl',
|
"--variant=dummy",
|
||||||
'--add-arch-template=/path/to/lorax-embed.tmpl',
|
"--nomacboot",
|
||||||
'--add-template-var=ostree_osname=dummy',
|
"--isfinal",
|
||||||
'--add-arch-template-var=ostree_repo=http://www.example.com/ostree',
|
"--installpkgs=dummy-foo",
|
||||||
'--rootfs-size=None',
|
"--installpkgs=dummy-bar",
|
||||||
self.output])])
|
"--add-template=/path/to/lorax.tmpl",
|
||||||
|
"--add-arch-template=/path/to/lorax-embed.tmpl",
|
||||||
|
"--add-template-var=ostree_osname=dummy",
|
||||||
|
"--add-arch-template-var=ostree_repo=http://www.example.com/ostree",
|
||||||
|
"--rootfs-size=None",
|
||||||
|
self.output,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
@mock.patch('kobo.shortcuts.run')
|
@mock.patch('kobo.shortcuts.run')
|
||||||
def test_run_with_extra_config_file(self, run):
|
def test_run_with_extra_config_file(self, run):
|
||||||
@ -387,22 +398,31 @@ class OstreeInstallerScriptTest(helpers.PungiTestCase):
|
|||||||
args.append('--extra-config=%s' % extra_config_file)
|
args.append('--extra-config=%s' % extra_config_file)
|
||||||
ostree.main(args)
|
ostree.main(args)
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
self.assertItemsEqual(run.mock_calls,
|
six.assertCountEqual(
|
||||||
[mock.call(['lorax',
|
self,
|
||||||
'--product=dummyproduct',
|
run.mock_calls,
|
||||||
'--version=1.0',
|
[
|
||||||
'--release=20160101.t.0',
|
mock.call(
|
||||||
'--source=http://www.example.com/dummy/repo',
|
[
|
||||||
'--variant=dummy',
|
"lorax",
|
||||||
'--nomacboot',
|
"--product=dummyproduct",
|
||||||
'--isfinal',
|
"--version=1.0",
|
||||||
'--installpkgs=dummy-foo',
|
"--release=20160101.t.0",
|
||||||
'--installpkgs=dummy-bar',
|
"--source=http://www.example.com/dummy/repo",
|
||||||
'--add-template=/path/to/lorax.tmpl',
|
"--variant=dummy",
|
||||||
'--add-arch-template=/path/to/lorax-embed.tmpl',
|
"--nomacboot",
|
||||||
'--add-template-var=ostree_osname=dummy-atomic',
|
"--isfinal",
|
||||||
'--add-template-var=ostree_ref=dummy/x86_64/docker',
|
"--installpkgs=dummy-foo",
|
||||||
'--add-arch-template-var=ostree_osname=dummy-atomic',
|
"--installpkgs=dummy-bar",
|
||||||
'--add-arch-template-var=ostree_repo=http://www.example.com/ostree',
|
"--add-template=/path/to/lorax.tmpl",
|
||||||
'--rootfs-size=None',
|
"--add-arch-template=/path/to/lorax-embed.tmpl",
|
||||||
self.output])])
|
"--add-template-var=ostree_osname=dummy-atomic",
|
||||||
|
"--add-template-var=ostree_ref=dummy/x86_64/docker",
|
||||||
|
"--add-arch-template-var=ostree_osname=dummy-atomic",
|
||||||
|
"--add-arch-template-var=ostree_repo=http://www.example.com/ostree",
|
||||||
|
"--rootfs-size=None",
|
||||||
|
self.output,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
@ -4,6 +4,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
import six
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
||||||
|
|
||||||
@ -66,7 +67,9 @@ class TestMaterializedPkgsetCreate(helpers.PungiTestCase):
|
|||||||
self.compose, self.pkgset, self.prefix
|
self.compose, self.pkgset, self.prefix
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertItemsEqual(result.package_sets.keys(), ["global", "amd64", "x86_64"])
|
six.assertCountEqual(
|
||||||
|
self, result.package_sets.keys(), ["global", "amd64", "x86_64"]
|
||||||
|
)
|
||||||
self.assertEqual(result["global"], self.pkgset)
|
self.assertEqual(result["global"], self.pkgset)
|
||||||
self.assertEqual(result["x86_64"], self.subsets["x86_64"])
|
self.assertEqual(result["x86_64"], self.subsets["x86_64"])
|
||||||
self.assertEqual(result["amd64"], self.subsets["amd64"])
|
self.assertEqual(result["amd64"], self.subsets["amd64"])
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import mock
|
import mock
|
||||||
import os
|
import os
|
||||||
|
import six
|
||||||
import sys
|
import sys
|
||||||
try:
|
try:
|
||||||
import unittest2 as unittest
|
import unittest2 as unittest
|
||||||
@ -125,7 +126,7 @@ class PkgsetCompareMixin(object):
|
|||||||
for k, v1 in expected.items():
|
for k, v1 in expected.items():
|
||||||
self.assertIn(k, actual)
|
self.assertIn(k, actual)
|
||||||
v2 = actual.pop(k)
|
v2 = actual.pop(k)
|
||||||
self.assertItemsEqual(v1, v2)
|
six.assertCountEqual(self, v1, v2)
|
||||||
self.assertEqual({}, actual)
|
self.assertEqual({}, actual)
|
||||||
|
|
||||||
|
|
||||||
@ -152,7 +153,7 @@ class TestKojiPkgset(PkgsetCompareMixin, helpers.PungiTestCase):
|
|||||||
for k, v1 in expected.items():
|
for k, v1 in expected.items():
|
||||||
self.assertIn(k, actual)
|
self.assertIn(k, actual)
|
||||||
v2 = actual.pop(k)
|
v2 = actual.pop(k)
|
||||||
self.assertItemsEqual(v1, v2)
|
six.assertCountEqual(self, v1, v2)
|
||||||
self.assertEqual({}, actual, msg='Some architectures were missing')
|
self.assertEqual({}, actual, msg='Some architectures were missing')
|
||||||
|
|
||||||
def test_all_arches(self):
|
def test_all_arches(self):
|
||||||
@ -590,5 +591,6 @@ class TestSaveFileList(unittest.TestCase):
|
|||||||
|
|
||||||
with open(self.tmpfile) as f:
|
with open(self.tmpfile) as f:
|
||||||
rpms = f.read().strip().split('\n')
|
rpms = f.read().strip().split('\n')
|
||||||
self.assertItemsEqual(rpms, ['pungi@4.1.3@3.fc25@noarch',
|
six.assertCountEqual(
|
||||||
'pungi@4.1.3@3.fc25@src'])
|
self, rpms, ["pungi@4.1.3@3.fc25@noarch", "pungi@4.1.3@3.fc25@src"]
|
||||||
|
)
|
||||||
|
@ -4,6 +4,7 @@ import json
|
|||||||
import mock
|
import mock
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import six
|
||||||
import sys
|
import sys
|
||||||
try:
|
try:
|
||||||
import unittest2 as unittest
|
import unittest2 as unittest
|
||||||
@ -49,7 +50,8 @@ class TestGetKojiEvent(helpers.PungiTestCase):
|
|||||||
event = source_koji.get_koji_event_info(self.compose, koji_wrapper)
|
event = source_koji.get_koji_event_info(self.compose, koji_wrapper)
|
||||||
|
|
||||||
self.assertEqual(event, EVENT_INFO)
|
self.assertEqual(event, EVENT_INFO)
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
koji_wrapper.mock_calls,
|
koji_wrapper.mock_calls,
|
||||||
[mock.call.koji_proxy.getEvent(123456)])
|
[mock.call.koji_proxy.getEvent(123456)])
|
||||||
with open(self.event_file) as f:
|
with open(self.event_file) as f:
|
||||||
@ -64,7 +66,8 @@ class TestGetKojiEvent(helpers.PungiTestCase):
|
|||||||
event = source_koji.get_koji_event_info(self.compose, koji_wrapper)
|
event = source_koji.get_koji_event_info(self.compose, koji_wrapper)
|
||||||
|
|
||||||
self.assertEqual(event, EVENT_INFO)
|
self.assertEqual(event, EVENT_INFO)
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
koji_wrapper.mock_calls,
|
koji_wrapper.mock_calls,
|
||||||
[mock.call.koji_proxy.getLastEvent()])
|
[mock.call.koji_proxy.getLastEvent()])
|
||||||
with open(self.event_file) as f:
|
with open(self.event_file) as f:
|
||||||
@ -122,12 +125,12 @@ class TestPopulateGlobalPkgset(helpers.PungiTestCase):
|
|||||||
|
|
||||||
self.assertEqual(len(pkgsets), 2)
|
self.assertEqual(len(pkgsets), 2)
|
||||||
init_calls = KojiPackageSet.call_args_list
|
init_calls = KojiPackageSet.call_args_list
|
||||||
self.assertItemsEqual([call[0][0] for call in init_calls], ["f25", "f25-extra"])
|
six.assertCountEqual(self, [call[0][0] for call in init_calls], ["f25", "f25-extra"])
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
[call[0][1] for call in init_calls], [self.koji_wrapper] * 2
|
self, [call[0][1] for call in init_calls], [self.koji_wrapper] * 2
|
||||||
)
|
)
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
[call[0][2] for call in init_calls], [["foo", "bar"]] * 2
|
self, [call[0][2] for call in init_calls], [["foo", "bar"]] * 2
|
||||||
)
|
)
|
||||||
|
|
||||||
pkgsets[0].assert_has_calls(
|
pkgsets[0].assert_has_calls(
|
||||||
@ -159,7 +162,7 @@ class TestPopulateGlobalPkgset(helpers.PungiTestCase):
|
|||||||
pkgsets = source_koji.populate_global_pkgset(
|
pkgsets = source_koji.populate_global_pkgset(
|
||||||
self.compose, self.koji_wrapper, '/prefix', 123456)
|
self.compose, self.koji_wrapper, '/prefix', 123456)
|
||||||
self.assertEqual(len(pkgsets), 1)
|
self.assertEqual(len(pkgsets), 1)
|
||||||
self.assertItemsEqual(pkgsets[0].packages, ["pkg", "foo"])
|
six.assertCountEqual(self, pkgsets[0].packages, ["pkg", "foo"])
|
||||||
|
|
||||||
|
|
||||||
class TestGetPackageSetFromKoji(helpers.PungiTestCase):
|
class TestGetPackageSetFromKoji(helpers.PungiTestCase):
|
||||||
@ -179,7 +182,8 @@ class TestGetPackageSetFromKoji(helpers.PungiTestCase):
|
|||||||
self.compose, self.koji_wrapper, "/prefix"
|
self.compose, self.koji_wrapper, "/prefix"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
self.koji_wrapper.koji_proxy.mock_calls,
|
self.koji_wrapper.koji_proxy.mock_calls,
|
||||||
[mock.call.getLastEvent()]
|
[mock.call.getLastEvent()]
|
||||||
)
|
)
|
||||||
@ -382,8 +386,7 @@ class TestSourceKoji(helpers.PungiTestCase):
|
|||||||
|
|
||||||
self.assertEqual(pkgsets, gpfk.return_value)
|
self.assertEqual(pkgsets, gpfk.return_value)
|
||||||
self.assertEqual(path_prefix, '/prefix/')
|
self.assertEqual(path_prefix, '/prefix/')
|
||||||
self.assertItemsEqual(KojiWrapper.mock_calls,
|
self.assertEqual(KojiWrapper.mock_calls, [mock.call('koji')])
|
||||||
[mock.call('koji')])
|
|
||||||
|
|
||||||
|
|
||||||
class TestCorrectNVR(helpers.PungiTestCase):
|
class TestCorrectNVR(helpers.PungiTestCase):
|
||||||
@ -401,12 +404,12 @@ class TestCorrectNVR(helpers.PungiTestCase):
|
|||||||
def test_nv(self):
|
def test_nv(self):
|
||||||
module_info = source_koji.variant_dict_from_str(self.compose, self.nv)
|
module_info = source_koji.variant_dict_from_str(self.compose, self.nv)
|
||||||
expectedKeys = ["stream", "name"]
|
expectedKeys = ["stream", "name"]
|
||||||
self.assertItemsEqual(module_info.keys(), expectedKeys)
|
six.assertCountEqual(self, module_info.keys(), expectedKeys)
|
||||||
|
|
||||||
def test_nvr(self):
|
def test_nvr(self):
|
||||||
module_info = source_koji.variant_dict_from_str(self.compose, self.nvr)
|
module_info = source_koji.variant_dict_from_str(self.compose, self.nvr)
|
||||||
expectedKeys = ["stream", "name", "version"]
|
expectedKeys = ["stream", "name", "version"]
|
||||||
self.assertItemsEqual(module_info.keys(), expectedKeys)
|
six.assertCountEqual(self, module_info.keys(), expectedKeys)
|
||||||
|
|
||||||
def test_correct_release(self):
|
def test_correct_release(self):
|
||||||
module_info = source_koji.variant_dict_from_str(self.compose, self.nvr)
|
module_info = source_koji.variant_dict_from_str(self.compose, self.nvr)
|
||||||
@ -456,7 +459,7 @@ class TestFilterInherited(unittest.TestCase):
|
|||||||
|
|
||||||
result = source_koji.filter_inherited(koji_proxy, event, module_builds, top_tag)
|
result = source_koji.filter_inherited(koji_proxy, event, module_builds, top_tag)
|
||||||
|
|
||||||
self.assertItemsEqual(result, [])
|
self.assertEqual(result, [])
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
koji_proxy.mock_calls,
|
koji_proxy.mock_calls,
|
||||||
[mock.call.getFullInheritance("top-tag", event=123456)],
|
[mock.call.getFullInheritance("top-tag", event=123456)],
|
||||||
@ -478,7 +481,8 @@ class TestFilterInherited(unittest.TestCase):
|
|||||||
|
|
||||||
result = source_koji.filter_inherited(koji_proxy, event, module_builds, top_tag)
|
result = source_koji.filter_inherited(koji_proxy, event, module_builds, top_tag)
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
result,
|
result,
|
||||||
[{"name": "foo", "version": "1", "release": "1", "tag_name": "top-tag"}],
|
[{"name": "foo", "version": "1", "release": "1", "tag_name": "top-tag"}],
|
||||||
)
|
)
|
||||||
@ -502,7 +506,8 @@ class TestFilterInherited(unittest.TestCase):
|
|||||||
|
|
||||||
result = source_koji.filter_inherited(koji_proxy, event, module_builds, top_tag)
|
result = source_koji.filter_inherited(koji_proxy, event, module_builds, top_tag)
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
result,
|
result,
|
||||||
[{"name": "foo", "version": "1", "release": "3", "tag_name": "middle-tag"}],
|
[{"name": "foo", "version": "1", "release": "3", "tag_name": "middle-tag"}],
|
||||||
)
|
)
|
||||||
@ -546,7 +551,7 @@ class TestFilterByWhitelist(unittest.TestCase):
|
|||||||
compose, module_builds, input_modules, expected
|
compose, module_builds, input_modules, expected
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertItemsEqual(result, [module_builds[0], module_builds[1]])
|
six.assertCountEqual(self, result, [module_builds[0], module_builds[1]])
|
||||||
self.assertEqual(expected, set())
|
self.assertEqual(expected, set())
|
||||||
|
|
||||||
def test_filter_by_NSV(self):
|
def test_filter_by_NSV(self):
|
||||||
@ -563,7 +568,7 @@ class TestFilterByWhitelist(unittest.TestCase):
|
|||||||
compose, module_builds, input_modules, expected
|
compose, module_builds, input_modules, expected
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertItemsEqual(result, [module_builds[1]])
|
self.assertEqual(result, [module_builds[1]])
|
||||||
self.assertEqual(expected, set())
|
self.assertEqual(expected, set())
|
||||||
|
|
||||||
def test_filter_by_NSVC(self):
|
def test_filter_by_NSVC(self):
|
||||||
@ -581,7 +586,7 @@ class TestFilterByWhitelist(unittest.TestCase):
|
|||||||
compose, module_builds, input_modules, expected
|
compose, module_builds, input_modules, expected
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertItemsEqual(result, [module_builds[1]])
|
self.assertEqual(result, [module_builds[1]])
|
||||||
self.assertEqual(expected, set())
|
self.assertEqual(expected, set())
|
||||||
|
|
||||||
def test_filter_by_wildcard(self):
|
def test_filter_by_wildcard(self):
|
||||||
@ -598,7 +603,7 @@ class TestFilterByWhitelist(unittest.TestCase):
|
|||||||
compose, module_builds, input_modules, expected
|
compose, module_builds, input_modules, expected
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertItemsEqual(result, module_builds)
|
six.assertCountEqual(self, result, module_builds)
|
||||||
self.assertEqual(expected, set())
|
self.assertEqual(expected, set())
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import six
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
||||||
|
|
||||||
@ -35,7 +36,8 @@ class RepoclosureWrapperTestCase(helpers.BaseTestCase):
|
|||||||
|
|
||||||
cmd = rc.get_repoclosure_cmd(arch='x86_64', repos=repos, lookaside=lookaside)
|
cmd = rc.get_repoclosure_cmd(arch='x86_64', repos=repos, lookaside=lookaside)
|
||||||
self.assertEqual(cmd[0], '/usr/bin/repoclosure')
|
self.assertEqual(cmd[0], '/usr/bin/repoclosure')
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
cmd[1:],
|
cmd[1:],
|
||||||
['--arch=x86_64',
|
['--arch=x86_64',
|
||||||
'--repofrompath=my-repo,file:///mnt/koji/repo',
|
'--repofrompath=my-repo,file:///mnt/koji/repo',
|
||||||
@ -50,7 +52,8 @@ class RepoclosureWrapperTestCase(helpers.BaseTestCase):
|
|||||||
cmd = rc.get_repoclosure_cmd(backend='dnf', arch='x86_64',
|
cmd = rc.get_repoclosure_cmd(backend='dnf', arch='x86_64',
|
||||||
repos=repos, lookaside=lookaside)
|
repos=repos, lookaside=lookaside)
|
||||||
self.assertEqual(cmd[:2], ['dnf', 'repoclosure'])
|
self.assertEqual(cmd[:2], ['dnf', 'repoclosure'])
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
cmd[2:],
|
cmd[2:],
|
||||||
['--arch=x86_64',
|
['--arch=x86_64',
|
||||||
'--repofrompath=my-repo,file:///mnt/koji/repo',
|
'--repofrompath=my-repo,file:///mnt/koji/repo',
|
||||||
@ -66,7 +69,8 @@ class RepoclosureWrapperTestCase(helpers.BaseTestCase):
|
|||||||
}
|
}
|
||||||
cmd = rc.get_repoclosure_cmd(repos=repos)
|
cmd = rc.get_repoclosure_cmd(repos=repos)
|
||||||
self.assertEqual(cmd[0], '/usr/bin/repoclosure')
|
self.assertEqual(cmd[0], '/usr/bin/repoclosure')
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
cmd[1:],
|
cmd[1:],
|
||||||
['--repofrompath=local,file:///mnt/koji/repo',
|
['--repofrompath=local,file:///mnt/koji/repo',
|
||||||
'--repofrompath=remote,http://kojipkgs.fp.o/repo',
|
'--repofrompath=remote,http://kojipkgs.fp.o/repo',
|
||||||
@ -80,7 +84,8 @@ class RepoclosureWrapperTestCase(helpers.BaseTestCase):
|
|||||||
}
|
}
|
||||||
cmd = rc.get_repoclosure_cmd(lookaside=repos)
|
cmd = rc.get_repoclosure_cmd(lookaside=repos)
|
||||||
self.assertEqual(cmd[0], '/usr/bin/repoclosure')
|
self.assertEqual(cmd[0], '/usr/bin/repoclosure')
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
cmd[1:],
|
cmd[1:],
|
||||||
['--repofrompath=local,file:///mnt/koji/repo',
|
['--repofrompath=local,file:///mnt/koji/repo',
|
||||||
'--repofrompath=remote,http://kojipkgs.fp.o/repo',
|
'--repofrompath=remote,http://kojipkgs.fp.o/repo',
|
||||||
|
@ -10,6 +10,7 @@ import tempfile
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import six
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
||||||
|
|
||||||
@ -26,7 +27,7 @@ class SCMBaseTest(unittest.TestCase):
|
|||||||
|
|
||||||
def assertStructure(self, returned, expected):
|
def assertStructure(self, returned, expected):
|
||||||
# Check we returned the correct files
|
# Check we returned the correct files
|
||||||
self.assertItemsEqual(returned, expected)
|
six.assertCountEqual(self, returned, expected)
|
||||||
|
|
||||||
# Each file must exist
|
# Each file must exist
|
||||||
for f in expected:
|
for f in expected:
|
||||||
@ -38,7 +39,7 @@ class SCMBaseTest(unittest.TestCase):
|
|||||||
for f in files:
|
for f in files:
|
||||||
p = os.path.relpath(os.path.join(root, f), self.destdir)
|
p = os.path.relpath(os.path.join(root, f), self.destdir)
|
||||||
found.append(p)
|
found.append(p)
|
||||||
self.assertItemsEqual(expected, found)
|
six.assertCountEqual(self, expected, found)
|
||||||
|
|
||||||
|
|
||||||
class FileSCMTestCase(SCMBaseTest):
|
class FileSCMTestCase(SCMBaseTest):
|
||||||
@ -269,7 +270,7 @@ class RpmSCMTestCase(SCMBaseTest):
|
|||||||
self.destdir)
|
self.destdir)
|
||||||
|
|
||||||
self.assertStructure(retval, ['some-file.txt'])
|
self.assertStructure(retval, ['some-file.txt'])
|
||||||
self.assertItemsEqual(self.exploded, [self.rpms[0]])
|
self.assertEqual(self.exploded, set([self.rpms[0]]))
|
||||||
|
|
||||||
@mock.patch('pungi.wrappers.scm.explode_rpm_package')
|
@mock.patch('pungi.wrappers.scm.explode_rpm_package')
|
||||||
def test_get_more_files(self, explode):
|
def test_get_more_files(self, explode):
|
||||||
@ -281,7 +282,7 @@ class RpmSCMTestCase(SCMBaseTest):
|
|||||||
self.destdir)
|
self.destdir)
|
||||||
|
|
||||||
self.assertStructure(retval, ['some-file.txt', 'foo.txt'])
|
self.assertStructure(retval, ['some-file.txt', 'foo.txt'])
|
||||||
self.assertItemsEqual(self.exploded, [self.rpms[0]])
|
self.assertEqual(self.exploded, set([self.rpms[0]]))
|
||||||
|
|
||||||
@mock.patch('pungi.wrappers.scm.explode_rpm_package')
|
@mock.patch('pungi.wrappers.scm.explode_rpm_package')
|
||||||
def test_get_whole_dir(self, explode):
|
def test_get_whole_dir(self, explode):
|
||||||
@ -292,7 +293,7 @@ class RpmSCMTestCase(SCMBaseTest):
|
|||||||
self.destdir)
|
self.destdir)
|
||||||
|
|
||||||
self.assertStructure(retval, ['subdir/foo.txt', 'subdir/bar.txt'])
|
self.assertStructure(retval, ['subdir/foo.txt', 'subdir/bar.txt'])
|
||||||
self.assertItemsEqual(self.exploded, [self.rpms[0]])
|
self.assertEqual(self.exploded, set([self.rpms[0]]))
|
||||||
|
|
||||||
@mock.patch('pungi.wrappers.scm.explode_rpm_package')
|
@mock.patch('pungi.wrappers.scm.explode_rpm_package')
|
||||||
def test_get_dir_contents(self, explode):
|
def test_get_dir_contents(self, explode):
|
||||||
@ -303,7 +304,7 @@ class RpmSCMTestCase(SCMBaseTest):
|
|||||||
self.destdir)
|
self.destdir)
|
||||||
|
|
||||||
self.assertStructure(retval, ['foo.txt', 'bar.txt'])
|
self.assertStructure(retval, ['foo.txt', 'bar.txt'])
|
||||||
self.assertItemsEqual(self.exploded, [self.rpms[0]])
|
self.assertEqual(self.exploded, set([self.rpms[0]]))
|
||||||
|
|
||||||
@mock.patch('pungi.wrappers.scm.explode_rpm_package')
|
@mock.patch('pungi.wrappers.scm.explode_rpm_package')
|
||||||
def test_get_files_from_two_rpms(self, explode):
|
def test_get_files_from_two_rpms(self, explode):
|
||||||
@ -315,7 +316,7 @@ class RpmSCMTestCase(SCMBaseTest):
|
|||||||
self.destdir)
|
self.destdir)
|
||||||
|
|
||||||
self.assertStructure(retval, ['some-file-1.txt', 'some-file-2.txt'])
|
self.assertStructure(retval, ['some-file-1.txt', 'some-file-2.txt'])
|
||||||
self.assertItemsEqual(self.exploded, self.rpms)
|
six.assertCountEqual(self, self.exploded, self.rpms)
|
||||||
|
|
||||||
@mock.patch('pungi.wrappers.scm.explode_rpm_package')
|
@mock.patch('pungi.wrappers.scm.explode_rpm_package')
|
||||||
def test_get_files_from_glob_rpms(self, explode):
|
def test_get_files_from_glob_rpms(self, explode):
|
||||||
@ -328,7 +329,7 @@ class RpmSCMTestCase(SCMBaseTest):
|
|||||||
|
|
||||||
self.assertStructure(retval,
|
self.assertStructure(retval,
|
||||||
['some-file-1.txt', 'some-file-2.txt', 'some-file-3.txt', 'some-file-4.txt'])
|
['some-file-1.txt', 'some-file-2.txt', 'some-file-3.txt', 'some-file-4.txt'])
|
||||||
self.assertItemsEqual(self.exploded, self.numbered)
|
six.assertCountEqual(self, self.exploded, self.numbered)
|
||||||
|
|
||||||
@mock.patch('pungi.wrappers.scm.explode_rpm_package')
|
@mock.patch('pungi.wrappers.scm.explode_rpm_package')
|
||||||
def test_get_dir_from_two_rpms(self, explode):
|
def test_get_dir_from_two_rpms(self, explode):
|
||||||
@ -340,7 +341,7 @@ class RpmSCMTestCase(SCMBaseTest):
|
|||||||
self.destdir)
|
self.destdir)
|
||||||
|
|
||||||
self.assertStructure(retval, ['common/foo-1.txt', 'common/foo-2.txt'])
|
self.assertStructure(retval, ['common/foo-1.txt', 'common/foo-2.txt'])
|
||||||
self.assertItemsEqual(self.exploded, self.rpms)
|
six.assertCountEqual(self, self.exploded, self.rpms)
|
||||||
|
|
||||||
@mock.patch('pungi.wrappers.scm.explode_rpm_package')
|
@mock.patch('pungi.wrappers.scm.explode_rpm_package')
|
||||||
def test_get_dir_from_glob_rpms(self, explode):
|
def test_get_dir_from_glob_rpms(self, explode):
|
||||||
@ -353,7 +354,7 @@ class RpmSCMTestCase(SCMBaseTest):
|
|||||||
|
|
||||||
self.assertStructure(retval,
|
self.assertStructure(retval,
|
||||||
['foo-1.txt', 'foo-2.txt', 'foo-3.txt', 'foo-4.txt'])
|
['foo-1.txt', 'foo-2.txt', 'foo-3.txt', 'foo-4.txt'])
|
||||||
self.assertItemsEqual(self.exploded, self.numbered)
|
six.assertCountEqual(self, self.exploded, self.numbered)
|
||||||
|
|
||||||
|
|
||||||
class CvsSCMTestCase(SCMBaseTest):
|
class CvsSCMTestCase(SCMBaseTest):
|
||||||
|
@ -8,6 +8,7 @@ except ImportError:
|
|||||||
|
|
||||||
import mock
|
import mock
|
||||||
import os
|
import os
|
||||||
|
import six
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
||||||
@ -325,7 +326,8 @@ class TestRepoclosure(PungiTestCase):
|
|||||||
|
|
||||||
test_phase.run_repoclosure(compose)
|
test_phase.run_repoclosure(compose)
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
mock_grc.call_args_list,
|
mock_grc.call_args_list,
|
||||||
[mock.call(backend='yum', arch=['amd64', 'x86_64', 'noarch'], lookaside={},
|
[mock.call(backend='yum', arch=['amd64', 'x86_64', 'noarch'], lookaside={},
|
||||||
repos=self._get_repo(compose.compose_id, 'Everything', 'amd64')),
|
repos=self._get_repo(compose.compose_id, 'Everything', 'amd64')),
|
||||||
@ -345,7 +347,8 @@ class TestRepoclosure(PungiTestCase):
|
|||||||
compose = DummyCompose(self.topdir, {'repoclosure_backend': 'dnf'})
|
compose = DummyCompose(self.topdir, {'repoclosure_backend': 'dnf'})
|
||||||
test_phase.run_repoclosure(compose)
|
test_phase.run_repoclosure(compose)
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
mock_grc.call_args_list,
|
mock_grc.call_args_list,
|
||||||
[mock.call(backend='dnf', arch=['amd64', 'x86_64', 'noarch'], lookaside={},
|
[mock.call(backend='dnf', arch=['amd64', 'x86_64', 'noarch'], lookaside={},
|
||||||
repos=self._get_repo(compose.compose_id, 'Everything', 'amd64')),
|
repos=self._get_repo(compose.compose_id, 'Everything', 'amd64')),
|
||||||
@ -375,7 +378,8 @@ class TestRepoclosure(PungiTestCase):
|
|||||||
test_phase.run_repoclosure(compose)
|
test_phase.run_repoclosure(compose)
|
||||||
|
|
||||||
self.assertEqual(mock_grc.call_args_list, [])
|
self.assertEqual(mock_grc.call_args_list, [])
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
effl.call_args_list,
|
effl.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(f, _log("amd64", "Everything")),
|
mock.call(f, _log("amd64", "Everything")),
|
||||||
@ -410,7 +414,8 @@ class TestRepoclosure(PungiTestCase):
|
|||||||
})
|
})
|
||||||
test_phase.run_repoclosure(compose)
|
test_phase.run_repoclosure(compose)
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
mock_grc.call_args_list,
|
mock_grc.call_args_list,
|
||||||
[mock.call(backend='dnf', arch=['amd64', 'x86_64', 'noarch'], lookaside={},
|
[mock.call(backend='dnf', arch=['amd64', 'x86_64', 'noarch'], lookaside={},
|
||||||
repos=self._get_repo(compose.compose_id, 'Server', 'amd64')),
|
repos=self._get_repo(compose.compose_id, 'Server', 'amd64')),
|
||||||
|
@ -4,6 +4,7 @@ import mock
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
import six
|
||||||
from six.moves.configparser import SafeConfigParser
|
from six.moves.configparser import SafeConfigParser
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
||||||
@ -147,9 +148,11 @@ class TestLinkToTemp(PungiTestCase):
|
|||||||
def test_link_to_temp(self):
|
def test_link_to_temp(self):
|
||||||
self.isos.link_to_temp()
|
self.isos.link_to_temp()
|
||||||
|
|
||||||
self.assertItemsEqual(self.isos.treeinfo.keys(),
|
six.assertCountEqual(
|
||||||
['i386', 's390x', 'src', 'x86_64',
|
self,
|
||||||
'debug-i386', 'debug-s390x', 'debug-x86_64'])
|
self.isos.treeinfo.keys(),
|
||||||
|
["i386", "s390x", "src", "x86_64", "debug-i386", "debug-s390x", "debug-x86_64"],
|
||||||
|
)
|
||||||
self.assertEqual(self.isos.comps,
|
self.assertEqual(self.isos.comps,
|
||||||
get_comps_mapping(self.compose_path))
|
get_comps_mapping(self.compose_path))
|
||||||
self.assertEqual(self.isos.productid,
|
self.assertEqual(self.isos.productid,
|
||||||
@ -157,7 +160,8 @@ class TestLinkToTemp(PungiTestCase):
|
|||||||
self.assertEqual(self.isos.repos,
|
self.assertEqual(self.isos.repos,
|
||||||
get_repos_mapping(self.isos.temp_dir))
|
get_repos_mapping(self.isos.temp_dir))
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
self.isos.linker.link.call_args_list,
|
self.isos.linker.link.call_args_list,
|
||||||
[self._linkCall('Server', 's390x', 'dummy-filesystem-4.2.37-6.s390x.rpm'),
|
[self._linkCall('Server', 's390x', 'dummy-filesystem-4.2.37-6.s390x.rpm'),
|
||||||
self._linkCall('Server', 's390x', 'dummy-elinks-debuginfo-2.6-2.s390x.rpm'),
|
self._linkCall('Server', 's390x', 'dummy-elinks-debuginfo-2.6-2.s390x.rpm'),
|
||||||
@ -178,9 +182,11 @@ class TestLinkToTemp(PungiTestCase):
|
|||||||
with mock.patch('sys.stderr'):
|
with mock.patch('sys.stderr'):
|
||||||
self.isos.link_to_temp()
|
self.isos.link_to_temp()
|
||||||
|
|
||||||
self.assertItemsEqual(self.isos.treeinfo.keys(),
|
six.assertCountEqual(
|
||||||
['s390x', 'src', 'x86_64',
|
self,
|
||||||
'debug-s390x', 'debug-x86_64'])
|
self.isos.treeinfo.keys(),
|
||||||
|
["s390x", "src", "x86_64", "debug-s390x", "debug-x86_64"],
|
||||||
|
)
|
||||||
comps = get_comps_mapping(self.compose_path)
|
comps = get_comps_mapping(self.compose_path)
|
||||||
comps.pop('i386')
|
comps.pop('i386')
|
||||||
self.assertEqual(self.isos.comps, comps)
|
self.assertEqual(self.isos.comps, comps)
|
||||||
@ -194,7 +200,8 @@ class TestLinkToTemp(PungiTestCase):
|
|||||||
|
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
self.isos.linker.link.call_args_list,
|
self.isos.linker.link.call_args_list,
|
||||||
[self._linkCall('Server', 's390x', 'dummy-filesystem-4.2.37-6.s390x.rpm'),
|
[self._linkCall('Server', 's390x', 'dummy-filesystem-4.2.37-6.s390x.rpm'),
|
||||||
self._linkCall('Server', 's390x', 'dummy-elinks-debuginfo-2.6-2.s390x.rpm'),
|
self._linkCall('Server', 's390x', 'dummy-elinks-debuginfo-2.6-2.s390x.rpm'),
|
||||||
@ -211,9 +218,11 @@ class TestLinkToTemp(PungiTestCase):
|
|||||||
|
|
||||||
self.isos.link_to_temp()
|
self.isos.link_to_temp()
|
||||||
|
|
||||||
self.assertItemsEqual(self.isos.treeinfo.keys(),
|
six.assertCountEqual(
|
||||||
['i386', 's390x', 'src', 'x86_64',
|
self,
|
||||||
'debug-i386', 'debug-s390x', 'debug-x86_64'])
|
self.isos.treeinfo.keys(),
|
||||||
|
["i386", "s390x", "src", "x86_64", "debug-i386", "debug-s390x", "debug-x86_64"],
|
||||||
|
)
|
||||||
self.assertEqual(self.isos.comps,
|
self.assertEqual(self.isos.comps,
|
||||||
get_comps_mapping(self.compose_path))
|
get_comps_mapping(self.compose_path))
|
||||||
self.assertEqual(self.isos.productid,
|
self.assertEqual(self.isos.productid,
|
||||||
@ -221,7 +230,8 @@ class TestLinkToTemp(PungiTestCase):
|
|||||||
self.assertEqual(self.isos.repos,
|
self.assertEqual(self.isos.repos,
|
||||||
get_repos_mapping(self.isos.temp_dir))
|
get_repos_mapping(self.isos.temp_dir))
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
self.isos.linker.link.call_args_list,
|
self.isos.linker.link.call_args_list,
|
||||||
[self._linkCall('Server', 's390x', 'dummy-filesystem-4.2.37-6.s390x.rpm'),
|
[self._linkCall('Server', 's390x', 'dummy-filesystem-4.2.37-6.s390x.rpm'),
|
||||||
self._linkCall('Server', 's390x', 'dummy-elinks-debuginfo-2.6-2.s390x.rpm'),
|
self._linkCall('Server', 's390x', 'dummy-elinks-debuginfo-2.6-2.s390x.rpm'),
|
||||||
@ -267,7 +277,8 @@ class TestCreaterepo(PungiTestCase):
|
|||||||
cr.return_value.get_createrepo_cmd.side_effect = self.mock_cr
|
cr.return_value.get_createrepo_cmd.side_effect = self.mock_cr
|
||||||
self.isos.createrepo()
|
self.isos.createrepo()
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
run.call_args_list,
|
run.call_args_list,
|
||||||
[mock.call(('src/Client', None), show_cmd=True),
|
[mock.call(('src/Client', None), show_cmd=True),
|
||||||
mock.call(('src/Server', None), show_cmd=True),
|
mock.call(('src/Server', None), show_cmd=True),
|
||||||
@ -311,7 +322,8 @@ class TestCreaterepo(PungiTestCase):
|
|||||||
cr.return_value.get_modifyrepo_cmd.side_effect = self.mock_mr
|
cr.return_value.get_modifyrepo_cmd.side_effect = self.mock_mr
|
||||||
self.isos.createrepo()
|
self.isos.createrepo()
|
||||||
|
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
run.call_args_list,
|
run.call_args_list,
|
||||||
[mock.call(('src/Client', None), show_cmd=True),
|
[mock.call(('src/Client', None), show_cmd=True),
|
||||||
mock.call(('src/Server', None), show_cmd=True),
|
mock.call(('src/Server', None), show_cmd=True),
|
||||||
@ -369,7 +381,8 @@ class TestDiscinfo(PungiTestCase):
|
|||||||
@mock.patch('pungi_utils.unified_isos.create_discinfo')
|
@mock.patch('pungi_utils.unified_isos.create_discinfo')
|
||||||
def test_discinfo(self, create_discinfo):
|
def test_discinfo(self, create_discinfo):
|
||||||
self.isos.discinfo()
|
self.isos.discinfo()
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
create_discinfo.call_args_list,
|
create_discinfo.call_args_list,
|
||||||
[mock.call(os.path.join(self.isos.temp_dir, 'trees', 'i386', '.discinfo'),
|
[mock.call(os.path.join(self.isos.temp_dir, 'trees', 'i386', '.discinfo'),
|
||||||
'Dummy Product 1.0', 'i386'),
|
'Dummy Product 1.0', 'i386'),
|
||||||
@ -465,7 +478,7 @@ class TestCreateiso(PungiTestCase):
|
|||||||
mock.call(self.debug, self._iso('Server', 'x86_64/debug', self.debug_fn)),
|
mock.call(self.debug, self._iso('Server', 'x86_64/debug', self.debug_fn)),
|
||||||
mock.call(self.debug + '.manifest', self._iso('Server', 'x86_64/debug', self.debug_fn + '.manifest')),
|
mock.call(self.debug + '.manifest', self._iso('Server', 'x86_64/debug', self.debug_fn + '.manifest')),
|
||||||
])
|
])
|
||||||
self.assertItemsEqual(self.isos.linker.link.call_args_list, expected)
|
six.assertCountEqual(self, self.isos.linker.link.call_args_list, expected)
|
||||||
|
|
||||||
@mock.patch('pungi_utils.unified_isos.iso')
|
@mock.patch('pungi_utils.unified_isos.iso')
|
||||||
@mock.patch('pungi_utils.unified_isos.run')
|
@mock.patch('pungi_utils.unified_isos.run')
|
||||||
@ -525,7 +538,8 @@ class TestUpdateChecksums(PungiTestCase):
|
|||||||
@mock.patch('pungi_utils.unified_isos.make_checksums')
|
@mock.patch('pungi_utils.unified_isos.make_checksums')
|
||||||
def test_update_checksums(self, mmc):
|
def test_update_checksums(self, mmc):
|
||||||
self.isos.update_checksums()
|
self.isos.update_checksums()
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
mmc.call_args_list,
|
mmc.call_args_list,
|
||||||
[mock.call(self.compose_path, self.isos.compose.images,
|
[mock.call(self.compose_path, self.isos.compose.images,
|
||||||
unified_isos.DEFAULT_CHECKSUMS, False,
|
unified_isos.DEFAULT_CHECKSUMS, False,
|
||||||
@ -535,7 +549,8 @@ class TestUpdateChecksums(PungiTestCase):
|
|||||||
def test_update_checksums_one_file(self, mmc):
|
def test_update_checksums_one_file(self, mmc):
|
||||||
self.isos.conf['media_checksum_one_file'] = True
|
self.isos.conf['media_checksum_one_file'] = True
|
||||||
self.isos.update_checksums()
|
self.isos.update_checksums()
|
||||||
self.assertItemsEqual(
|
six.assertCountEqual(
|
||||||
|
self,
|
||||||
mmc.call_args_list,
|
mmc.call_args_list,
|
||||||
[mock.call(self.compose_path, self.isos.compose.images,
|
[mock.call(self.compose_path, self.isos.compose.images,
|
||||||
unified_isos.DEFAULT_CHECKSUMS, True,
|
unified_isos.DEFAULT_CHECKSUMS, True,
|
||||||
|
@ -11,6 +11,7 @@ except ImportError:
|
|||||||
import tempfile
|
import tempfile
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import six
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
||||||
|
|
||||||
@ -224,7 +225,7 @@ class TestGetVariantData(unittest.TestCase):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = util.get_variant_data(conf, 'foo', mock.Mock(uid='Client'))
|
result = util.get_variant_data(conf, 'foo', mock.Mock(uid='Client'))
|
||||||
self.assertItemsEqual(result, [1, 2, 3])
|
six.assertCountEqual(self, result, [1, 2, 3])
|
||||||
|
|
||||||
def test_not_matching_arch(self):
|
def test_not_matching_arch(self):
|
||||||
conf = {
|
conf = {
|
||||||
@ -233,11 +234,11 @@ class TestGetVariantData(unittest.TestCase):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = util.get_variant_data(conf, 'foo', mock.Mock(uid='Server'))
|
result = util.get_variant_data(conf, 'foo', mock.Mock(uid='Server'))
|
||||||
self.assertItemsEqual(result, [])
|
self.assertEqual(result, [])
|
||||||
|
|
||||||
def test_handle_missing_config(self):
|
def test_handle_missing_config(self):
|
||||||
result = util.get_variant_data({}, 'foo', mock.Mock(uid='Client'))
|
result = util.get_variant_data({}, 'foo', mock.Mock(uid='Client'))
|
||||||
self.assertItemsEqual(result, [])
|
self.assertEqual(result, [])
|
||||||
|
|
||||||
def test_get_save_pattern(self):
|
def test_get_save_pattern(self):
|
||||||
conf = {
|
conf = {
|
||||||
|
Loading…
Reference in New Issue
Block a user