Skip to content

agave-validator: add args tests for run (part 3) #6918

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

yihau
Copy link
Member

@yihau yihau commented Jul 10, 2025

Problem

#4082

Summary of Changes

- impl FromClapArgMatches for BlockstoreOptions and derive PartialEq for some structs

in the part 2 PR, we decided to use the same struct for both user input and core logic.

- stop parsing rocksdb_compaction_threads and rocksdb_flush_threads in the thread_args

this one is a bit tricky. I noticed we have a struct that includes all threads-related args. however, if we wanna use the same struct, the thread args will go back to the component level. in this PR, I only moved the parsing logic. the args definitions and default values are still in the original file

@codecov-commenter
Copy link

codecov-commenter commented Jul 10, 2025

Codecov Report

Attention: Patch coverage is 97.50000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 83.3%. Comparing base (553fc1d) to head (f2ab894).
Report is 22 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #6918    +/-   ##
========================================
  Coverage    83.2%    83.3%            
========================================
  Files         853      854     +1     
  Lines      377587   377823   +236     
========================================
+ Hits       314488   314903   +415     
+ Misses      63099    62920   -179     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@yihau yihau marked this pull request as ready for review July 10, 2025 17:33
@yihau yihau requested a review from steviez July 10, 2025 17:33
num_rocksdb_compaction_threads: rocksdb_compaction_threads,
num_rocksdb_flush_threads: rocksdb_flush_threads,
};
let blockstore_options = run_args.blockstore_options;
Copy link

Choose a reason for hiding this comment

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

No need for this IMO, just use it directly below:

blockstore_options: run_args.blockstore_options,

Copy link
Member Author

Choose a reason for hiding this comment

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

sure! 9ec842d

Comment on lines 53 to 56
.map_err(|err| {
Box::<dyn std::error::Error>::from(format!(
"failed to parse rocksdb_flush_threads: {err}"
))
Copy link

Choose a reason for hiding this comment

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

The formatting looks off here but CI is passing 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, that’s just how fmt works. they consider it valid formatting haha 🙈. no need to worry about it for now. I’ve removed these code because we don't need to wrap the error

Comment on lines 37 to 42
rocks_perf_sample_interval: value_t!(matches, "rocksdb_perf_sample_interval", usize)
.map_err(|err| {
Box::<dyn std::error::Error>::from(format!(
"failed to parse rocksdb_perf_sample_interval: {err}"
))
})?,
Copy link

Choose a reason for hiding this comment

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

Any reason for mapping the error here ? I think you could use ? directly on value_t!(). I would need to double check what exactly CLAP includes. If we don't like what CLAP includes, then we should write a wrapper instead of doing .map_err() on everything

Same question in a couple other places in this PR

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch! thank you for pointing this out! 64cfe0c

}

#[test]
fn verify_args_struct_by_command_run_with_rocksdb_ledger_compression() {
Copy link

Choose a reason for hiding this comment

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

Since we have manual parsing, maybe should have a test for invalid value too ?

Copy link
Member Author

Choose a reason for hiding this comment

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

sure! f2ab894

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