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

feat: create dump_config for mempool node config #164

Merged
merged 1 commit into from
May 30, 2024

Conversation

ArniStarkware
Copy link
Contributor

@ArniStarkware ArniStarkware commented May 22, 2024

This change is Reviewable

Copy link
Contributor Author

ArniStarkware commented May 22, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @ArniStarkware and the rest of your teammates on Graphite Graphite

@codecov-commenter
Copy link

codecov-commenter commented May 22, 2024

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 65.69%. Comparing base (41cf4a7) to head (26e115e).

Files Patch % Lines
crates/mempool_node/src/config/mod.rs 0.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #164       +/-   ##
===========================================
+ Coverage   49.40%   65.69%   +16.29%     
===========================================
  Files          24       25        +1     
  Lines         927      930        +3     
  Branches      927      930        +3     
===========================================
+ Hits          458      611      +153     
+ Misses        446      293      -153     
- Partials       23       26        +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ArniStarkware ArniStarkware force-pushed the arni/config/test/remove_redundent_tests branch from 67eba04 to 166d248 Compare May 22, 2024 08:33
@ArniStarkware ArniStarkware force-pushed the arni/config/test/remove_redundent_tests branch from 166d248 to 43fc7d4 Compare May 22, 2024 11:28
@ArniStarkware ArniStarkware force-pushed the arni/config/test/remove_redundent_tests branch from 43fc7d4 to 594b159 Compare May 22, 2024 12:05
@ArniStarkware ArniStarkware force-pushed the arni/config/test/remove_redundent_tests branch from 594b159 to 0a3b6c1 Compare May 22, 2024 12:18
@ArniStarkware ArniStarkware force-pushed the arni/config/test/remove_redundent_tests branch from 0a3b6c1 to 5925b99 Compare May 23, 2024 06:51
@ArniStarkware ArniStarkware force-pushed the arni/config/test/remove_redundent_tests branch from 5925b99 to 13b61d5 Compare May 23, 2024 07:53
@ArniStarkware ArniStarkware force-pushed the arni/config/test/remove_redundent_tests branch from 13b61d5 to 151ea3c Compare May 23, 2024 10:10
@ArniStarkware ArniStarkware force-pushed the arni/config/bin/dump_config branch 2 times, most recently from be349d7 to 028449e Compare May 23, 2024 10:15
@ArniStarkware ArniStarkware changed the base branch from arni/config/test/remove_redundent_tests to main May 23, 2024 10:15
@ArniStarkware ArniStarkware changed the base branch from main to arni/config/mempool_node/remove_redundent_tests May 26, 2024 08:25
@ArniStarkware ArniStarkware force-pushed the arni/config/mempool_node/remove_redundent_tests branch from ffca060 to 405a4cd Compare May 26, 2024 10:29
@ArniStarkware ArniStarkware force-pushed the arni/config/mempool_node/remove_redundent_tests branch from 405a4cd to 11f6fed Compare May 28, 2024 06:52
@ArniStarkware ArniStarkware force-pushed the arni/config/mempool_node/remove_redundent_tests branch from 11f6fed to 828c4b2 Compare May 28, 2024 07:19
@ArniStarkware ArniStarkware force-pushed the arni/config/mempool_node/remove_redundent_tests branch from 828c4b2 to 47dea97 Compare May 28, 2024 07:34
@ArniStarkware ArniStarkware force-pushed the arni/config/mempool_node/remove_redundent_tests branch from 47dea97 to 7f9ecce Compare May 28, 2024 07:36
@ArniStarkware ArniStarkware force-pushed the arni/config/bin/dump_config branch 2 times, most recently from 82e45d0 to a3f86a1 Compare May 28, 2024 07:41
@ArniStarkware ArniStarkware changed the base branch from arni/config/mempool_node/remove_redundent_tests to main May 28, 2024 07:41
@ArniStarkware ArniStarkware marked this pull request as ready for review May 28, 2024 07:46
@ArniStarkware ArniStarkware force-pushed the arni/config/bin/dump_config branch 2 times, most recently from 0e64282 to 0626eb6 Compare May 29, 2024 09:35
Copy link
Contributor

@lev-starkware lev-starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 8 files reviewed, 3 unresolved discussions (waiting on @ArniStarkware, @dafnamatsry, and @Yael-Starkware)


crates/mempool_node/src/config/config_test.rs line 55 at r2 (raw file):

#[test]
fn test_dump_default_config() {

Only a question: Is this test checking that dump () is working OK?


crates/mempool_node/src/config/config_test.rs line 62 at r2 (raw file):

    insta::assert_json_snapshot!(dumped_default_config);

    assert!(default_config.validate().is_ok());

This line should come before "let dumped_default_config..." because if validation fails no need to check json snapshot.

Code quote:

assert!(default_config.validate().is_ok());

crates/mempool_node/src/config/config_test.rs line 78 at r2 (raw file):

    // Read the dumped config from the file.
    let from_code: serde_json::Value =
        serde_json::from_reader(File::open(tmp_file_path).unwrap()).unwrap();

I think that the next code should be enough:
look at " CODE SNIPPET (ii)"

Code quote (i):

    // Create a temporary file and dump the default config to it.
    let mut tmp_file_path = env::temp_dir();
    tmp_file_path.push("cfg.json");
    MempoolNodeConfig::default().dump_to_file(&vec![], tmp_file_path.to_str().unwrap()).unwrap();

    // Read the dumped config from the file.
    let from_code: serde_json::Value =
        serde_json::from_reader(File::open(tmp_file_path).unwrap()).unwrap();

Code snippet (ii):

    let from_code: serde_json::Value =
        serde_json::to_value(MempoolNodeConfig::default().dump()).unwrap();

Copy link
Contributor Author

@ArniStarkware ArniStarkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 8 files reviewed, 3 unresolved discussions (waiting on @dafnamatsry, @lev-starkware, and @Yael-Starkware)


crates/mempool_node/src/config/config_test.rs line 55 at r2 (raw file):

Previously, lev-starkware wrote…

Only a question: Is this test checking that dump () is working OK?

Yes.

  1. That the dump is working.
  2. That the dumped value is consistent with the latest dumped value. If these values are inconsistent, the developer can review the changes and fix the snapshot by following the instructions presented by insta.

crates/mempool_node/src/config/config_test.rs line 62 at r2 (raw file):

Previously, lev-starkware wrote…

This line should come before "let dumped_default_config..." because if validation fails no need to check json snapshot.

Done.


crates/mempool_node/src/config/config_test.rs line 78 at r2 (raw file):

Previously, lev-starkware wrote…

I think that the next code should be enough:
look at " CODE SNIPPET (ii)"

Done.

Copy link
Contributor

@lev-starkware lev-starkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 3 of 8 files at r1, 5 of 5 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dafnamatsry and @Yael-Starkware)

Copy link
Collaborator

@dafnamatsry dafnamatsry left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 8 files at r1, 5 of 5 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Yael-Starkware)

Copy link
Collaborator

@dafnamatsry dafnamatsry left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Yael-Starkware)

@ArniStarkware ArniStarkware merged commit cc4bdc9 into main May 30, 2024
14 checks passed
@ArniStarkware ArniStarkware deleted the arni/config/bin/dump_config branch May 30, 2024 12:59
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.

None yet

4 participants