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 <zhangchi@szzt.com.cn>
co-Authored-By: tangzhuo <ztang@hnu.edu.cn>
This commit is contained in:
zhangchi 2019-06-25 11:52:09 +08:00 committed by Zhang Chi
parent d4f9efb111
commit 1cc14e53ae
4 changed files with 3 additions and 96 deletions

View File

@ -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):

View File

@ -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())

View File

@ -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())

View File

@ -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()