Merge lp:~rvb/maas-test/only-one-arch into lp:maas-test

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: 153
Merged at revision: 153
Proposed branch: lp:~rvb/maas-test/only-one-arch
Merge into: lp:maas-test
Prerequisite: lp:~rvb/maas-test/support-utopic
Diff against target: 119 lines (+14/-48)
4 files modified
maastest/maasfixture.py (+1/-1)
maastest/tests/test_maasfixture.py (+0/-24)
maastest/tests/test_utils.py (+8/-6)
maastest/utils.py (+5/-17)
To merge this branch: bzr merge lp:~rvb/maas-test/only-one-arch
Reviewer Review Type Date Requested Status
Julian Edwards (community) Approve
Review via email: mp+217265@code.launchpad.net

Commit message

Remove workaround for bug 1181334: do not always download i386 images.

Description of the change

I decided to keep passing to maasfixture.compose_import_config a list of architectures: all the code to support that is in place so it would be a waste to change that to support only one architecture. Although one architecture is all we need right now, we might need to download images for more than one architecture in the future (maybe just in order to get a dry-run to cache images).

To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

 review: approve
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlNdo2cACgkQWhGlTF8G/Hdu3wCfeZLK/ONYXCZb7LdY+9jMgxj0
f8wAnRDB9k//YfnnJopWjyZ8J64gHJxq
=JxRH
-----END PGP SIGNATURE-----

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'maastest/maasfixture.py'
2--- maastest/maasfixture.py 2014-04-10 10:20:23 +0000
3+++ maastest/maasfixture.py 2014-04-25 15:47:50 +0000
4@@ -276,7 +276,7 @@
5 imported, e.g. 'amd64', 'arm/hightbank'. If the
6 subarchitecture isn't specified, 'generic' is assumed.
7 """
8- arch_list = utils.mipf_arch_list(architecture)
9+ arch_list = [utils.mipf_arch(architecture)]
10 logging.info(
11 "Importing boot images series=%s, architectures=%s..." % (
12 series, ', '.join(arch_list)))
13
14=== modified file 'maastest/tests/test_maasfixture.py'
15--- maastest/tests/test_maasfixture.py 2014-04-10 10:39:09 +0000
16+++ maastest/tests/test_maasfixture.py 2014-04-25 15:47:50 +0000
17@@ -756,30 +756,6 @@
18 maas_fixture.configure_cluster.mock_calls,
19 ])
20
21- def test_import_maas_images_imports_pxe_images(self):
22- kvm_fixture = self.make_kvm_fixture()
23- proxy_url = self.getUniqueString()
24- maas_fixture = self.make_maas_fixture(kvm_fixture, proxy_url)
25- series = self.getUniqueString()
26- arch = self.getUniqueString()
27- filter = self.getUniqueString()
28- returned_arches = ['amd64/generic', 'i386/generic']
29- mock_mipf_arch_list = mock.MagicMock(return_value=returned_arches)
30- self.patch(
31- utils, 'mipf_arch_list', mock_mipf_arch_list)
32-
33- maas_fixture.import_maas_images(series, arch, filter)
34-
35- self.assertEqual(
36- mock.call([
37- 'sudo',
38- 'http_proxy=%s' % proxy_url,
39- 'https_proxy=%s' % proxy_url,
40- 'maas-import-pxe-files',
41- ], check_call=True),
42- kvm_fixture.run_command.mock_calls[-1])
43- self.assertEqual([mock.call(arch)], mock_mipf_arch_list.mock_calls)
44-
45 def test_dump_data_calls_dumpdata(self):
46 maas_fixture = self.make_maas_fixture()
47 maas_fixture._maas_admin = 'maas-region-admin'
48
49=== modified file 'maastest/tests/test_utils.py'
50--- maastest/tests/test_utils.py 2014-04-25 15:47:50 +0000
51+++ maastest/tests/test_utils.py 2014-04-25 15:47:50 +0000
52@@ -334,15 +334,17 @@
53 self.assertEqual({}, utils.extract_mac_ip_mapping(NMAP_XML_OUTPUT))
54
55
56-class TestMipfArchList(testtools.TestCase):
57+class TestMipfArch(testtools.TestCase):
58
59 def test_defaults_to_generic(self):
60- self.assertItemsEqual(['i386/generic'], utils.mipf_arch_list('i386'))
61+ arch = self.getUniqueString()
62+ self.assertItemsEqual('%s/generic' % arch, utils.mipf_arch(arch))
63
64- def test_adds_i386_if_missing(self):
65- self.assertEqual(
66- (['amd64/generic', 'i386/generic'], ['i386/generic']),
67- (utils.mipf_arch_list('amd64'), utils.mipf_arch_list('i386')))
68+ def test_keeps_subarch_if_provided(self):
69+ arch = self.getUniqueString()
70+ subarch = self.getUniqueString()
71+ full_arch = "%s/%s" % (arch, subarch)
72+ self.assertEqual(full_arch, (utils.mipf_arch(full_arch)))
73
74
75 class TestVirtualizationType(testtools.TestCase):
76
77=== modified file 'maastest/utils.py'
78--- maastest/utils.py 2014-04-09 10:41:45 +0000
79+++ maastest/utils.py 2014-04-25 15:47:50 +0000
80@@ -19,7 +19,7 @@
81 "determine_vm_architecture",
82 "determine_vm_series",
83 "get_uri",
84- "mipf_arch_list",
85+ "mipf_arch",
86 "read_file",
87 "retries",
88 "run_command",
89@@ -238,26 +238,14 @@
90 return mapping
91
92
93-def mipf_arch_list(architecture):
94- """Return the architectures that must be downloaded by m-i-p-f.
95+def mipf_arch(architecture):
96+ """Return the name of the architecture that must be downloaded by m-i-p-f.
97
98- This converts an architecture name (e.g. 'amd64' or 'armhf/generic') into
99- the list of architectures that m-i-p-f must download in a format that
100- this script understands.
101- More precisely, this means doing two things:
102- - default the subarchitecture 'generic' if not specified.
103- - work around bug 1181334 by including 'i386/generic' in the list of
104- architectures to be downloaded if it's not explicitely specified.
105+ If subarch is not provided, default to 'generic'.
106 """
107- # If subarchitecture is not provided, assume 'generic'.
108 if '/' not in architecture:
109 architecture = '%s/generic' % architecture
110- arch_list = [architecture]
111- # Include i386, see
112- # https://bugs.launchpad.net/ubuntu/+source/maas/+bug/1181334
113- if architecture != "i386/generic":
114- arch_list.append("i386/generic")
115- return arch_list
116+ return architecture
117
118
119 def check_kvm_ok():

Subscribers

People subscribed via source and target branches