Cope with interface change where interface passes back all values for key from conversation not just the first

This commit is contained in:
Liam Young 2016-07-08 14:46:27 +01:00
parent d63b5b5a99
commit bbbd9e8d10
2 changed files with 5 additions and 3 deletions

View File

@ -397,7 +397,9 @@ class DesignateBindCharm(openstack_charm.OpenStackCharm):
request_time = None
if cluster_relation:
request_time = cluster_relation.retrieve_local(CLUSTER_SYNC_KEY)
request_times = list(set(
cluster_relation.retrieve_local(CLUSTER_SYNC_KEY)))
request_time = request_times[0]
sync_time = DesignateBindCharm.get_sync_time()
if request_time and request_time > sync_time:
hookenv.log(('Request for sync sent but remote sync time is too'

View File

@ -388,13 +388,13 @@ class TestDesignateBindCharm(Helper):
mock.call('start', ['bind9'])]
a = designate_bind.DesignateBindCharm()
# Using cluster_relation, no sync needed
relation.retrieve_local.return_value = '30'
relation.retrieve_local.return_value = ['30']
self.get_sync_time.return_value = '20'
a.retrieve_zones(relation)
self.assertFalse(self.service_control.called)
# Using cluster_relation, sync needed
self.service_control.reset_mock()
relation.retrieve_local.return_value = '10'
relation.retrieve_local.return_value = ['10']
self.get_sync_time.return_value = '20'
a.retrieve_zones(relation)
self.service_control.assert_has_calls(ctrl_calls)