Merge lp:~rvb/maas-test/ppa-rename into lp:maas-test

Proposed by Raphaël Badin
Status: Merged
Merged at revision: 55
Proposed branch: lp:~rvb/maas-test/ppa-rename
Merge into: lp:maas-test
Diff against target: 175 lines (+39/-33)
4 files modified
docs/man/maas-test.8.rst (+4/-4)
maastest/kvmfixture.py (+10/-10)
maastest/parser.py (+10/-5)
maastest/tests/test_kvmfixture.py (+15/-14)
To merge this branch: bzr merge lp:~rvb/maas-test/ppa-rename
Reviewer Review Type Date Requested Status
Jeroen T. Vermeulen (community) Approve
Julian Edwards (community) Approve
Review via email: mp+196501@code.launchpad.net

Commit message

Rename the 'ppa' parameter into 'archive'.

Description of the change

As Julian pointed out, this value is passed straight on to add-apt-repository and thus it can more than just a PPA.

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

 review: approve

review: Approve
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Ahem. Sorry, forgot to enter my vote. A lot of work, but definitely an improvement.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'docs/man/maas-test.8.rst'
2--- docs/man/maas-test.8.rst 2013-11-23 18:54:02 +0000
3+++ docs/man/maas-test.8.rst 2013-11-25 09:26:30 +0000
4@@ -77,10 +77,10 @@
5 Enlist in interactive mode. Instead of powering up the node automatically
6 through IPMI, prompt the user to turn it on manually.
7
8---ppa=PPA
9- Optional PPA, or Personal Package Archive. If given, the virtual machine
10- may install packages from this additional archive as well as from the main
11- Ubuntu archive. This is typically used to test recent versions of MAAS only
12+--archive=ARCHIVE
13+ Optional repository name. If given, the virtual machine may install
14+ packages from this additional archive as well as from the main Ubuntu
15+ archive. This is typically used to test recent versions of MAAS only
16 published in a PPA, e.g. "ppa:maas-maintainers/dailybuilds".
17
18
19
20=== modified file 'maastest/kvmfixture.py'
21--- maastest/kvmfixture.py 2013-11-21 14:40:01 +0000
22+++ maastest/kvmfixture.py 2013-11-25 09:26:30 +0000
23@@ -66,7 +66,7 @@
24 machine.
25 """
26 def __init__(self, series, architecture, direct_interface=None,
27- direct_network=None, name=None, ppa=None):
28+ direct_network=None, name=None, archive=None):
29 """Initialise a KVM-based Virtual Machine fixture.
30
31 The VM's network is configured like this:
32@@ -97,13 +97,13 @@
33 provided and 'direct_network' is not provided, this will default
34 to the network 192.168.2.0/24.
35 :type direct_network: netaddr.IPNetwork
36- :param ppa: An optional PPA name. If provided, the PPA will
37- be added onto the VM.
38- :type ppa: string
39+ :param archive: An optional repository name. If provided, the
40+ repository will be added onto the VM.
41+ :type archive: string
42 """
43 super(KVMFixture, self).__init__()
44 self.command_count = itertools.count(1)
45- self.ppa = ppa
46+ self.archive = archive
47 self.series = series
48 self.architecture = architecture
49 self.direct_interface = direct_interface
50@@ -133,7 +133,7 @@
51 self.wait_for_vm()
52 self.wait_for_cloudinit()
53 self.configure_network()
54- self.configure_ppa()
55+ self.configure_archive()
56 self.install_base_packages()
57 except:
58 self.destroy()
59@@ -248,11 +248,11 @@
60 "Done creating virtual machine %s, arch=%s.", self.name,
61 self.architecture)
62
63- def configure_ppa(self):
64- """Add the PPA to the VM."""
65- if self.ppa is not None:
66+ def configure_archive(self):
67+ """Add the repository to the VM."""
68+ if self.archive is not None:
69 self.run_command(
70- ["sudo", "add-apt-repository", "-y", self.ppa],
71+ ["sudo", "add-apt-repository", "-y", self.archive],
72 check_call=True)
73
74 def configure_network(self):
75
76=== modified file 'maastest/parser.py'
77--- maastest/parser.py 2013-11-21 14:40:17 +0000
78+++ maastest/parser.py 2013-11-25 09:26:30 +0000
79@@ -50,11 +50,16 @@
80 "the machine's interface on which the node under test should "
81 "be plugged-in.")
82 parser.add_argument(
83- '--ppa', type=text_type, default=None,
84- help="An optional PPA name. If provided, that PPA will be "
85- "added onto the virtual machine. This is typically used to "
86- "test recent versions of MAAS only published in a PPA ("
87- "e.g. ppa:maas-maintainers/dailybuilds).")
88+ '--archive', type=text_type, default=None,
89+ help="An optional repository name. If provided, the repository will "
90+ "be added onto the virtual machine. That value is passed "
91+ "on to `add-apt-repository` so it can be either a "
92+ "line that can be added directly to sources.list, in the "
93+ "form ppa:<user>/<ppa-name> for adding Personal Package "
94+ "Archives, or a distribution component to enable. This is "
95+ "typically used to test recent versions of MAAS only "
96+ "published in a PPA, e.g. "
97+ "ppa:maas-maintainers/dailybuilds.")
98 parser.add_argument(
99 '--interactive-enlistment', action='store_true',
100 help="Perform an interactive enlistment. Instead of passing the "
101
102=== modified file 'maastest/tests/test_kvmfixture.py'
103--- maastest/tests/test_kvmfixture.py 2013-11-21 14:40:01 +0000
104+++ maastest/tests/test_kvmfixture.py 2013-11-25 09:26:30 +0000
105@@ -68,7 +68,7 @@
106
107 def make_KVMFixture(self, series=None, architecture=None, name=None,
108 direct_interface=None, direct_network=None,
109- ppa=None):
110+ archive=None):
111 if series is None:
112 series = self.getUniqueString()
113 if architecture is None:
114@@ -78,7 +78,7 @@
115 fixture = kvmfixture.KVMFixture(
116 series, architecture, name=name,
117 direct_interface=direct_interface,
118- direct_network=direct_network, ppa=ppa)
119+ direct_network=direct_network, archive=archive)
120 # Hack to get fixture.addDetail to work without actually calling
121 # fixture.setUp().
122 fixture._details = {}
123@@ -147,10 +147,10 @@
124 self.patch(
125 kvmfixture.KVMFixture, 'configure_network',
126 mock_configure_network)
127- mock_configure_ppa = mock.MagicMock()
128+ mock_configure_archive = mock.MagicMock()
129 self.patch(
130- kvmfixture.KVMFixture, 'configure_ppa',
131- mock_configure_ppa)
132+ kvmfixture.KVMFixture, 'configure_archive',
133+ mock_configure_archive)
134 series = "test-series"
135 architecture = "test-arch"
136 with self.make_KVMFixture(series, architecture):
137@@ -166,7 +166,7 @@
138 mock_import_image.mock_calls,
139 mock_start.mock_calls,
140 mock_configure_network.mock_calls,
141- mock_configure_ppa.mock_calls,
142+ mock_configure_archive.mock_calls,
143 mock_install_base_packages.mock_calls,
144 ])
145
146@@ -438,20 +438,21 @@
147 self.assertEqual(
148 fixture.direct_first_available_ip(), "192.168.12.2")
149
150- def test_configure_ppa_adds_ppa(self):
151+ def test_configure_archive_adds_archive(self):
152 mock_identity = mock.MagicMock()
153 mock_identity.return_value = "ubuntu@test"
154 self.patch(kvmfixture.KVMFixture, 'identity', mock_identity)
155 run_command_mock = mock.MagicMock(return_value=(0, '', ''))
156 self.patch(kvmfixture.KVMFixture, 'run_command', run_command_mock)
157- ppa = self.getUniqueString()
158- fixture = self.make_KVMFixture('series', 'architecture', ppa=ppa)
159-
160- fixture.configure_ppa()
161-
162- add_ppa_cmd = ["sudo", "add-apt-repository", "-y", ppa]
163+ archive = self.getUniqueString()
164+ fixture = self.make_KVMFixture(
165+ 'series', 'architecture', archive=archive)
166+
167+ fixture.configure_archive()
168+
169+ add_archive_cmd = ["sudo", "add-apt-repository", "-y", archive]
170 self.assertEqual(
171- [mock.call(add_ppa_cmd, check_call=True)],
172+ [mock.call(add_archive_cmd, check_call=True)],
173 run_command_mock.mock_calls)
174
175 def test_configure_network_configures_network(self):

Subscribers

People subscribed via source and target branches