Fix timing test error when rebalancing
The reported timing can be 00:59:59 sometimes, but is still valid. This will fail in the tests, as seen in [1]. This patch fixes this by mocking the current time, ensuring that the first two rebalances happen at the same time. [1] http://logs.openstack.org/97/337297/32/check/gate-swift-python27-ubuntu-xenial/46203f1/console.html#_2017-02-08_07_28_42_589176 Change-Id: I0fd43d5bb13d0e88126f4f6ba14fb87faab6df9c
This commit is contained in:
parent
38cebabbeb
commit
67d545e90f
@ -1889,9 +1889,9 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
||||
|
||||
def test_time_remaining(self):
|
||||
self.create_sample_ring()
|
||||
self.run_srb('rebalance')
|
||||
now = time.time()
|
||||
with mock.patch('swift.common.ring.builder.time', return_value=now):
|
||||
self.run_srb('rebalance')
|
||||
out, err = self.run_srb('rebalance')
|
||||
self.assertIn('No partitions could be reassigned', out)
|
||||
self.assertIn('must be at least min_part_hours', out)
|
||||
|
Loading…
Reference in New Issue
Block a user