Skip to content

Commit 6099d31

Browse files
committed
itest: add integrated-mode fail-fast test for tapd startup errors
1 parent df87ae8 commit 6099d31

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

itest/litd_mode_integrated_test.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,38 @@ func testModeIntegrated(ctx context.Context, net *NetworkHarness,
465465
)
466466
}
467467

468+
// testCriticalTapStartupFailure ensures LiT exits quickly when a critical
469+
// integrated sub-server (tapd) fails to start during boot.
470+
func testCriticalTapStartupFailure(ctx context.Context, net *NetworkHarness,
471+
t *harnessTest) {
472+
473+
// Force tapd to bind to an invalid port to guarantee a startup failure
474+
// in integrated mode.
475+
node, err := net.NewNode(
476+
t.t, "FailFastTap", nil, false, false,
477+
"--taproot-assets.rpclisten=127.0.0.1:65536",
478+
)
479+
require.NoError(t.t, err)
480+
481+
defer func() {
482+
_ = net.ShutdownNode(node)
483+
}()
484+
485+
select {
486+
case procErr := <-net.ProcessErrors():
487+
require.ErrorContains(t.t, procErr, "invalid port")
488+
case <-time.After(15 * time.Second):
489+
t.Fatalf("expected tapd startup failure to be reported")
490+
}
491+
492+
// LiT should terminate promptly after the critical startup failure.
493+
select {
494+
case <-node.processExit:
495+
case <-time.After(5 * time.Second):
496+
t.Fatalf("litd did not exit after tapd startup failure")
497+
}
498+
}
499+
468500
// integratedTestSuite makes sure that in integrated mode all daemons work
469501
// correctly.
470502
func integratedTestSuite(ctx context.Context, net *NetworkHarness, t *testing.T,

itest/litd_test_list_on_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ var allTestCases = []*testCase{
8787
test: testCustomChannelsHtlcForceCloseMpp,
8888
noAliceBob: true,
8989
},
90+
{
91+
name: "critical tap startup failure",
92+
test: testCriticalTapStartupFailure,
93+
noAliceBob: true,
94+
},
9095
{
9196
name: "custom channels balance consistency",
9297
test: testCustomChannelsBalanceConsistency,

0 commit comments

Comments
 (0)