summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
Diffstat (limited to 'debian')
-rw-r--r--debian/changelog4
-rw-r--r--debian/patches/cpick-8c6878a-tests-fix-assumptions-that-expected-no-eth0-in-system73
-rw-r--r--debian/patches/series1
3 files changed, 77 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index 779e65b3..c05d4cf3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,8 +4,10 @@ cloud-init (0.7.8-49-g9e904bb-0ubuntu1~16.04.2) UNRELEASED; urgency=medium
MBR disks with sfdisk. (LP: #1460715)
* cherry-pick 6e92c5f: net/cmdline: Consider ip= or ip6= on command
line not only ip= (LP: #1639930)
+ * cherry-pick 8c6878a: tests: fix assumptions that expected no eth0 in
+ system. (LP: #1644043)
- -- Scott Moser <smoser@ubuntu.com> Thu, 01 Dec 2016 16:56:18 -0500
+ -- Scott Moser <smoser@ubuntu.com> Thu, 01 Dec 2016 16:56:25 -0500
cloud-init (0.7.8-49-g9e904bb-0ubuntu1~16.04.1) xenial-proposed; urgency=medium
diff --git a/debian/patches/cpick-8c6878a-tests-fix-assumptions-that-expected-no-eth0-in-system b/debian/patches/cpick-8c6878a-tests-fix-assumptions-that-expected-no-eth0-in-system
new file mode 100644
index 00000000..2ec38217
--- /dev/null
+++ b/debian/patches/cpick-8c6878a-tests-fix-assumptions-that-expected-no-eth0-in-system
@@ -0,0 +1,73 @@
+commit 8c6878a04eff2fd75115b5f23faa2665cabb5ccd
+Author: Scott Moser <smoser@brickies.net>
+Date: Tue Nov 22 22:49:07 2016 -0500
+
+ tests: fix assumptions that expected no eth0 in system.
+
+ The previous commit added tests that would fail on any system that had
+ a nic named eth0 or eno1. The changes here supply the expected macs to
+ the function being tested so it does not query the system.
+
+ LP: #1644043
+
+--- a/tests/unittests/test_net.py
++++ b/tests/unittests/test_net.py
+@@ -662,25 +662,34 @@ class TestCmdlineConfigParsing(TestCase)
+
+
+ class TestCmdlineReadKernelConfig(TempDirTestCase):
++ macs = {
++ 'eth0': '14:02:ec:42:48:00',
++ 'eno1': '14:02:ec:42:48:01',
++ }
++
+ def test_ip_cmdline_read_kernel_cmdline_ip(self):
+ content = {'net-eth0.conf': DHCP_CONTENT_1}
+ populate_dir(self.tmp, content)
+ files = [os.path.join(self.tmp, k) for k in content.keys()]
+ found = cmdline.read_kernel_cmdline_config(
+- files=files, cmdline='foo ip=dhcp')
++ files=files, cmdline='foo ip=dhcp', mac_addrs=self.macs)
++ exp1 = copy.deepcopy(DHCP_EXPECTED_1)
++ exp1['mac_address'] = self.macs['eth0']
+ self.assertEqual(found['version'], 1)
+- self.assertEqual(found['config'], [DHCP_EXPECTED_1])
++ self.assertEqual(found['config'], [exp1])
+
+ def test_ip_cmdline_read_kernel_cmdline_ip6(self):
+ content = {'net6-eno1.conf': DHCP6_CONTENT_1}
+ populate_dir(self.tmp, content)
+ files = [os.path.join(self.tmp, k) for k in content.keys()]
+ found = cmdline.read_kernel_cmdline_config(
+- files=files, cmdline='foo ip6=dhcp root=/dev/sda')
++ files=files, cmdline='foo ip6=dhcp root=/dev/sda',
++ mac_addrs=self.macs)
+ self.assertEqual(
+ found,
+ {'version': 1, 'config': [
+ {'type': 'physical', 'name': 'eno1',
++ 'mac_address': self.macs['eno1'],
+ 'subnets': [
+ {'dns_nameservers': ['2001:67c:1562:8010::2:1'],
+ 'control': 'manual', 'type': 'dhcp6', 'netmask': '64'}]}]})
+@@ -691,7 +700,7 @@ class TestCmdlineReadKernelConfig(TempDi
+ populate_dir(self.tmp, content)
+ files = [os.path.join(self.tmp, k) for k in content.keys()]
+ found = cmdline.read_kernel_cmdline_config(
+- files=files, cmdline='foo root=/dev/sda')
++ files=files, cmdline='foo root=/dev/sda', mac_addrs=self.macs)
+ self.assertEqual(found, None)
+
+ def test_ip_cmdline_both_ip_ip6(self):
+@@ -700,9 +709,10 @@ class TestCmdlineReadKernelConfig(TempDi
+ populate_dir(self.tmp, content)
+ files = [os.path.join(self.tmp, k) for k in sorted(content.keys())]
+ found = cmdline.read_kernel_cmdline_config(
+- files=files, cmdline='foo ip=dhcp ip6=dhcp')
++ files=files, cmdline='foo ip=dhcp ip6=dhcp', mac_addrs=self.macs)
+
+ eth0 = copy.deepcopy(DHCP_EXPECTED_1)
++ eth0['mac_address'] = self.macs['eth0']
+ eth0['subnets'].append(
+ {'control': 'manual', 'type': 'dhcp6',
+ 'netmask': '64', 'dns_nameservers': ['2001:67c:1562:8010::2:1']})
diff --git a/debian/patches/series b/debian/patches/series
index b0362063..f55f599b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
cpick-18203bf-disk_setup-Use-sectors-as-unit-when-formatting-MBR-disks
cpick-6e92c5f-net-cmdline-Consider-ip-or-ip6-on-command-line-not-only
+cpick-8c6878a-tests-fix-assumptions-that-expected-no-eth0-in-system