Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: add basic pytest for plugins repo #147

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion coffee.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
plugin:
name: lnmetrics
version: 0.0.6-rc2
version: 0.0.6
lang: go
install: |
make dep
Expand Down
56 changes: 56 additions & 0 deletions tests/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash
set -x

latest_release_tag=$(grep '^[[:space:]]*version:' coffee.yaml | awk '{print $2}' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')

# Get the directory of the script
script_dir=$(dirname -- "$(readlink -f -- "$0")")

name="go-lnmetrics.reporter"
repo="LNOpenMetrics"


get_platform_file_end() {
machine=$(uname -m)
kernel=$(uname -s)

case $kernel in
Darwin)
echo 'darwin-amd64'
;;
Linux)
case $machine in
x86_64)
echo 'linux-amd64'
;;
armv7l)
echo 'linux-arm'
;;
aarch64)
echo 'linux-arm64'
;;
*)
echo "No self-compiled binary found and unsupported release-architecture: $machine" >&2
exit 1
;;
esac
;;
*)
echo "No self-compiled binary found and unsupported OS: $kernel" >&2
exit 1
;;
esac
}
platform_file_end=$(get_platform_file_end)
archive_file="go-lnmetrics-$platform_file_end"

github_url="https://github.com/$repo/$name/releases/download/v$latest_release_tag/$archive_file"


# Download the archive using curl
if ! curl -L "$github_url" -o "$script_dir/go-lnmetrics"; then
echo "Error downloading the file from $github_url" >&2
exit 1
fi

chmod u+x "$script_dir/go-lnmetrics"
24 changes: 24 additions & 0 deletions tests/test_lnmetrics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/python


import os

from pyln.testing.fixtures import * # noqa: F403

test_binary = os.path.join(os.path.dirname(__file__), "go-lnmetrics")


def test_basic(node_factory):
node = node_factory.get_node(
options={
"plugin": test_binary,
"lnmetrics-urls": "https://api.lnmetrics.info/query",
"lnmetrics-noproxy": True,
}
)
# node.rpc.call("metric_one", {"start": "now"})
# node.rpc.call("raw-local-score")
# node.rpc.call("lnmetrics-force-update")
# node.rpc.call("lnmetrics-info")
# node.rpc.call("lnmetrics-clean")
assert False
Loading