Skip to content

Commit

Permalink
modernize cln tests and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
daywalker90 committed Jun 30, 2024
1 parent c9f82bc commit 481768a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Continuous Integration Checks

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:

jobs:
build:
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/cln-plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
name: CI tests for CLN watchtower-plugin

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:

env:
bitcoind_version: 0.20.1
cln_version: 0.12.1
bitcoind_version: "27.0"
cln_version: "24.02.2"

jobs:
cache-cln:
Expand All @@ -28,10 +32,10 @@ jobs:
PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring
if: ${{ steps.cache-cln.outputs.cache-hit != 'true' }}
run: |
sudo apt-get update && sudo apt-get install gettext
sudo apt-get update && sudo apt-get install -y gettext protobuf-compiler
git clone https://github.com/ElementsProject/lightning.git && cd lightning && git checkout v${{ env.cln_version }}
pip install --user poetry && poetry install
./configure --enable-developer && poetry run make
./configure && poetry run make
cln-plugin:
needs: cache-cln
Expand Down Expand Up @@ -69,4 +73,4 @@ jobs:
- name: Run tests
run: |
cd watchtower-plugin/tests
DEVELOPER=1 SLOW_MACHINE=1 poetry run pytest test.py --log-cli-level=INFO -s
VALGRIND=0 SLOW_MACHINE=1 poetry run pytest test.py --log-cli-level=INFO -s
2 changes: 1 addition & 1 deletion watchtower-plugin/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import subprocess

from pyln.testing.fixtures import * # noqa: F401,F403
from pyln.testing.utils import DEVELOPER, BITCOIND_CONFIG, TailableProc
from pyln.testing.utils import BITCOIND_CONFIG, TailableProc

WT_PLUGIN = Path("~/.cargo/bin/watchtower-client").expanduser()
TEOSD_CONFIG = {
Expand Down
4 changes: 2 additions & 2 deletions watchtower-plugin/tests/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ black = "^22.6.0"
[tool.poetry.dev-dependencies]
pytest = "^7.1.2"
pytest-timeout = "^2.1.0"
pyln-testing = "^0.12.1"
pyln-client = "^23.11"
pyln-testing = "^24.2.1"
pyln-client = "^24.2.1"


[build-system]
Expand Down
4 changes: 1 addition & 3 deletions watchtower-plugin/tests/test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pytest
from pyln.client import RpcError
from conftest import WT_PLUGIN


Expand All @@ -16,7 +15,6 @@ def change_endianness(x):
return b[::-1].hex()


@pytest.mark.developer("Requires dev_sign_last_tx")
def test_watchtower(node_factory, bitcoind, teosd):
"""
Test watchtower hook.
Expand Down Expand Up @@ -60,7 +58,7 @@ def test_watchtower(node_factory, bitcoind, teosd):
penalty_txid = bitcoind.rpc.getrawmempool()[0]

# The channel still exists between the two peers, but it's on chain
assert l1.rpc.listpeers()["peers"][0]["channels"][0]["state"] == "ONCHAIN"
assert l1.rpc.listpeerchannels()["channels"][0]["state"] == "ONCHAIN"
assert l2.rpc.getappointment(tower_id, locator)["status"] == "dispute_responded"

# Generate blocks until the penalty gets irrevocably resolved
Expand Down

0 comments on commit 481768a

Please sign in to comment.