~anso/nova/factorycleanup

« back to all changes in this revision

Viewing changes to nova/tests/test_cloud.py

  • Committer: Todd Willey
  • Date: 2011-01-17 18:51:00 UTC
  • mfrom: (524.1.12 wsgirouter)
  • Revision ID: todd@ansolabs.com-20110117185100-d38jerwbg8wzeg4k
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from M2Crypto import BIO
22
22
from M2Crypto import RSA
23
23
import os
 
24
import shutil
24
25
import tempfile
25
26
import time
26
27
 
50
51
os.makedirs(IMAGES_PATH)
51
52
 
52
53
 
 
54
# TODO(termie): these tests are rather fragile, they should at the lest be
 
55
#               wiping database state after each run
53
56
class CloudTestCase(test.TestCase):
54
57
    def setUp(self):
55
58
        super(CloudTestCase, self).setUp()
287
290
        db.service_destroy(self.context, comp1['id'])
288
291
 
289
292
    def test_instance_update_state(self):
 
293
        # TODO(termie): what is this code even testing?
290
294
        def instance(num):
291
295
            return {
292
296
                'reservation_id': 'r-1',
305
309
                'state': 0x01,
306
310
                'user_data': ''}
307
311
        rv = self.cloud._format_describe_instances(self.context)
308
 
        self.assert_(len(rv['reservationSet']) == 0)
 
312
        logging.error(str(rv))
 
313
        self.assertEqual(len(rv['reservationSet']), 0)
309
314
 
310
315
        # simulate launch of 5 instances
311
316
        # self.cloud.instances['pending'] = {}
368
373
        self.assertEqual('Foo Img', img.metadata['description'])
369
374
        self._fake_set_image_description(self.context, 'ami-testing', '')
370
375
        self.assertEqual('', img.metadata['description'])
 
376
        shutil.rmtree(pathdir)
371
377
 
372
378
    def test_update_of_instance_display_fields(self):
373
379
        inst = db.instance_create(self.context, {})