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

Attempt to reduce test flakiness by forcing file sync #1457

Merged
merged 1 commit into from
Feb 17, 2022

Conversation

steviez
Copy link
Contributor

@steviez steviez commented Feb 16, 2022

Some automated testing has shown this test to fail due to being unable
to read the written version bytes from the file. The root cause would
seem to be something at the OS level, so do a sync_all() to hopefully
ensure that the immediate read after write sees the contents of the
write.

We (Solana) build against this repo as part of our CI to ensure we don't break things (at least compilation 😄 ); this test has been failing intermittently for us (one such instance) as follows:

    Running unittests (target/debug/deps/avm-c9bbce84b0ec1ce3)

running 7 tests
test tests::test_version_binary_path ... ok
test tests::test_ensure_paths ... ok
test tests::test_current_version_file_path ... ok
test tests::test_uninstall_non_installed_version - should panic ... ok
test tests::test_read_installed_versions ... ok
test tests::test_uninstalled_in_use_version - should panic ... ok
test tests::test_current_version ... FAILED

failures:

---- tests::test_current_version stdout ----
thread 'tests::test_current_version' panicked at 'called `Result::unwrap()` on an `Err` value: Could not parse version file: unexpected end of input while parsing major version number', avm/src/lib.rs:264:35


failures:
tests::test_current_version

Hypothetically, I don't think this change should be strictly necessary; however, I have previously observed issues with unit tests that write a file and immediately read it afterwards.

Some automated testing has shown this test to fail due to being unable
to read the written version bytes from the file. The root cause would
seem to be something at the OS level, so do a sync_all() to hopefully
ensure that the immediate read after write sees the contents of the
write.
@armaniferrante armaniferrante merged commit 222c6e3 into coral-xyz:master Feb 17, 2022
@steviez steviez deleted the flaky_test branch February 17, 2022 04:03
steviez added a commit to steviez/anchor that referenced this pull request Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants