-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Caracal] Adapt Tox and Github Workflow & [Caracal] Fix Unit Tests #120
base: stable/2024.1-m3
Are you sure you want to change the base?
Conversation
d59dc64
to
c385243
Compare
c385243
to
fe3d820
Compare
Adapt github workflow python version and branch to the Caracal/2024.1 release. With later versions of pecan, WebTest is not a dependency of it anymore, so in order to continue using this, an additional import in test-requirements is required.
fe3d820
to
d8dd076
Compare
self.assertEqual("10.100.1.2-10.100.1.5/24", router_atts.dynamic_nat_pool) | ||
|
||
with mock.patch.object(ASR1KPluginBase, 'ensure_default_route_skip_monitoring', autospec=True): | ||
upd_router = self._remove_external_gateway_from_router(router['router']['id'], None) | ||
# upd_router = self._remove_external_gateway_from_router(router['router']['id'], None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the commted out call? I think we can remove it, right?
With the Caracal release, default policies are activated by default causing our tests to fail error 'PolicyNotAuthorized'. Simply running them as admin fixes the issue.
d8dd076
to
39ecc03
Compare
8236a38
to
14fb740
Compare
agent_host=self.agent_host, | ||
port_id=self.port_id, | ||
segment_id=self.segment_id | ||
).first() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be indented to the same level.
@@ -684,25 +713,27 @@ def __init__(self, context, router_id, port, segment): | |||
|
|||
@property | |||
def _record_exists(self): | |||
entry = self.session.query(asr1k_models.ASR1KExtraAttsModel).filter_by(router_id=self.router_id, | |||
with db_api.CONTEXT_READER.using(self.context): | |||
entry = self.context.query(asr1k_models.ASR1KExtraAttsModel).filter_by(router_id=self.router_id, | |||
agent_host=self.agent_host, | |||
port_id=self.port_id, | |||
segment_id=self.segment_id | |||
).first() | |||
return entry is not None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be indented into the with
, I think.
if len(second_dot1qs_available) == 0: | ||
raise asr1k_exceptions.SecondDot1QPoolExhausted(agent_host=self.agent_host) | ||
self.second_dot1q = random.choice(second_dot1qs_available) | ||
with db_api.CONTEXT_READER.using(self.context): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be a decorator.
).first() | ||
if entry: | ||
entry.update(extra_att) | ||
with db_api.CONTEXT_WRITER.using(context): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be a decorator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to make this work with a decorate the contest must be passed as parameter
@db_api.CONTEXT_READER
def set_next_entries(self, context):
extra_atts = context.query(asr1k_models.ASR1KExtraAttsModel).filter_by(agent_host=self.agent_host)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my suggestion is to leave it as is
As per blueprint [1], the existing use of oslo_db session handling (e.g., context.session.begin()) introduces potential issues. Notably, unit tests failed during the Caracal release, though no definitive deployment impact has been identified yet. To future-proof the code and align with recommended practices, we are migrating to the enginefacade pattern now. This involves replacing: with context.session.begin(): context.session.add(obj) with 'db_api.CONTEXT_WRITER.using(context)' [1] https://blueprints.launchpad.net/neutron/+spec/enginefacade-switch [2] Oslo db spec: http://specs.openstack.org/openstack/oslo-specs/specs/kilo/make-enginefacade-a-facade.html
14fb740
to
41a0a10
Compare
[Caracal] Adapt Tox and Github Workflow
Adapt github workflow python version and branch to the Caracal/2024.1 release.
[Caracal] Fix Unit Tests
With the Caracal release, default policies are activated by default causing our tests to fail error 'PolicyNotAuthorized'. Simply running them as admin fixes the issue.