~ubuntu-branches/ubuntu/trusty/swift/trusty-updates

« back to all changes in this revision

Viewing changes to test/unit/common/middleware/test_recon.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2013-01-28 09:40:30 UTC
  • mfrom: (1.2.16)
  • Revision ID: package-import@ubuntu.com-20130128094030-aetz57x2qz9ye2d4
Tags: 1.7.6-0ubuntu1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
388
388
                                    "remove": 0, "rsync": 0,
389
389
                                    "start": 1333044050.855202,
390
390
                                    "success": 2, "ts_repl": 0 },
391
 
                               "replication_time": 0.2615511417388916}
 
391
                               "replication_time": 0.2615511417388916,
 
392
                               "replication_last": 1357969645.25}
392
393
        self.fakecache.fakeout = from_cache_response
393
394
        rv = self.app.get_replication_info('account')
394
395
        self.assertEquals(self.fakecache.fakeout_calls,
395
 
                            [((['replication_time', 'replication_stats'],
 
396
                            [((['replication_time', 'replication_stats',
 
397
                                'replication_last'],
396
398
                                '/var/cache/swift/account.recon'), {})])
397
399
        self.assertEquals(rv, {"replication_stats": {
398
400
                                    "attempted": 1, "diff": 0,
402
404
                                    "remove": 0, "rsync": 0,
403
405
                                    "start": 1333044050.855202,
404
406
                                    "success": 2, "ts_repl": 0 },
405
 
                                "replication_time": 0.2615511417388916})
 
407
                                "replication_time": 0.2615511417388916,
 
408
                                "replication_last": 1357969645.25})
406
409
 
407
410
    def test_get_replication_info_container(self):
408
411
        from_cache_response = {"replication_time": 200.0,
413
416
                                    "no_change": 358, "remote_merge": 0,
414
417
                                    "remove": 0, "rsync": 0,
415
418
                                    "start": 5.5, "success": 358,
416
 
                                    "ts_repl": 0}}
 
419
                                    "ts_repl": 0},
 
420
                               "replication_last": 1357969645.25}
417
421
        self.fakecache.fakeout_calls = []
418
422
        self.fakecache.fakeout = from_cache_response
419
423
        rv = self.app.get_replication_info('container')
420
424
        self.assertEquals(self.fakecache.fakeout_calls,
421
 
                            [((['replication_time', 'replication_stats'],
 
425
                            [((['replication_time', 'replication_stats',
 
426
                                'replication_last'],
422
427
                                '/var/cache/swift/container.recon'), {})])
423
428
        self.assertEquals(rv, {"replication_time": 200.0,
424
429
                               "replication_stats": {
428
433
                                    "no_change": 358, "remote_merge": 0,
429
434
                                    "remove": 0, "rsync": 0,
430
435
                                    "start": 5.5, "success": 358,
431
 
                                    "ts_repl": 0}})
 
436
                                    "ts_repl": 0},
 
437
                               "replication_last": 1357969645.25})
432
438
 
433
439
    def test_get_replication_object(self):
434
 
        from_cache_response = {"object_replication_time": 200.0}
 
440
        from_cache_response = {"object_replication_time": 200.0,
 
441
                               "object_replication_last": 1357962809.15}
435
442
        self.fakecache.fakeout_calls = []
436
443
        self.fakecache.fakeout = from_cache_response
437
444
        rv = self.app.get_replication_info('object')
438
445
        self.assertEquals(self.fakecache.fakeout_calls,
439
 
                            [((['object_replication_time'],
 
446
                            [((['object_replication_time',
 
447
                                'object_replication_last'],
440
448
                                '/var/cache/swift/object.recon'), {})])
441
 
        self.assertEquals(rv, {'object_replication_time': 200.0})
 
449
        self.assertEquals(rv, {'object_replication_time': 200.0,
 
450
                               'object_replication_last': 1357962809.15})
442
451
 
443
452
    def test_get_updater_info_container(self):
444
453
        from_cache_response = {"container_updater_sweep": 18.476239919662476}