Skip to content

Commit

Permalink
add rpc unit tests in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
RCasatta committed May 18, 2021
1 parent 19e7b5f commit 6f5b027
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
14 changes: 14 additions & 0 deletions .github/workflows/cont_integration.yml
Expand Up @@ -22,6 +22,7 @@ jobs:
- compact_filters
- esplora,key-value-db,electrum
- compiler
- rpc
steps:
- name: checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -108,6 +109,19 @@ jobs:
- name: Test
run: $HOME/.cargo/bin/cargo test --features test-electrum --no-default-features

test-rpc:
name: Test rpc
runs-on: ubuntu-20.04
env:
BITCOIN_VER: 0.21.0
steps:
- name: Checkout
uses: actions/checkout@v2
- run: echo "BITCOIND_EXE=${{ github.workspace }}/bitcoin-${{ env.BITCOIN_VER }}/bin/bitcoind" >> $GITHUB_ENV
- run: curl https://bitcoincore.org/bin/bitcoin-core-$BITCOIN_VER/bitcoin-$BITCOIN_VER-x86_64-linux-gnu.tar.gz | tar -xvz bitcoin-$BITCOIN_VER/bin/bitcoind
- name: Test
run: $HOME/.cargo/bin/cargo test --features test-electrum --no-default-features

check-wasm:
name: Check WASM
runs-on: ubuntu-16.04
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Expand Up @@ -59,6 +59,7 @@ rpc = ["bitcoincore-rpc"]
# Debug/Test features
debug-proc-macros = ["bdk-macros/debug", "bdk-testutils-macros/debug"]
test-electrum = ["electrum"]
test-rpc = ["rpc"]
test-md-docs = ["electrum"]

[dev-dependencies]
Expand Down
1 change: 1 addition & 0 deletions src/blockchain/rpc.rs
Expand Up @@ -314,6 +314,7 @@ fn list_wallet_dir(client: &Client) -> Result<Vec<String>, Error> {
Ok(result.wallets.into_iter().map(|n| n.name).collect())
}

#[cfg(feature = "test-rpc")]
#[cfg(test)]
mod test {
use super::{RpcBlockchain, RpcConfig};
Expand Down
2 changes: 1 addition & 1 deletion src/error.rs
Expand Up @@ -88,7 +88,7 @@ pub enum Error {
/// requested network, for example what is given as bdk-cli option
requested: Network,
/// found network, for example the network of the bitcoin node
found: Network
found: Network,
},
/// Progress value must be between `0.0` (included) and `100.0` (included)
InvalidProgressValue(f32),
Expand Down

0 comments on commit 6f5b027

Please sign in to comment.