Files
nova-solver-scheduler/nova_solverscheduler/tests/scheduler/solvers/constraints/test_no_constraint.py
Xinyuan Huang 6c3c0fc8ff Move solver-scheduler's top directory from 'nova' to 'nova_solverscheduler'
The nova solver scheduler was designed to be a drop-in patch for nova, and it
uses 'nova' as the directory now, however it's easier to manage the project
as an individual python package, therefore we want to move the top directory
out to a separate one, which is called 'nova_solverscheduler'. This patch
will modify the module import dependencies and also add necessary init files
so as to turn the project into a complete python package.

Change-Id: I62550c84f157db398da5edbef514832e1351f66f
2015-05-16 18:05:55 -07:00

44 lines
1.7 KiB
Python

# Copyright (c) 2014 Cisco Systems, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from nova import test
from nova_solverscheduler.scheduler.solvers.constraints import no_constraint
from nova_solverscheduler.tests.scheduler import solver_scheduler_fakes \
as fakes
class TestNoConstraint(test.NoDBTestCase):
def setUp(self):
super(TestNoConstraint, self).setUp()
self.constraint_cls = no_constraint.NoConstraint
self._generate_fake_constraint_input()
def _generate_fake_constraint_input(self):
self.fake_filter_properties = {
'instance_uuids': ['fake_uuid_%s' % x for x in range(3)],
'num_instances': 3}
host1 = fakes.FakeSolverSchedulerHostState('host1', 'node1', {})
host2 = fakes.FakeSolverSchedulerHostState('host2', 'node1', {})
self.fake_hosts = [host1, host2]
def test_get_constraint_matrix(self):
expected_cons_mat = [
[True, True, True],
[True, True, True]]
cons_mat = self.constraint_cls().get_constraint_matrix(
self.fake_hosts, self.fake_filter_properties)
self.assertEqual(expected_cons_mat, cons_mat)