~ahasenack/landscape-client/landscape-client-11.02-0ubuntu0.10.10.1

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Free Ekanayaka
  • Date: 2010-04-21 19:58:10 UTC
  • mfrom: (1.1.16 upstream)
  • Revision ID: james.westby@ubuntu.com-20100421195810-s30uv3s6i27lue38
Tags: 1.5.2-0ubuntu0.10.10.0
* New upstream version (LP: #594594):
  - A new includes information about active network devices and their
    IP address in sysinfo output (LP: #272344).
  - A new plugin collects information about network traffic (#LP :284662).
  - Report information about which packages requested a reboot (LP: #538253).
  - Fix breakage on Lucid AMIs having no ramdisk (LP: #574810).
  - Migrate the inter-process communication system from DBus to Twisted AMP.

Show diffs side-by-side

added added

removed removed

Lines of Context:
332
332
        self.assertTrue("update-processes" in message)
333
333
        self.assertEquals(message["update-processes"][0]["state"], u"Z")
334
334
 
335
 
 
336
335
    def test_call_on_accepted(self):
337
336
        """
338
337
        L{MonitorPlugin}-based plugins can provide a callable to call
342
341
                                   jiffies=10)
343
342
        self.monitor.add(plugin)
344
343
        self.assertEquals(len(self.mstore.get_pending_messages()), 0)
345
 
        self.broker_service.reactor.fire(("message-type-acceptance-changed",
346
 
                                          "active-process-info"), True)
347
 
        self.assertEquals(len(self.mstore.get_pending_messages()), 1)
 
344
        result = self.monitor.fire_event(
 
345
            "message-type-acceptance-changed", "active-process-info", True)
 
346
 
 
347
        def assert_messages(ignored):
 
348
            self.assertEquals(len(self.mstore.get_pending_messages()), 1)
 
349
 
 
350
        result.addCallback(assert_messages)
 
351
        return result
348
352
 
349
353
    def test_resynchronize_event(self):
350
354
        """
410
414
        expected_messages.extend(expected_messages)
411
415
        self.assertMessages(messages, expected_messages)
412
416
 
413
 
 
414
417
    def test_do_not_persist_changes_when_send_message_fails(self):
415
418
        """
416
419
        When the plugin is run it persists data that it uses on
418
421
        only persist data when the broker confirms that the message
419
422
        sent by the plugin has been sent.
420
423
        """
421
 
        class MyException(Exception): pass
 
424
 
 
425
        class MyException(Exception):
 
426
            pass
 
427
 
422
428
        self.log_helper.ignore_errors(MyException)
423
429
 
424
430
        self.builder.create_data(672, self.builder.RUNNING,
484
490
                                       {"timestamp": 0,
485
491
                                        "api": SERVER_API,
486
492
                                        "type": "active-process-info",
487
 
                                        "update-processes": [{"start-time": 110,
488
 
                                                              "name": u"init",
489
 
                                                              "pid": 1,
490
 
                                                              "percent-cpu": 0.0,
491
 
                                                              "state": "R",
492
 
                                                              "gid": 0,
493
 
                                                              "vm-size": 20000,
494
 
                                                              "uid": 0}]}])
 
493
                                        "update-processes": [
 
494
                                            {"start-time": 110,
 
495
                                             "name": u"init",
 
496
                                             "pid": 1,
 
497
                                             "percent-cpu": 0.0,
 
498
                                             "state": "R",
 
499
                                             "gid": 0,
 
500
                                             "vm-size": 20000,
 
501
                                             "uid": 0}]}])
 
502
 
495
503
 
496
504
class PluginManagerIntegrationTest(LandscapeTest):
497
505