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

Proposed by Robert Schweikert
Status: Merged
Approved by: Scott Moser
Approved revision: 8e89c563392c29f1f1d0e2158e5472fb13cb9c91
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~rjschwei/cloud-init:noHostBleedForMirrorTest
Merge into: cloud-init:master
Diff against target: 14 lines (+2/-1)
1 file modified
tests/unittests/test_handler/ (+2/-1)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Ryan Harper Approve
Review via email:

Commit message

tests: Add mock for util.get_hostname.

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.

LP: #1792799

Description of the change

Add mock for util.get_hostname()

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:8e89c563392c29f1f1d0e2158e5472fb13cb9c91
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:

review: Approve (continuous-integration)
Revision history for this message
Ryan Harper (raharper) wrote :

s_mirror = "s_hit"


review: Approve
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

Commit message lints:
 - Line #2 has 103 too many characters. Line starts with: "At present the host network"...

review: Needs Fixing
Revision history for this message
Server Team CI bot (server-team-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/tests/unittests/test_handler/ b/tests/unittests/test_handler/
2index a81c67c..90fe6ee 100644
3--- a/tests/unittests/test_handler/
4+++ b/tests/unittests/test_handler/
5@@ -949,7 +949,8 @@ deb xenial-proposed main""")
6 self.assertEqual(
7 orig, cc_apt_configure.disable_suites(["proposed"], orig, rel))
9- def test_apt_v3_mirror_search_dns(self):
10+ @mock.patch("cloudinit.util.get_hostname", return_value='abc.localdomain')
11+ def test_apt_v3_mirror_search_dns(self, m_get_hostname):
12 """test_apt_v3_mirror_search_dns - Test searching dns patterns"""
13 pmir = "phit"
14 smir = "shit"


People subscribed via source and target branches