Browse Source

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>
changes/62/667262/3
zhangchi 1 year ago
committed by Zhang Chi
parent
commit
1cc14e53ae
4 changed files with 3 additions and 96 deletions
  1. +1
    -1
      tricircle/db/core.py
  2. +1
    -1
      tricircle/tests/functional/api/controllers/test_job.py
  3. +1
    -1
      tricircle/tests/functional/api/controllers/test_pod.py
  4. +0
    -93
      tricircle/tests/unit/network/test_central_plugin.py

+ 1
- 1
tricircle/db/core.py 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):


+ 1
- 1
tricircle/tests/functional/api/controllers/test_job.py 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())


+ 1
- 1
tricircle/tests/functional/api/controllers/test_pod.py 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())


+ 0
- 93
tricircle/tests/unit/network/test_central_plugin.py 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()


Loading…
Cancel
Save