Fix install_noded.sh (#2422)

* Fix install_noded.sh

* reestablish finally

---------

Co-authored-by: Wim van der Ham <wfjvdham@gmail.com>
Co-authored-by: k9ert <k9ert@gmx.de>
Co-authored-by: Kim Neunert <kim@swanbitcoin.com>
This commit is contained in:
Wim van der Ham 2024-05-16 17:58:38 +02:00 committed by GitHub
parent 714a8ae771
commit a52fec89d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 22 deletions

View file

@ -137,9 +137,18 @@ _note: you may need to add `$HOME/.cargo/bin` to your path in `.env/bin/activate
## How to run the tests
_TODO: Need more thorough tests!_
In order to run the tests, you need bitcoind and elementsd binaries available. For Linux/Mac, there is some support for installing/compiling them. So you can:
In order to run the tests, you need bitcoind and elementsd binaries available. For Linux/Mac, there is some support for installing/compiling them.
For bitcoind you can do:
* `./tests/install_noded.sh --bitcoin binary` will install bitcoind in tests/bitcoin
or:
* `./tests/install_noded.sh --bitcoin compile` will compile bitcoind in tests/bitcoin
For elementsd:
* `./tests/install_noded.sh --elements compile` will compile elements in tests/elements
If you're not interested in elements, you can skip the liquid specific tests as described below.

View file

@ -32,16 +32,10 @@ function maybe_update {
# Determine if we need to pull. From https://stackoverflow.com/a/3278427
UPSTREAM=origin/master
LOCAL=$(git describe --all | sed 's/heads\///' | sed 's/tags\///') # gives either a tag or "master"
if cat ../../pyproject.toml | grep "addopts = --${node_impl}d-version" ; then
# in this case, we use the expected version from the test also as the tag to be checked out
# i admit that this is REALLY ugly. Happy for any recommendations to do that more easy
PINNED=$(cat ../../pyproject.toml | grep "addopts = " | cut -d'=' -f2 | sed 's/--/+/g' | tr '+' '\n' | grep ${node_impl} | cut -d' ' -f2)
if [ "$node_impl" = "elements" ]; then
# in the case of elements, the tags have a "elements-" prefix
PINNED=$(echo "$PINNED" | sed 's/v//' | sed 's/^/elements-/')
fi
fi
cd ..
PINNED=$(calc_pytestinit_nodeimpl_version $node_impl)
cd bitcoin
# the version in pyproject.toml is (also) used to check the version via getnetworkinfo()["subversion"]
# However, this might not be a valid git rev. So we need another way to specify the git-rev used
# as we want to be able to test against specific commits

View file

@ -65,17 +65,10 @@ def test_node_running_elements(caplog, request):
caplog.set_level(logging.DEBUG, logger="cryptoadvance.specter")
requested_version = request.config.getoption("--elementsd-version")
try:
try:
my_elementsd = ElementsPlainController(
elementsd_path=find_node_executable(node_impl="elements"),
rpcport=18123, # Non-standardport to not interfer
)
except Exception as e:
if "Couldn't find executable elementsd" in str(e):
pytest.skip(str(e))
else:
raise e
my_elementsd = ElementsPlainController(
elementsd_path=find_node_executable(node_impl="elements"),
rpcport=18123, # Non-standardport to not interfer
)
rpcconn = my_elementsd.start_node(cleanup_at_exit=True, cleanup_hard=True)
requested_version = request.config.getoption("--elementsd-version")
assert my_elementsd.version() == requested_version
@ -87,5 +80,10 @@ def test_node_running_elements(caplog, request):
prepare_elements_default_wallet(my_elementsd)
random_address = "el1qqf6tv4n8qp55qc04v4xts5snd9v5uurkry4vskef6lmecahj6c42jt9lnj0432287rs67z9vzq2zvuer036s5mahptwxgyd8k"
my_elementsd.testcoin_faucet(random_address, amount=25)
except Exception as e:
if "Couldn't find executable elementsd" in str(e):
pytest.skip(str(e))
else:
raise e
finally:
my_elementsd.stop_node()