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://paste.openstack.org/show/603845/
Change-Id: I0fd43d5bb13d0e88126f4f6ba14fb87faab6df9c
(cherry picked from commit 67d545e90f
)
This commit is contained in:
parent
735c99fad2
commit
41d90db966
|
@ -1888,9 +1888,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