From 481768ae23d1761765542c5e87546bc484224822 Mon Sep 17 00:00:00 2001 From: daywalker90 <8257956+daywalker90@users.noreply.github.com> Date: Sat, 8 Jun 2024 12:16:34 +0200 Subject: [PATCH] modernize cln tests and CI --- .github/workflows/build.yaml | 6 +++++- .github/workflows/cln-plugin.yaml | 16 ++++++++++------ watchtower-plugin/tests/conftest.py | 2 +- watchtower-plugin/tests/pyproject.toml | 4 ++-- watchtower-plugin/tests/test.py | 4 +--- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5eba8011..27801560 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,6 +1,10 @@ name: Continuous Integration Checks -on: [push, pull_request] +on: + push: + branches: + - master + pull_request: jobs: build: diff --git a/.github/workflows/cln-plugin.yaml b/.github/workflows/cln-plugin.yaml index b09064d4..4933975a 100644 --- a/.github/workflows/cln-plugin.yaml +++ b/.github/workflows/cln-plugin.yaml @@ -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: @@ -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 @@ -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 diff --git a/watchtower-plugin/tests/conftest.py b/watchtower-plugin/tests/conftest.py index eb03b751..7aa0d050 100644 --- a/watchtower-plugin/tests/conftest.py +++ b/watchtower-plugin/tests/conftest.py @@ -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 = { diff --git a/watchtower-plugin/tests/pyproject.toml b/watchtower-plugin/tests/pyproject.toml index abcb2e4a..f11efae3 100644 --- a/watchtower-plugin/tests/pyproject.toml +++ b/watchtower-plugin/tests/pyproject.toml @@ -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] diff --git a/watchtower-plugin/tests/test.py b/watchtower-plugin/tests/test.py index 2066d1b0..2c0061c1 100644 --- a/watchtower-plugin/tests/test.py +++ b/watchtower-plugin/tests/test.py @@ -1,5 +1,4 @@ import pytest -from pyln.client import RpcError from conftest import WT_PLUGIN @@ -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. @@ -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