Merge "Refresh instance after adding allocation"

This commit is contained in:
Zuul 2021-06-04 10:56:01 +00:00 committed by Gerrit Code Review
commit b2d9f0d80a
2 changed files with 8 additions and 2 deletions

View File

@ -483,6 +483,9 @@ def check_existing(instances, provisioner, baremetal):
node=request['name'] node=request['name']
) )
# Refresh the instance after adding the allocation
# See: https://bugs.launchpad.net/tripleo/+bug/1929555
instance = provisioner.show_instance(instance.uuid)
found.append(instance) found.append(instance)
return found, not_found, unmanaged return found, not_found, unmanaged

View File

@ -1094,7 +1094,8 @@ class TestCheckExistingInstances(base.TestCase):
self.assertEqual([], not_found) self.assertEqual([], not_found)
self.assertEqual([existing], found) self.assertEqual([existing], found)
pr.show_instance.assert_called_once_with('server2') pr.show_instance.assert_has_calls([mock.call('server2'),
mock.call(existing.uuid)])
def test_hostname_mismatch(self): def test_hostname_mismatch(self):
pr = mock.Mock() pr = mock.Mock()
@ -1136,7 +1137,9 @@ class TestCheckExistingInstances(base.TestCase):
self.assertEqual([], not_found) self.assertEqual([], not_found)
self.assertEqual([existing], found) self.assertEqual([existing], found)
pr.show_instance.assert_called_once_with('bm_node1') self.assertEqual(2, pr.show_instance.call_count)
pr.show_instance.assert_has_calls([mock.call('bm_node1'),
mock.call(existing.uuid)])
def test_hostname_mismatch_and_instance_info_display_name_mismatch(self): def test_hostname_mismatch_and_instance_info_display_name_mismatch(self):
pr = mock.Mock() pr = mock.Mock()