From e2095fc3274d0675519e2512d9dabc4e8b653bf9 Mon Sep 17 00:00:00 2001 From: bruwbird Date: Sun, 10 Nov 2024 09:56:21 +0900 Subject: [PATCH] fixup! clightning: add shutdown hook for plugin --- test/bitcoin_cln_test.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/bitcoin_cln_test.go b/test/bitcoin_cln_test.go index 07251459..efa01b3a 100644 --- a/test/bitcoin_cln_test.go +++ b/test/bitcoin_cln_test.go @@ -1218,3 +1218,33 @@ func Test_ClnCln_StuckChannels(t *testing.T) { err := lightningds[1].Rpc.Request(&clightning.SwapIn{SatAmt: 100, ShortChannelId: params.scid, Asset: "btc"}, &response) assert.Error(t, err) } + +func Test_Cln_shutdown(t *testing.T) { + IsIntegrationTest(t) + t.Parallel() + require := require.New(t) + bitcoind, lightningds, _ := clnclnSetup(t, uint64(math.Pow10(9))) + defer func() { + if t.Failed() { + filter := os.Getenv("PEERSWAP_TEST_FILTER") + pprintFail( + tailableProcess{ + p: bitcoind.DaemonProcess, + lines: defaultLines, + }, + tailableProcess{ + p: lightningds[0].DaemonProcess, + filter: filter, + lines: defaultLines, + }, + tailableProcess{ + p: lightningds[1].DaemonProcess, + lines: defaultLines, + }, + ) + } + }() + lightningds[0].Shutdown() + require.NoError(lightningds[0].WaitForLog( + "plugin-peerswap: Killing plugin: exited during normal operation", 30)) +}