Skip to content
This repository has been archived by the owner on Jan 26, 2023. It is now read-only.

Ledger* tests #130

Merged
merged 2 commits into from
Jun 8, 2022
Merged

Ledger* tests #130

merged 2 commits into from
Jun 8, 2022

Conversation

fmorency
Copy link
Contributor

@fmorency fmorency commented Jun 8, 2022

Integration tests for

  • Ledger
  • LedgerCommands
  • LedgerTransactions

I added support for Account* transactions recording in the storage and did some more refactoring.

I also fixed the HTML coverage output to keep only our own stats.

- More refactoring
- Record Account* transactions in the storage
- Do not record a transaction when importing the initial state
@fmorency fmorency added the enhancement New feature or request label Jun 8, 2022
@fmorency fmorency requested a review from hansl June 8, 2022 18:30
@fmorency fmorency self-assigned this Jun 8, 2022
Copy link
Contributor

@hansl hansl left a comment

Choose a reason for hiding this comment

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

One note.

@@ -1,22 +1,27 @@
use std::{
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's avoid mod.rs files. There's no style guide for it really, but the Rust-lang team moved away from it and prefers having x.rs and x/y.rs instead of mod files.

cf rust-lang/rust#53125 and https://doc.rust-lang.org/book/ch07-05-separating-modules-into-different-files.html#alternate-file-paths

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://doc.rust-lang.org/book/ch11-03-test-organization.html#submodules-in-integration-tests

To avoid having common appear in the test output, instead of creating tests/common.rs, we'll create tests/common/mod.rs. This is an alternate naming convention that Rust also understands. Naming the file this way tells Rust not to treat the common module as an integration test file. When we move the setup function code into tests/common/mod.rs and delete the tests/common.rs file, the section in the test output will no longer appear. Files in subdirectories of the tests directory don't get compiled as separate crates or have sections in the test output.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks.

@github-actions
Copy link

github-actions bot commented Jun 8, 2022

Code Coverage Report

Coverage for this commit
59.39%
Coverage Report
FileStmtsBranchesFuncsLines
src/http_proxy/src
   main.rs1.35%100%1.69%1.12%
src/kvstore/src
   main.rs0.85%100%0.98%0.76%
src/ledger/src
   main.rs0.46%100%0.58%0.38%
   multisig.rs0%100%0%0%
src/many-abci/src
   module.rs0%100%0%0%
   main.rs0.76%100%0.95%0.63%
   lib.rs100%100%100%100%
   many_app.rs0%100%0%0%
   abci_app.rs0%100%0%0%
src/many-kvstore/src
   storage.rs0%100%0%0%
   lib.rs100%100%100%100%
   main.rs1.30%100%1.67%1.06%
   module.rs0%100%0%0%
src/many-ledger/src
   storage.rs58.70%100%19.47%79.81%
   lib.rs100%100%100%100%
   module.rs62.39%100%20.97%83.84%
   main.rs0.61%100%0.61%0.61%
   json.rs45.29%100%37.58%80.28%
src/many-ledger/tests
   account.rs100%100%100%100%
   idstore.rs100%100%100%100%
   ledger_commands.rs100%100%100%100%
   ledger_transactions.rs99.49%100%100%99.45%
   ledger.rs100%100%100%100%
   multisig.rs99.78%100%100%99.76%
   iterator.rs100%100%100%100%
src/many-ledger/tests/common
   mod.rs90.20%100%58.33%100%

@fmorency fmorency merged commit b244dd2 into liftedinit:main Jun 8, 2022
@fmorency fmorency deleted the fmorency/ledger-tests branch June 8, 2022 20:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants