-
Notifications
You must be signed in to change notification settings - Fork 178
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: use local mapping instead of remote #1430
Conversation
Do you know what caused the flakyness though? |
We are using in this test a simple reqwest client without adding a retry and cache layer for it ( which happend in real code ). It could be that github don't respond successfully for the first time which cause the test to fail |
Sure but if we have 500 errors or whatever I would expect the mapping process to fail with an error as well. Otherwise, we get flaky behavior. |
let me write a test for this behaviour |
problem was that we were using oncecell in custom_pypi_mapping.rs which was loaded once during the tests and reused indifferent of project defined in test. I've moved this function in struct CustomMapping, so it will loaded depending on the project |
Actually, the problem is that that thing is Static that makes it available once per binary :) |
src/project/mod.rs
Outdated
.pypi_name_mapping_source() | ||
.expect("mapping source should be ok") | ||
pub fn pypi_name_mapping_source(&self) -> MappingSource { | ||
self.mapping_source |
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.
DOes it even make sense to use a oncecell here? Since the mapping is already just returned from the manifest?
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.
we are doing some transformation in self.manifest.pypi_name_mapping_source()
from user defined channels into rattler::Channel
so my idea was to cache it here
This PR aims to fix the issue where the OnceCell for the loaded mapping was initialized only once during the tests and wasn't affected by project changes, which made our tests flaky.
This is not a problem for our end users who are using Pixi as a binary, but it could be a problem if it's used as a library.