Fix compute scope test bug

We were excluding 'INSTANCE_6'from scope, which belongs to 'NODE_3'
in scenerio_1.xml [1]. But NODE_3 is removed from model before only
as it is not in scope.

So, This Patch adds 'AZ3' in fake_scope.

[1] https://github.com/openstack/watcher/blob/master/watcher/tests/decision_engine/model/data/scenario_1.xml
Closes-Bug: #1737901

Change-Id: Ib1aaca7045908418ad0c23b718887cd89db98a83
This commit is contained in:
aditi 2018-01-12 15:41:11 +05:30
parent 7297603f65
commit 354ebd35cc
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')