-
Notifications
You must be signed in to change notification settings - Fork 0
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
added macros for database tests #6
added macros for database tests #6
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.. Below are some comments.. Great going..
Few more tasks in gen
-
Add Santosh as a co-author too.. This PR itself will be used as a documentation for your works.. So its important both participants are reflected in the contents..
-
Add signature to your commits.. This is standard requirement for contributing to most FOSS projects out there.. Heres the steps.. https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits
Co-authored-by : SanthoshAnguluri <santhoshanguluri15@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look good..
Few more nits..
src/testutils/mod.rs
Outdated
macro_rules! run_tests_with_constructor { | ||
(getter $fn_name:ident(), tests ( $($x:tt) , + $(,)? )) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
macro_rules! run_tests_with_constructor { | |
(getter $fn_name:ident(), tests ( $($x:tt) , + $(,)? )) => { | |
macro_rules! run_tests_with_initialiser { | |
(init $fn_name:ident(), tests ( $($x:tt) , + $(,)? )) => { |
src/database/mod.rs
Outdated
@@ -219,6 +219,7 @@ pub(crate) trait DatabaseUtils: Database { | |||
|
|||
impl<T: Database> DatabaseUtils for T {} | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more redundant extra line..
src/database/memory.rs
Outdated
#[cfg(test)] | ||
mod test { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant line..
Co-authored-by: SanthoshAnguluri <santhoshanguluri15@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still not sure how but I am seeing two more redundant lines..
Use cargo fmt
and cargo clippy
before you push changes..
src/database/keyvalue.rs
Outdated
@@ -410,7 +410,7 @@ impl Database for Tree { | |||
|
|||
impl BatchDatabase for Tree { | |||
type Batch = sled::Batch; | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant line..
src/database/memory.rs
Outdated
@@ -479,6 +479,7 @@ impl ConfigurableDatabase for MemoryDatabase { | |||
} | |||
} | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant line..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests are failing because you need change populate_db!
here too..
Line 246 in 00fdf8d
let txid = populate_test_db!( |
The macro doesn't exist anymore..
Also before committing changes locally run all the tests to make sure nothing is broken..
To get a list of all the CI tests checkout this file..
bdk/.github/workflows/cont_integration.yml
Lines 15 to 53 in 474620e
features: | |
- default | |
- minimal | |
- all-keys | |
- minimal,esplora | |
- key-value-db | |
- electrum | |
- compact_filters | |
- esplora,key-value-db,electrum | |
- compiler | |
- rpc | |
- verify | |
steps: | |
- name: checkout | |
uses: actions/checkout@v2 | |
- name: Generate cache key | |
run: echo "${{ matrix.rust }} ${{ matrix.features }}" | tee .cache_key | |
- name: cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} | |
- name: Set default toolchain | |
run: rustup default ${{ matrix.rust }} | |
- name: Set profile | |
run: rustup set profile minimal | |
- name: Add clippy | |
run: rustup component add clippy | |
- name: Update toolchain | |
run: rustup update | |
- name: Build | |
run: cargo build --features ${{ matrix.features }} --no-default-features | |
- name: Clippy | |
run: cargo clippy --all-targets --features ${{ matrix.features }} --no-default-features -- -D warnings | |
- name: Test | |
run: cargo test --features ${{ matrix.features }} --no-default-features |
It might make sense to make a small shell script with all the cargo tests and run that before pushing changes..
00fdf8d
to
2f50953
Compare
Co-authored-by: SanthoshAnguluri <santhoshanguluri15@gmail.com>
2f50953
to
d935004
Compare
49ef8a8
to
daa5dcd
Compare
I pushed all these changes after the comment fix and few more refactors into the PR branch https://github.com/rajarshimaitra/bdk/commits/test-helper-refactor I am closing this PR, in favor of that.. Its required lot of conflict resolution.. So the merge didn't haven't as clean as I expected.. For further work open PR new on the original branch.. |
added macros for database tests to remove the repetitive test and make it simple using declarative macros. Macros are inserted
in memory.rs,keyvalue.rs.
Co-authored-by : SanthoshAnguluri santhoshanguluri15@gmail.com