-
Notifications
You must be signed in to change notification settings - Fork 119
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 flaky CI test #263
Fix flaky CI test #263
Conversation
da19415
to
7f802c8
Compare
7f802c8
to
5c81fee
Compare
An alternative solution would be to add an additional The unique name could either be a hash of the tmp dir as you have done or you could even use an atomic counter and append that to the name e.g. |
This reverts commit 5c81fee.
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.
LGTM
It's hunting season for #234 🏹!
I found it!
The issue was that we use
in our CI configuration. This made all tests build to the same
target
directory. Since we have a number of tests which build a contract callednew_project
this made ourtmp_dir
's obsolete and resulted in overlapping contracts build to e.g./ci-cache/cargo-contract/targets/263/test/ink/new_project.contract
.The way I fixed it now is by appending a hash of a contract's
manifest_path
to thetarget_directory
(for tests this path contains thetmp_dir
path). This results in the paths now being e.g./ci-cache/cargo-contract/targets/263/test/0xd82f746d702f636172676f2d636f6e74726163742e746573742e5479444c634b2f6e65775f70726f6a6563742f436172676f2e746f6d6c/ink/new_project.contract
.I'm not super-happy with that solution, since it makes caching obsolete for the contract build in those particular tests (since the hash is unique each time a test is run, due to
tmp_dir
being included in it).I have a better idea, but it's a bit more involved:
cmd::metadata::tests::generate_metadata
) for the hash instead.#[test]
), which wraps around the Rust#[test]
macro.module_path!
andfunction_name!
and put those into a thread-local variable.The disadvantage is that we would require something like
use crate::test;
for the macro to become available for tests. But we would then again have proper caching.But: The CI hasn't really slowed down with the current fix in this PR ‒ a run of the
test
stage still takes 4-5 minutes. So maybe the current fix is already good enough. Though it fills up the cache and I'm not sure when it is cleared.Wdyt?