From 9f66f5b3c90a018398fcebce159808a6d868cbfd Mon Sep 17 00:00:00 2001 From: Jesse de Wit Date: Mon, 16 Oct 2023 22:21:43 +0200 Subject: [PATCH] add integration tests for LND lsp CLN client --- .github/actions/setup-clightning/action.yaml | 1 + .github/workflows/integration_tests.yaml | 12 ++++++++---- go.mod | 2 +- itest/cln_breez_client.go | 3 +++ itest/lspd_node.go | 4 ++++ itest/lspd_test.go | 15 +++++++++++++-- itest/notification_test.go | 2 +- itest/regular_forward_test.go | 2 +- 8 files changed, 32 insertions(+), 9 deletions(-) diff --git a/.github/actions/setup-clightning/action.yaml b/.github/actions/setup-clightning/action.yaml index 37b39348..e078d1f1 100644 --- a/.github/actions/setup-clightning/action.yaml +++ b/.github/actions/setup-clightning/action.yaml @@ -74,6 +74,7 @@ runs: - name: Install dependencies if: steps.cache-core-lightning.outputs.cache-hit != 'true' run: | + sudo apt-get update -y sudo apt-get install -y autoconf automake build-essential git libtool libgmp-dev libsqlite3-dev python3 python3-pip net-tools zlib1g-dev libsodium-dev gettext valgrind libpq-dev shellcheck cppcheck libsecp256k1-dev jq sudo apt-get remove -y protobuf-compiler curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.12.0/protoc-3.12.0-linux-x86_64.zip diff --git a/.github/workflows/integration_tests.yaml b/.github/workflows/integration_tests.yaml index 01e9c858..c7d485c7 100644 --- a/.github/workflows/integration_tests.yaml +++ b/.github/workflows/integration_tests.yaml @@ -83,7 +83,7 @@ jobs: - setup-lnd-lsp - setup-cln - build-lspd - name: test ${{ matrix.implementation }} ${{ matrix.test }} + name: test ${{ matrix.lsp }}-lsp ${{ matrix.client }}-client ${{ matrix.test }} strategy: max-parallel: 6 matrix: @@ -103,7 +103,11 @@ jobs: testOfflineNotificationRegularForward, testOfflineNotificationZeroConfChannel, ] - implementation: [ + lsp: [ + LND, + CLN + ] + client: [ LND, CLN ] @@ -114,8 +118,8 @@ jobs: - name: Run and Process Test State uses: ./.github/actions/test-lspd with: - TESTRE: "TestLspd/${{ matrix.implementation }}-lspd:_${{ matrix.test }}" - artifact-name: TestLspd-${{ matrix.implementation }}-lspd_${{ matrix.test }} + TESTRE: "TestLspd/${{ matrix.lsp }}-lsp-${{ matrix.client}}-client:_${{ matrix.test }}" + artifact-name: TestLspd-${{ matrix.lsp }}-lsp-${{ matrix.client}}-client_${{ matrix.test }} bitcoin-version: ${{ env.BITCOIN_VERSION }} LSP_REF: ${{ env.LSP_REF }} CLIENT_REF: ${{ env.CLIENT_REF }} diff --git a/go.mod b/go.mod index 4525e3eb..72405bc5 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/aws/aws-sdk-go v1.34.0 - github.com/breez/lntest v0.0.26 + github.com/breez/lntest v0.0.28 github.com/btcsuite/btcd v0.23.5-0.20230228185050-38331963bddd github.com/btcsuite/btcd/btcec/v2 v2.3.2 github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 diff --git a/itest/cln_breez_client.go b/itest/cln_breez_client.go index 357e0515..38dbe2af 100644 --- a/itest/cln_breez_client.go +++ b/itest/cln_breez_client.go @@ -38,6 +38,9 @@ def on_openchannel(openchannel, plugin, **kwargs): plugin.log(repr(openchannel)) mindepth = int(0) + if openchannel['funding_msat'] == 200000000: + return {'result': 'continue'} + plugin.log(f"This peer is in the zeroconf allowlist, setting mindepth={mindepth}") return {'result': 'continue', 'mindepth': mindepth} diff --git a/itest/lspd_node.go b/itest/lspd_node.go index fcbb5ec9..8d24d464 100644 --- a/itest/lspd_node.go +++ b/itest/lspd_node.go @@ -121,6 +121,10 @@ func newLspd(h *lntest.TestHarness, mem *mempoolApi, name string, nodeConfig *co if nodeConfig.MinConfs != nil { conf.MinConfs = nodeConfig.MinConfs } + + if nodeConfig.LegacyOnionTokens != nil { + conf.LegacyOnionTokens = nodeConfig.LegacyOnionTokens + } } log.Printf("%s: node config: %+v", name, conf) diff --git a/itest/lspd_test.go b/itest/lspd_test.go index 098d68a1..57e982ef 100644 --- a/itest/lspd_test.go +++ b/itest/lspd_test.go @@ -14,8 +14,19 @@ var defaultTimeout time.Duration = time.Second * 120 func TestLspd(t *testing.T) { testCases := allTestCases - runTests(t, testCases, "LND-lspd", lndLspFunc, lndClientFunc) - runTests(t, testCases, "CLN-lspd", clnLspFunc, clnClientFunc) + runTests(t, testCases, "LND-lsp-CLN-client", lndLspFunc, clnClientFunc) + runTests(t, testCases, "LND-lsp-LND-client", legacyOnionLndLspFunc, lndClientFunc) + runTests(t, testCases, "CLN-lsp-CLN-client", clnLspFunc, clnClientFunc) +} + +func legacyOnionLndLspFunc(h *lntest.TestHarness, m *lntest.Miner, mem *mempoolApi, c *config.NodeConfig) LspNode { + cfg := c + if cfg == nil { + cfg = &config.NodeConfig{} + } + + cfg.LegacyOnionTokens = []string{"hello"} + return lndLspFunc(h, m, mem, cfg) } func lndLspFunc(h *lntest.TestHarness, m *lntest.Miner, mem *mempoolApi, c *config.NodeConfig) LspNode { diff --git a/itest/notification_test.go b/itest/notification_test.go index d4c0daf2..06780f04 100644 --- a/itest/notification_test.go +++ b/itest/notification_test.go @@ -117,7 +117,7 @@ func testOfflineNotificationRegularForward(p *testParams) { log.Print("Opening channel between lsp and Breez client") channelLB := p.lsp.LightningNode().OpenChannel(p.BreezClient().Node(), &lntest.OpenChannelOptions{ AmountSat: 200000, - IsPublic: false, + IsPublic: true, }) log.Print("Waiting for channel between Alice and the lsp to be ready.") diff --git a/itest/regular_forward_test.go b/itest/regular_forward_test.go index cd788b6f..40907b04 100644 --- a/itest/regular_forward_test.go +++ b/itest/regular_forward_test.go @@ -24,7 +24,7 @@ func testRegularForward(p *testParams) { log.Print("Opening channel between lsp and Breez client") channelLB := p.lsp.LightningNode().OpenChannel(p.BreezClient().Node(), &lntest.OpenChannelOptions{ AmountSat: 200000, - IsPublic: false, + IsPublic: true, }) log.Print("Waiting for channel between Alice and the lsp to be ready.")