← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~rjschwei/cloud-init:noHostBleedForMirrorTest into cloud-init:master

 

Robert Schweikert has proposed merging ~rjschwei/cloud-init:noHostBleedForMirrorTest into cloud-init:master.

Commit message:
At present the host network settings bleed into the test environment causing the test test_handler_apt_source_v3 to fail if the host has a domain setting other then localdomain. This addresses lp#1792799

Requested reviews:
  cloud-init commiters (cloud-init-dev)
Related bugs:
  Bug #1792799 in cloud-init: "Host environment bleeds into test for mirror access testing"
  https://bugs.launchpad.net/cloud-init/+bug/1792799

For more details, see:
https://code.launchpad.net/~rjschwei/cloud-init/+git/cloud-init/+merge/355009

Add mock for util.get_hostname()
-- 
Your team cloud-init commiters is requested to review the proposed merge of ~rjschwei/cloud-init:noHostBleedForMirrorTest into cloud-init:master.
diff --git a/tests/unittests/test_handler/test_handler_apt_source_v3.py b/tests/unittests/test_handler/test_handler_apt_source_v3.py
index a81c67c..90fe6ee 100644
--- a/tests/unittests/test_handler/test_handler_apt_source_v3.py
+++ b/tests/unittests/test_handler/test_handler_apt_source_v3.py
@@ -949,7 +949,8 @@ deb http://ubuntu.com/ubuntu/ xenial-proposed main""")
         self.assertEqual(
             orig, cc_apt_configure.disable_suites(["proposed"], orig, rel))
 
-    def test_apt_v3_mirror_search_dns(self):
+    @mock.patch("cloudinit.util.get_hostname", return_value='abc.localdomain')
+    def test_apt_v3_mirror_search_dns(self, m_get_hostname):
         """test_apt_v3_mirror_search_dns - Test searching dns patterns"""
         pmir = "phit"
         smir = "shit"

Follow ups