~free.ekanayaka/landscape-client/jaunty-proposed

« back to all changes in this revision

Viewing changes to landscape/monitor/tests/test_computerinfo.py

  • Committer: Bazaar Package Importer
  • Author(s): Free Ekanayaka
  • Date: 2009-09-21 17:59:31 UTC
  • mfrom: (1.2.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090921175931-4ucv40j9ro26i3lm
Tags: 1.3.2.3-0ubuntu0.9.04.0
* New upstream release (LP: #347983):
  - Don't clear the hash_id_requests table upon resynchronize (LP #417122)
  - Include the README file in landscape-client (LP: #396260)
  - Fix client capturing stderr from run_command when constructing
    hash-id-databases url (LP: #397480)
  - Use substvars to conditionally depend on update-motd or
    libpam-modules (LP: #393454)
  - Fix reporting wrong version to the server (LP: #391225)
  - The init script does not wait for the network to be available
    before checking for EC2 user data (LP: #383336)
  - When the broker is restarted by the watchdog, the state of the client
    is inconsistent (LP: #380633)
  - Package stays unknown forever in the client with hash-id-databases
    support (LP: #381356)
  - Standard error not captured when calling smart-update (LP: #387441)
  - Changer calls reporter without switching groups, just user (LP: #388092)
  - Run smart update in the package-reporter instead of having a cronjob (LP: #362355)
  - Package changer does not inherit proxy settings (LP: #381241)
  - The ./test script doesn't work in landscape-client (LP: #381613)
  - The source package should build on all supported releases (LP: #385098)
  - Strip smart update's output (LP: #387331)
  - The fetch() timeout isn't based on activity (#389224)
  - Client can use a UUID of "None" when fetching the hash-id-database (LP: #381291)
  - Registration should use the fqdn rather than just the hostname (LP: #385730)

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
from landscape.tests.mocker import ANY
6
6
 
7
7
 
8
 
def get_hostname():
9
 
    return "ooga"
 
8
def get_fqdn():
 
9
    return "ooga.local"
10
10
 
11
11
 
12
12
class ComputerInfoTest(LandscapeTest):
48
48
DISTRIB_DESCRIPTION="Ubuntu 6.06.1 LTS"
49
49
""")
50
50
 
51
 
    def test_get_hostname(self):
 
51
    def test_get_fqdn(self):
52
52
        self.mstore.set_accepted_types(["computer-info"])
53
 
        plugin = ComputerInfo(get_hostname=get_hostname,
 
53
        plugin = ComputerInfo(get_fqdn=get_fqdn,
54
54
                              lsb_release_filename=self.lsb_release_filename)
55
55
        self.monitor.add(plugin)
56
56
        plugin.exchange()
57
57
        messages = self.mstore.get_pending_messages()
58
58
        self.assertEquals(len(messages), 1)
59
59
        self.assertEquals(messages[0]["type"], "computer-info")
60
 
        self.assertEquals(messages[0]["hostname"], "ooga")
 
60
        self.assertEquals(messages[0]["hostname"], "ooga.local")
61
61
 
62
62
    def test_get_real_hostname(self):
63
63
        self.mstore.set_accepted_types(["computer-info"])
72
72
 
73
73
    def test_only_report_changed_hostnames(self):
74
74
        self.mstore.set_accepted_types(["computer-info"])
75
 
        plugin = ComputerInfo(get_hostname=get_hostname)
 
75
        plugin = ComputerInfo(get_fqdn=get_fqdn)
76
76
        self.monitor.add(plugin)
77
77
        plugin.exchange()
78
78
        messages = self.mstore.get_pending_messages()
89
89
                i = i + 1
90
90
 
91
91
        self.mstore.set_accepted_types(["computer-info"])
92
 
        plugin = ComputerInfo(get_hostname=hostname_factory().next)
 
92
        plugin = ComputerInfo(get_fqdn=hostname_factory().next)
93
93
        self.monitor.add(plugin)
94
94
 
95
95
        plugin.exchange()
270
270
        """
271
271
        self.mstore.set_accepted_types(["distribution-info", "computer-info"])
272
272
        meminfo_filename = self.make_path(self.sample_memory_info)
273
 
        plugin = ComputerInfo(get_hostname=get_hostname,
 
273
        plugin = ComputerInfo(get_fqdn=get_fqdn,
274
274
                              meminfo_file=meminfo_filename,
275
275
                              lsb_release_filename=self.lsb_release_filename)
276
276
        self.monitor.add(plugin)
277
277
        plugin.exchange()
278
278
        self.reactor.fire("resynchronize")
279
279
        plugin.exchange()
280
 
        computer_info = {"type": "computer-info", "hostname": "ooga",
 
280
        computer_info = {"type": "computer-info", "hostname": "ooga.local",
281
281
                         "timestamp": 0, "total-memory": 1510,
282
282
                         "total-swap": 1584}
283
283
        dist_info = {"type": "distribution-info",