~free.ekanayaka/landscape-client/jaunty-1.5.2-0ubuntu0.9.04.0

« back to all changes in this revision

Viewing changes to landscape/manager/tests/test_eucalyptus.py

  • Committer: Free Ekanayaka
  • Date: 2010-06-16 10:01:20 UTC
  • Revision ID: free.ekanayaka@canonical.com-20100616100120-k185twz19yf1qqmh
* 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:
3
3
from twisted.internet.defer import succeed, fail
4
4
 
5
5
try:
6
 
    from imagestore.eucaservice import FakeEucaInfo
 
6
    from imagestore.eucaservice import FakeEucaInfo, EucaToolsError
7
7
except ImportError:
8
8
    FakeEucaInfo = None
9
9
 
187
187
        Eucalyptus, such as the C{imagestore} package not being available, an
188
188
        error message is sent to the server.
189
189
        """
 
190
        plugin = self.get_plugin(fail(ZeroDivisionError("KABOOM!")))
190
191
 
191
192
        def check(ignore):
 
193
            self.assertTrue(plugin.enabled)
192
194
            error_message = (
193
195
                "Traceback (failure with no frames): "
194
196
                "<type 'exceptions.ZeroDivisionError'>: KABOOM!\n")
198
200
                self.broker_service.message_store.get_pending_messages(),
199
201
                [expected])
200
202
 
201
 
        plugin = self.get_plugin(fail(ZeroDivisionError("KABOOM!")))
 
203
        self.assertTrue(plugin.enabled)
 
204
        deferred = plugin.run()
 
205
        deferred.addCallback(check)
 
206
        return deferred
 
207
 
 
208
    def test_run_with_euca_tools_failure_message(self):
 
209
        """
 
210
        If a L{EucaToolsError} is raised when the plugin is run, it is
 
211
        disabled.
 
212
        """
 
213
        plugin = self.get_plugin(fail(EucaToolsError("KABOOM!")))
 
214
 
 
215
        def check(ignore):
 
216
            self.assertFalse(plugin.enabled)
 
217
            error_message = (
 
218
                "Traceback (failure with no frames): "
 
219
                "<class 'imagestore.eucaservice.EucaToolsError'>: KABOOM!\n")
 
220
            expected = {"type": "eucalyptus-info-error",
 
221
                        "error": error_message}
 
222
            self.assertMessages(
 
223
                self.broker_service.message_store.get_pending_messages(),
 
224
                [expected])
 
225
 
 
226
        self.assertTrue(plugin.enabled)
202
227
        deferred = plugin.run()
203
228
        deferred.addCallback(check)
204
229
        return deferred
221
246
        skip_message = "imagestore module not available"
222
247
        test_failed_run_stops_service_hub.skip = skip_message
223
248
        test_run_with_failure_message.skip = skip_message
 
249
        test_run_with_euca_tools_failure_message = skip_message
224
250
        test_run_with_successful_message.skip = skip_message
225
251
        test_successful_run_stops_service_hub.skip = skip_message
226
252