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

Adhoc concurrent test for program cache #1471

Merged
merged 2 commits into from
May 29, 2024

Conversation

LucasSte
Copy link

Problem

There are no concurrent tests for the program cache. We cover most lines in our testing, but the line that stops a thread on a condition variable has no testing coverage.

I noticed that this is the only place where there is an explicit wait/notify condition. In all other places in the program cache, we use mutexes and RWLocks, which are already covered in basic unit tests. Adding concurrent tests for them would only mean covering their blocking functionality.

Summary of Changes

I included an impromptu test to cover the cookie line in replenish_program_cache. The test is adhoc and is only a stop gap until I configure the repository to receive shuttle, which provides with mechanisms to manipulate thread scheduling and ensure correct multithreaded tests.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.8%. Comparing base (e86ab5a) to head (c39034a).
Report is 65 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #1471    +/-   ##
========================================
  Coverage    82.8%    82.8%            
========================================
  Files         872      872            
  Lines      369310   369435   +125     
========================================
+ Hits       305846   306010   +164     
+ Misses      63464    63425    -39     

@LucasSte
Copy link
Author

@LucasSte LucasSte requested review from Lichtso and pgarg66 May 24, 2024 15:45
@LucasSte LucasSte marked this pull request as ready for review May 24, 2024 15:45
@LucasSte LucasSte requested a review from alessandrod May 27, 2024 14:12
}
}

fn deploy_program(name: String, mock_bank: &mut MockBankCallback) -> Pubkey {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably the fourth or fifth time we implement a program load to deployment for tests method. Should be unified, but that can happen in a separate PR.

Copy link
Author

@LucasSte LucasSte May 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the issue is that all loading functions are under a #[cfg(test)] flag, which makes them unavailable for import.

@LucasSte LucasSte requested a review from Lichtso May 28, 2024 22:22
@LucasSte LucasSte merged commit bb875a0 into anza-xyz:master May 29, 2024
42 checks passed
@LucasSte LucasSte deleted the other-fast-concur branch May 29, 2024 14:00
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.

3 participants