Пример #1
0
 def test_create_session(self):
     self.clients("murano").sessions.configure.return_value = "sess"
     scenario = utils.MuranoScenario(context=self.context)
     create_sess = scenario._create_session("id")
     self.assertEqual("sess", create_sess)
     self._test_atomic_action_timer(scenario.atomic_actions(),
                                    "murano.create_session")
Пример #2
0
 def test_list_packages(self):
     scenario = utils.MuranoScenario()
     self.assertEqual(
         self.clients("murano").packages.list.return_value,
         scenario._list_packages())
     self._test_atomic_action_timer(scenario.atomic_actions(),
                                    "murano.list_packages")
Пример #3
0
 def test_delete_environment(self):
     environment = mock.Mock(id="id")
     self.clients("murano").environments.delete.return_value = "ok"
     scenario = utils.MuranoScenario(context=self.context)
     scenario._delete_environment(environment)
     self.clients("murano").environments.delete.assert_called_once_with(
         environment.id)
Пример #4
0
 def test_list_environments(self):
     self.clients("murano").environments.list.return_value = []
     scenario = utils.MuranoScenario(context=self.context)
     return_environments_list = scenario._list_environments()
     self.assertEqual([], return_environments_list)
     self._test_atomic_action_timer(scenario.atomic_actions(),
                                    "murano.list_environments")
Пример #5
0
 def test_delete_package(self):
     package = mock.Mock(id="package_id")
     scenario = utils.MuranoScenario()
     scenario._delete_package(package)
     self.clients("murano").packages.delete.assert_called_once_with(
         "package_id")
     self._test_atomic_action_timer(scenario.atomic_actions(),
                                    "murano.delete_package")
Пример #6
0
 def test_filter_packages(self):
     self.clients("murano").packages.filter.return_value = []
     scenario = utils.MuranoScenario()
     return_apps_list = scenario._filter_applications({"category": "Web"})
     self.assertEqual([], return_apps_list)
     self.clients("murano").packages.filter.assert_called_once_with(
         category="Web")
     self._test_atomic_action_timer(scenario.atomic_actions(),
                                    "murano.filter_applications")
Пример #7
0
 def test_create_environments(self):
     mock_create = mock.Mock(return_value="foo_env")
     self.clients("murano").environments.create = mock_create
     scenario = utils.MuranoScenario(context=self.context)
     create_env = scenario._create_environment("env_name")
     self.assertEqual("foo_env", create_env)
     mock_create.assert_called_once_with({"name": "env_name"})
     self._test_atomic_action_timer(scenario.atomic_actions(),
                                    "murano.create_environment")
Пример #8
0
 def test_update_package(self):
     package = mock.Mock(id="package_id")
     self.clients("murano").packages.update.return_value = "updated_package"
     scenario = utils.MuranoScenario()
     upd_package = scenario._update_package(package, {"tags": ["tag"]},
                                            "add")
     self.assertEqual("updated_package", upd_package)
     self.clients("murano").packages.update.assert_called_once_with(
         "package_id", {"tags": ["tag"]}, "add")
     self._test_atomic_action_timer(scenario.atomic_actions(),
                                    "murano.update_package")
Пример #9
0
 def test_import_package(self, mock_open):
     self.clients("murano").packages.create.return_value = (
         "created_foo_package")
     scenario = utils.MuranoScenario()
     mock_open.return_value = "opened_foo_package.zip"
     imp_package = scenario._import_package("foo_package.zip")
     self.assertEqual("created_foo_package", imp_package)
     self.clients("murano").packages.create.assert_called_once_with(
         {}, {"file": "opened_foo_package.zip"})
     mock_open.assert_called_once_with("foo_package.zip")
     self._test_atomic_action_timer(scenario.atomic_actions(),
                                    "murano.import_package")
Пример #10
0
    def test__create_service(self,):
        self.clients("murano").services.post.return_value = "app"
        mock_env = mock.Mock(id="ip")
        mock_sess = mock.Mock(id="ip")
        scenario = utils.MuranoScenario(context=self.context)

        create_app = scenario._create_service(mock_env, mock_sess,
                                              "fake_full_name")

        self.assertEqual("app", create_app)
        self._test_atomic_action_timer(scenario.atomic_actions(),
                                       "murano.create_service")
