-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
800a453
commit 43f21fd
Showing
3 changed files
with
96 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
set -x | ||
# Get the directory of the script | ||
script_dir=$(dirname -- "$(readlink -f -- "$0")") | ||
|
||
cargo_toml_path="$script_dir/../Cargo.toml" | ||
|
||
# Use grep and awk to extract the version | ||
version=$(awk -F'=' '/^\[package\]/ { in_package = 1 } in_package && /version/ { gsub(/[" ]/, "", $2); print $2; exit }' "$cargo_toml_path") | ||
|
||
get_architecture() { | ||
machine=$(uname -m) | ||
|
||
case $machine in | ||
x86_64) | ||
echo 'x86_64-linux-gnu' | ||
;; | ||
armv7l) | ||
echo 'armv7-linux-gnueabihf' | ||
;; | ||
aarch64) | ||
echo 'aarch64-linux-gnu' | ||
;; | ||
*) | ||
echo "No self-compiled binary found and unsupported release-architecture: $machine" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
} | ||
architecture=$(get_architecture) | ||
|
||
github_url="https://github.com/daywalker90/vitality/releases/download/v$version/vitality-v$version-$architecture.tar.gz" | ||
|
||
|
||
# Download the file using curl | ||
if ! curl -L "$github_url" -o "$script_dir/vitality-v$version-$architecture.tar.gz"; then | ||
echo "Error downloading the file from $github_url" >&2 | ||
exit 1 | ||
fi | ||
|
||
# Extract the contents using tar | ||
if ! tar -xzvf "$script_dir/vitality-v$version-$architecture.tar.gz" -C "$script_dir"; then | ||
echo "Error extracting the contents of vitality-v$version-$architecture.tar.gz" >&2 | ||
exit 1 | ||
fi |
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,9 @@ | ||
#!/usr/bin/python | ||
|
||
|
||
from pyln.testing.fixtures import * # noqa: F403 | ||
from util import get_plugin # noqa: F401 | ||
|
||
|
||
def test_basic(node_factory, get_plugin): # noqa: F811 | ||
node = node_factory.get_node(options={"plugin": get_plugin}) |
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,42 @@ | ||
import logging | ||
import os | ||
import random | ||
import string | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
RUST_PROFILE = os.environ.get("RUST_PROFILE", "debug") | ||
COMPILED_PATH = Path.cwd() / "target" / RUST_PROFILE / "vitality" | ||
DOWNLOAD_PATH = Path.cwd() / "tests" / "vitality" | ||
|
||
|
||
@pytest.fixture | ||
def get_plugin(directory): | ||
if COMPILED_PATH.is_file(): | ||
return COMPILED_PATH | ||
elif DOWNLOAD_PATH.is_file(): | ||
return DOWNLOAD_PATH | ||
else: | ||
raise ValueError("No files were found.") | ||
|
||
|
||
def generate_random_label(): | ||
label_length = 8 | ||
random_label = "".join( | ||
random.choice(string.ascii_letters) for _ in range(label_length) | ||
) | ||
return random_label | ||
|
||
|
||
def generate_random_number(): | ||
return random.randint(1, 20_000_000_000_000_00_000) | ||
|
||
|
||
def pay_with_thread(rpc, bolt11): | ||
LOGGER = logging.getLogger(__name__) | ||
try: | ||
rpc.dev_pay(bolt11, dev_use_shadow=False) | ||
except Exception as e: | ||
LOGGER.debug(f"holdinvoice: Error paying payment hash:{e}") | ||
pass |