/heat/tests/convergence/test_converge.py

https://gitlab.com/unofficial-mirrors/openstack-heat
Python | 42 lines | 23 code | 6 blank | 13 comment | 1 complexity | fbf1f4fcf3432f42c7212648e6f44306 MD5 | raw file
  1. #!/usr/bin/env python
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  4. # not use this file except in compliance with the License. You may obtain
  5. # a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  11. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  12. # License for the specific language governing permissions and limitations
  13. # under the License.
  14. from heat.engine import resource
  15. from heat.tests import common
  16. from heat.tests.convergence.framework import fake_resource
  17. from heat.tests.convergence.framework import processes
  18. from heat.tests.convergence.framework import scenario
  19. from heat.tests.convergence.framework import testutils
  20. from oslo_config import cfg
  21. class ScenarioTest(common.HeatTestCase):
  22. scenarios = [(name, {'name': name, 'path': path})
  23. for name, path in scenario.list_all()]
  24. def setUp(self):
  25. super(ScenarioTest, self).setUp()
  26. resource._register_class('OS::Heat::TestResource',
  27. fake_resource.TestResource)
  28. self.procs = processes.Processes()
  29. po = self.patch("heat.rpc.worker_client.WorkerClient.check_resource")
  30. po.side_effect = self.procs.worker.check_resource
  31. cfg.CONF.set_default('convergence_engine', True)
  32. def test_scenario(self):
  33. self.procs.clear()
  34. runner = scenario.Scenario(self.name, self.path)
  35. runner(self.procs.event_loop,
  36. **testutils.scenario_globals(self.procs, self))