Skip to content
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

[FIX] mail: build error 57492 #163035

Closed

Conversation

Xavier-Do
Copy link
Contributor

@Xavier-Do Xavier-Do commented Apr 23, 2024

It looks like even with the registry check, we can still have rare case were the websocket request arrives after registry test mode is removed.

This is fixed by checking if current test is set

This flag is more reliable, but needs the backport of the new current_test behaviour (#156852).

It is currently always a pain to know for sure if a test is running when
writing conditional code.

- `config['test-tags']` is one of the more reliable, but if starting a
server with tests (test-tags, ...) will result in a special state.
This is sometime visible when truing to render a report after executing
a test, the report will be rendered in html.

- module.current_test will only work for at install tests, because it's
main purpose was initially to give the module being currently loaded.

- module.current_test will only work for at install tests, because it's
main purpose was initially to give the module being currently loaded.

- threading.testing will only work for the main thread, not the one of
a thread serving an http request.

The easiest solution is to have a global flag that will always be
thruthy when executing a test, no mater if it is at install or post
install.

The current_test flag is actually the closest one that could cover all
cases. It just need to be thruthy when running a post install test.

The main reason this flag contains the currently loading module is to
fill the _init_modules in some cases, but this shouldn't be useful if
the module is already in the _init_modules list

This is actually the case since odoo#53499, and some of the hack regarding
_init_modules and current_test can be removed. This will allow to
recycle this flag to make it True when in test mode, False otherwise.
It looks like even with the registry check, we can still have rare case
were the websocket request arrives after registry test mode is removed.

This fixed by checking it current test is set
This flag is more reliable with the pare,t backported commit.
@robodoo
Copy link
Contributor

robodoo commented Apr 23, 2024

Pull request status dashboard.

@C3POdoo C3POdoo requested review from a team, dbkosky, HydrionBurst, ryv-odoo, juliusc2066, BastienFafchamps and Julien00859 and removed request for a team April 23, 2024 16:43
@C3POdoo C3POdoo added the RD research & development, internal work label Apr 23, 2024
@rco-odoo
Copy link
Member

@robodoo rebase-ff r+

@robodoo
Copy link
Contributor

robodoo commented Apr 24, 2024

Merge method set to rebase and fast-forward.

@robodoo
Copy link
Contributor

robodoo commented Apr 24, 2024

@rco-odoo you may want to rebuild or fix this PR as it has failed CI.

@Xavier-Do
Copy link
Contributor Author

@robodoo override=ci/style (this is a backport, avoid a conflict on forwardport)

@robodoo r+

@robodoo
Copy link
Contributor

robodoo commented Apr 24, 2024

I'm sorry, @Xavier-Do: this PR is already reviewed, reviewing it again is useless.

robodoo pushed a commit that referenced this pull request Apr 24, 2024
It is currently always a pain to know for sure if a test is running when
writing conditional code.

- `config['test-tags']` is one of the more reliable, but if starting a
server with tests (test-tags, ...) will result in a special state.
This is sometime visible when truing to render a report after executing
a test, the report will be rendered in html.

- module.current_test will only work for at install tests, because it's
main purpose was initially to give the module being currently loaded.

- module.current_test will only work for at install tests, because it's
main purpose was initially to give the module being currently loaded.

- threading.testing will only work for the main thread, not the one of
a thread serving an http request.

The easiest solution is to have a global flag that will always be
thruthy when executing a test, no mater if it is at install or post
install.

The current_test flag is actually the closest one that could cover all
cases. It just need to be thruthy when running a post install test.

The main reason this flag contains the currently loading module is to
fill the _init_modules in some cases, but this shouldn't be useful if
the module is already in the _init_modules list

This is actually the case since #53499, and some of the hack regarding
_init_modules and current_test can be removed. This will allow to
recycle this flag to make it True when in test mode, False otherwise.

Part-of: #163035
robodoo pushed a commit that referenced this pull request Apr 24, 2024
It looks like even with the registry check, we can still have rare case
were the websocket request arrives after registry test mode is removed.

This fixed by checking it current test is set
This flag is more reliable with the pare,t backported commit.

closes #163035

Signed-off-by: Raphael Collet <rco@odoo.com>
@robodoo robodoo closed this Apr 24, 2024
@fw-bot
Copy link
Contributor

fw-bot commented Apr 28, 2024

@Xavier-Do @rco-odoo this pull request has forward-port PRs awaiting action (not merged or closed):

1 similar comment
@fw-bot
Copy link
Contributor

fw-bot commented Apr 29, 2024

@Xavier-Do @rco-odoo this pull request has forward-port PRs awaiting action (not merged or closed):

@fw-bot
Copy link
Contributor

fw-bot commented Apr 30, 2024

@Xavier-Do @rco-odoo this pull request has forward-port PRs awaiting action (not merged or closed):

@fw-bot fw-bot deleted the saas-17.1-fix-websocket-xdo branch May 8, 2024 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants