-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
212 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Check if both arguments are provided | ||
if [ "$#" -ne 2 ]; then | ||
echo "Usage: $0 <container_name> {getinfo|offer}" | ||
exit 1 | ||
fi | ||
|
||
# Function to get node pubkey | ||
getinfo() { | ||
docker compose logs "$1" | tac | grep "NODE_ID" | awk '{print $4}' | head -n 1 | ||
} | ||
|
||
# Function to get offer | ||
offer() { | ||
docker compose logs "$1" | tac | grep "CREATED_OFFER" | sed 's/.*CREATED_OFFER: //' | head -n 1 | ||
} | ||
|
||
# Main script logic | ||
case "$2" in | ||
getinfo) | ||
getinfo "$1" | ||
;; | ||
offer) | ||
offer "$1" | ||
;; | ||
*) | ||
echo "Invalid command. Usage: $0 <container_name> {getinfo|offer}" | ||
exit 1 | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
################# | ||
# Builder image # | ||
################# | ||
FROM rust:1.78-bookworm AS builder | ||
|
||
# References for lndk | ||
ARG LDK_NODE_REF=e6ff79a6f1d3b6e182baa86a110e75854189dc94 | ||
|
||
# Add utils | ||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
protobuf-compiler \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Set the working directory in the Docker image | ||
WORKDIR /usr/src | ||
|
||
# Grab and install the latest version of lndk | ||
RUN git clone https://github.com/tnull/ldk-node-offers-receive-test.git . \ | ||
&& git reset --hard ${LDK_NODE_REF} \ | ||
&& cargo build --release | ||
|
||
# Copy the compiled binaries to /bin/ | ||
RUN cp ./target/release/ldk-node-offers-receive-test /bin/ | ||
|
||
############### | ||
# final image # | ||
############### | ||
FROM debian:bookworm-slim AS final | ||
|
||
# Add utils | ||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
bash \ | ||
curl \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy the compiled binaries from the builder image | ||
COPY --from=builder /bin/ldk-node-offers-receive-test /usr/local/bin/ | ||
|
||
ENTRYPOINT ["ldk-node-offers-receive-test"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bats | ||
|
||
# set -eo pipefail | ||
# set -x | ||
|
||
setup() { | ||
load 'test_helper/common-setup' | ||
_common_setup | ||
|
||
source "$PROJECT_ROOT/test/functions.sh" | ||
} | ||
|
||
@test "Generate bolt12 offer on ldknode1 and pay from lndk1 (lnd1 -> ldknode1)" { | ||
run generate_offer_ldknode 'ldknode1' | ||
assert_line --partial 'lno' | ||
|
||
run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 10000 | ||
assert_line --partial 'Successfully paid for offer!' | ||
} | ||
|
||
@test "Generate bolt12 offer on ldknode2 and pay from lndk1 (lnd1 -> ldknode2)" { | ||
run generate_offer_ldknode 'ldknode2' | ||
assert_line --partial 'lno' | ||
|
||
run $PROJECT_ROOT/bin/lndk-cli lndk1 pay-offer $output 10000 | ||
assert_line --partial 'Successfully paid for offer!' | ||
} |