From a427a872a0e087f48eae3649882e1ecaa2683b26 Mon Sep 17 00:00:00 2001 From: Andras Banki-Horvath Date: Fri, 28 Mar 2025 19:06:13 +0100 Subject: [PATCH] scripts+bw-compatibility-test: run and update Dave with sqlite --- .../docker-compose.override.yaml | 46 ++++++++++++++++++- .../bw-compatibility-test/docker-compose.yaml | 2 + scripts/bw-compatibility-test/network.sh | 44 +++++++++++------- scripts/bw-compatibility-test/test.sh | 17 ++++++- 4 files changed, 91 insertions(+), 18 deletions(-) diff --git a/scripts/bw-compatibility-test/docker-compose.override.yaml b/scripts/bw-compatibility-test/docker-compose.override.yaml index 52e53d72b..51ca758b9 100644 --- a/scripts/bw-compatibility-test/docker-compose.override.yaml +++ b/scripts/bw-compatibility-test/docker-compose.override.yaml @@ -3,6 +3,7 @@ services: build: context: ../../ dockerfile: dev.Dockerfile + image: lnd-dev:backward-compat-test-build container_name: bob-pr restart: unless-stopped ports: @@ -40,4 +41,47 @@ services: --protocol.option-scid-alias --protocol.zero-conf --protocol.simple-taproot-chans - --trickledelay=50 \ No newline at end of file + --trickledelay=50 + + dave-pr: + image: lnd-dev:backward-compat-test-build + container_name: dave-pr + restart: unless-stopped + ports: + - 10014:10009 + - 9744:9735 + - 8094:8080 + networks: + regtest: + aliases: + - dave + volumes: + - "dave:/root/.lnd" + depends_on: + - bitcoind + command: > + lnd + --logdir=/root/.lnd + --alias=dave + --rpclisten=0.0.0.0:10009 + --restlisten=0.0.0.0:8080 + --color=#cccccc + --noseedbackup + --bitcoin.active + --bitcoin.regtest + --bitcoin.node=bitcoind + --bitcoind.rpchost=bitcoind + --bitcoind.rpcuser=lightning + --bitcoind.rpcpass=lightning + --bitcoind.zmqpubrawblock=tcp://bitcoind:28332 + --bitcoind.zmqpubrawtx=tcp://bitcoind:28333 + --debuglevel=debug + --externalip=dave + --tlsextradomain=dave + --accept-keysend + --protocol.option-scid-alias + --protocol.zero-conf + --protocol.simple-taproot-chans + --trickledelay=50 + --db.backend=sqlite + --db.use-native-sql diff --git a/scripts/bw-compatibility-test/docker-compose.yaml b/scripts/bw-compatibility-test/docker-compose.yaml index 8e39447c2..7860b4415 100644 --- a/scripts/bw-compatibility-test/docker-compose.yaml +++ b/scripts/bw-compatibility-test/docker-compose.yaml @@ -185,6 +185,8 @@ services: - "--tlsextradomain=dave" - "--accept-keysend" - "--trickledelay=50" + - "--db.backend=sqlite" + - "--db.use-native-sql" networks: regtest: diff --git a/scripts/bw-compatibility-test/network.sh b/scripts/bw-compatibility-test/network.sh index 77a558e8e..16749e460 100644 --- a/scripts/bw-compatibility-test/network.sh +++ b/scripts/bw-compatibility-test/network.sh @@ -5,28 +5,35 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "$DIR/.env" -# Global variable to keep track of which Bob container to use. -# Once Bob is upgraded to the PR version, this variable must -# be updated to 'bob-pr'. +# Global variables to keep track of which Bob and Dave container +# to use. Once Bob and Dave is upgraded to the PR version, this +# variable must be updated to 'bob-pr' and 'dave-pr` respectively. BOB=bob +DAVE=dave -# upgrade_bob shuts down the stable Bob container, upgrades the -# compose variables to use the PR version of Bob, rebuilds the -# Bob container, and starts the PR version of Bob. -function upgrade_bob() { - # Shutdown Bob. - compose_stop bob +# upgrade_node shuts down the stable container for a node (currently +# Bob or Dave), upgrades the compose variables, rebuilds the PR version, +# and starts it. +function upgrade_node() { + local node="$1" + local pr="${node}-pr" + local var_name="$(echo "$node" | tr '[:lower:]' '[:upper:]')" - # Upgrade the compose variables so that the Bob configuration + # Shutdown the stable node. + compose_stop "$node" + + # Upgrade the compose variables so that the node configuration # is swapped out for the PR version. compose_upgrade - export BOB=bob-pr - # Force the rebuild of the Bob container. - compose_rebuild bob-pr + # Export the PR version of the node. + export "$var_name"="$pr" - # This should now start with the new version of Bob. - compose_start bob-pr + # Force the rebuild of the PR version of the container. + compose_rebuild "$pr" + + # This should now start the PR version of the node. + compose_start "$pr" } # wait_for_nodes waits for all the nodes in the argument list to @@ -333,5 +340,10 @@ function charlie() { } function dave() { - docker exec -i dave lncli --network regtest "$@" + docker exec -i "$DAVE" lncli --network regtest "$@" } + +function dave-pr() { + docker exec -i dave-pr lncli --network regtest "$@" +} + diff --git a/scripts/bw-compatibility-test/test.sh b/scripts/bw-compatibility-test/test.sh index af22e5d1b..d8bb6660e 100755 --- a/scripts/bw-compatibility-test/test.sh +++ b/scripts/bw-compatibility-test/test.sh @@ -36,7 +36,7 @@ send_payment alice dave # Upgrade the compose variables so that the Bob configuration # is swapped out for the PR version. -upgrade_bob +upgrade_node bob # Wait for Bob to start. wait_for_node bob @@ -50,4 +50,19 @@ send_payment bob dave send_payment dave bob send_payment alice dave +# Upgrade the compose variables so that the Dave configuration +# is swapped out for the PR version. +upgrade_node dave + +wait_for_node dave +wait_for_active_chans dave 1 + +# Show that Dave is now running the current branch. +do_for print_version dave + +# Repeat the basic tests (after potential migraton). +send_payment bob dave +send_payment dave bob +send_payment alice dave + echo "🛡️⚔️🫡 Backwards compatibility test passed! 🫡⚔️🛡️"