Merge "Fix compute scope test bug"

This commit is contained in:
Zuul 2018-01-18 09:37:24 +00:00 committed by Gerrit Code Review
commit bfe3c28986
2 changed files with 7 additions and 3 deletions

View File

@ -14,7 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
fake_scope_1 = [{'compute': [{'availability_zones': [{'name': 'AZ1'}]},
fake_scope_1 = [{'compute': [{'availability_zones': [{'name': 'AZ1'},
{'name': 'AZ3'}]},
{'exclude': [
{'instances': [
{'uuid': 'INSTANCE_6'}]},

View File

@ -40,10 +40,13 @@ class TestComputeScope(base.TestCase):
mock_zone_list.return_value = [
mock.Mock(zone='AZ{0}'.format(i),
host={'Node_{0}'.format(i): {}})
for i in range(2)]
for i in range(4)]
model = compute.ComputeScope(audit_scope, mock.Mock(),
osc=mock.Mock()).get_scoped_model(cluster)
expected_edges = [('INSTANCE_2', 'Node_1')]
# NOTE(adisky):INSTANCE_6 is not excluded from model it will be tagged
# as 'exclude' TRUE, blueprint compute-cdm-include-all-instances
expected_edges = [('INSTANCE_2', 'Node_1'), (u'INSTANCE_6', u'Node_3')]
self.assertEqual(sorted(expected_edges), sorted(model.edges()))
@mock.patch.object(nova_helper.NovaHelper, 'get_service_list')