Skip to content

Commit

Permalink
upgrade electrum, do tests in nix
Browse files Browse the repository at this point in the history
Now on nix env we provide the env vars of the executables needed for
integration testing, so we can enable tests.

To be coherent with the electrum nix version used, upgrade also the
autodownloaded one.

Note we have to change a test assertion, it seems electrum behaviour
changed, upgrading balances before confirmation.
  • Loading branch information
RCasatta committed Aug 19, 2024
1 parent 30f06e0 commit 8ec688e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 38 deletions.
25 changes: 6 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ electrum-client = { version = "0.8", optional = true }


[dev-dependencies]
bitcoind = { version = "0.35", features = ["25_0"] }
elementsd = { version = "0.9", features = ["22_1_1"] }
electrumd = { version = "0.1.0", features = ["4_1_5"] }
bitcoind = { version = "0.34.3", features = ["25_0"] }
elementsd = { version = "0.9.2", features = ["22_1_1"] }
electrumd = { version = "0.1.0", features = ["4_5_4"] }
ureq = { version = "2.9", default-features = false, features = ["json"] }
tempfile = "3.10"

Expand Down
30 changes: 15 additions & 15 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,22 @@
nativeBuildInputs = with pkgs; [ rustToolchain clang ]; # required only at build time
buildInputs = with pkgs; [ ]; # also required at runtime

envVars = {
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
ELEMENTSD_SKIP_DOWNLOAD = true;
BITCOIND_SKIP_DOWNLOAD = true;
ELECTRUMD_SKIP_DOWNLOAD = true;
envVars =
{
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
ELEMENTSD_SKIP_DOWNLOAD = true;
BITCOIND_SKIP_DOWNLOAD = true;
ELECTRUMD_SKIP_DOWNLOAD = true;

# link rocksdb dynamically
ROCKSDB_INCLUDE_DIR = "${pkgs.rocksdb}/include";
ROCKSDB_LIB_DIR = "${pkgs.rocksdb}/lib";
};
# link rocksdb dynamically
ROCKSDB_INCLUDE_DIR = "${pkgs.rocksdb}/include";
ROCKSDB_LIB_DIR = "${pkgs.rocksdb}/lib";

# for integration testing
BITCOIND_EXE = "${pkgs.bitcoind}/bin/bitcoind";
ELEMENTSD_EXE = "${pkgs.elementsd}/bin/elementsd";
ELECTRUMD_EXE = "${pkgs.electrum}/bin/electrum";
};

commonArgs = {
inherit src buildInputs nativeBuildInputs;
Expand All @@ -54,16 +60,10 @@
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
bin = craneLib.buildPackage (commonArgs // {
inherit cargoArtifacts;

# TODO: do testing by providing executables via *_EXE env var for {bitcoin,elements,electrum}d
doCheck = false;
});
binLiquid = craneLib.buildPackage (commonArgs // {
inherit cargoArtifacts;
cargoExtraArgs = "--features liquid";

# TODO: do testing by providing executables via *_EXE env var for {bitcoin,elements,electrum}d
doCheck = false;
});

in
Expand Down
2 changes: 1 addition & 1 deletion tests/electrum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ fn test_electrum() -> Result<()> {
)?]),
)?;
notify_wallet();
assert_balance(0.3, -0.161);
assert_balance(0.139, 0.0);

tester.mine()?;
notify_wallet();
Expand Down

0 comments on commit 8ec688e

Please sign in to comment.