Пример #11
0
 def setup(self):
     for user, tenant_id in utils.iterate_per_tenants(
             self.context["users"]):
         self.context["tenants"][tenant_id]["environments"] = []
         for i in range(self.config["environments_per_tenant"]):
             murano_util = murano_utils.MuranoScenario(
                 {"user": user,
                  "task": self.context["task"],
                  "owner_id": self.context["owner_id"],
                  "config": self.context["config"]})
             env = murano_util._create_environment()
             self.context["tenants"][tenant_id]["environments"].append(env)
Пример #12
0
    def test_create_environments(self):
        self.clients("murano").environments.create = mock.Mock()
        scenario = utils.MuranoScenario(context=self.context)
        scenario.generate_random_name = mock.Mock()

        create_env = scenario._create_environment()
        self.assertEqual(
            create_env,
            self.clients("murano").environments.create.return_value)
        self.clients("murano").environments.create.assert_called_once_with(
            {"name": scenario.generate_random_name.return_value})
        self._test_atomic_action_timer(scenario.atomic_actions(),
                                       "murano.create_environment")
Пример #13
0
    def test_delete_environment(self):
        environment = mock.Mock(id="id")
        self.clients("murano").environments.delete.return_value = "ok"
        scenario = utils.MuranoScenario()
        scenario._delete_environment(environment)
        self.clients("murano").environments.delete.assert_called_once_with(
            environment.id)

        self.wait_for_delete.mock.assert_called_once_with(
            environment,
            update_resource=self.gfm(),
            timeout=180,
            check_interval=2)
        self._test_atomic_action_timer(scenario.atomic_actions(),
                                       "murano.delete_environment")
Пример #14
0
    def test_deploy_environment(self):
        environment = mock.Mock(id="id")
        session = mock.Mock(id="id")
        self.clients("murano").sessions.deploy.return_value = "ok"
        scenario = utils.MuranoScenario()
        scenario._deploy_environment(environment, session)

        self.clients("murano").sessions.deploy.assert_called_once_with(
            environment.id, session.id)

        self.wait_for.mock.assert_called_once_with(environment,
                                                   update_resource=self.gfm(),
                                                   is_ready=self.res_is.mock(),
                                                   check_interval=5.0,
                                                   timeout=1200.0)
        self._test_atomic_action_timer(scenario.atomic_actions(),
                                       "murano.deploy_environment")
Пример #15
0
    def test_delete_environment(self):
        environment = mock.Mock(id="id")
        self.clients("murano").environments.delete.return_value = "ok"
        scenario = utils.MuranoScenario(context=self.context)
        scenario._delete_environment(environment)
        self.clients("murano").environments.delete.assert_called_once_with(
            environment.id
        )

        config = CONF.benchmark
        self.mock_wait_for_delete.mock.assert_called_once_with(
            environment,
            update_resource=self.mock_get_from_manager.mock.return_value,
            timeout=config.murano_delete_environment_timeout,
            check_interval=config.murano_delete_environment_check_interval)
        self.mock_get_from_manager.mock.assert_called_once_with()
        self._test_atomic_action_timer(scenario.atomic_actions(),
                                       "murano.delete_environment")
Пример #16
0
    def test_deploy_environment(self):
        environment = mock.Mock(id="id")
        session = mock.Mock(id="id")
        self.clients("murano").sessions.deploy.return_value = "ok"
        scenario = utils.MuranoScenario(context=self.context)
        scenario._deploy_environment(environment, session)

        self.clients("murano").sessions.deploy.assert_called_once_with(
            environment.id, session.id)

        config = CONF.openstack
        self.mock_wait_for_status.mock.assert_called_once_with(
            environment,
            update_resource=self.mock_get_from_manager.mock.return_value,
            ready_statuses=["READY"],
            check_interval=config.murano_deploy_environment_check_interval,
            timeout=config.murano_deploy_environment_timeout)
        self.mock_get_from_manager.mock.assert_called_once_with(
            ["DEPLOY FAILURE"])
        self._test_atomic_action_timer(scenario.atomic_actions(),
                                       "murano.deploy_environment")