Skip to content

itest+lntest: speed up test setup#9195

Merged
guggero merged 4 commits into
lightningnetwork:masterfrom
yyforyongyu:optimize-itest-setup
Oct 17, 2024
Merged

itest+lntest: speed up test setup#9195
guggero merged 4 commits into
lightningnetwork:masterfrom
yyforyongyu:optimize-itest-setup

Conversation

@yyforyongyu
Copy link
Copy Markdown
Member

Turns out we are doing 200 GetRawMempool RPC calls when setting up the test case, which is now optimized.

Before this change,

--- PASS: TestLightningNetworkDaemon (68.79s)
    --- PASS: TestLightningNetworkDaemon/tranche00/17-of-174/btcd/list_channels (13.86s)

After this change,

--- PASS: TestLightningNetworkDaemon (29.66s)
    --- PASS: TestLightningNetworkDaemon/tranche00/17-of-174/btcd/list_channels (13.89s)

Also changes the methods so we don't pass pointers of chainhash.Hash anymore in the tests.

Thanks @bitromortac for pointing this out!

This commit fixes the methods used in `lntest` so they stop using
pointers to chainhash.
So we only need to do one `GetRawMempool` lookup when checking the
exclusion of multiple txns.
@yyforyongyu yyforyongyu added optimization itests Issues related to integration tests. size/micro small bug fix or feature, less than 15 mins of review, less than 250 labels Oct 16, 2024
@yyforyongyu yyforyongyu added this to the v0.19.0 milestone Oct 16, 2024
Copy link
Copy Markdown
Collaborator

@bhandras bhandras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! LGTM 🎉

Copy link
Copy Markdown
Collaborator

@bitromortac bitromortac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉, great improvement for single itest runs, thanks for the investigation!

Comment thread lntest/harness.go
// above a good number of confirmations.
const totalTxes = 200
h.MineBlocksAndAssertNumTxes(numBlocksSendOutput, totalTxes)
h.MineBlocks(numBlocksSendOutput)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: may move this change to its own commit, the motivation is not clear

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a mistake...was doing a performance comparison and forgot to remove it🤦🏻
will remove it in my other PRs since it's minor

Comment thread lntest/miner/miner.go
Comment on lines +321 to +322
// We require the RPC call to be succeeded and won't wait for
// it as it's an unexpected behavior.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: not sure I understand that comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be copy/paste, appears in a couple of other places. I interpret it as: "this will call ht.t.Fail() if it doesn't succeed, which will abort the test, so we can continue below assuming it didn't fail".

Copy link
Copy Markdown
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

Comment thread lntest/miner/miner.go
Comment on lines +321 to +322
// We require the RPC call to be succeeded and won't wait for
// it as it's an unexpected behavior.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be copy/paste, appears in a couple of other places. I interpret it as: "this will call ht.t.Fail() if it doesn't succeed, which will abort the test, so we can continue below assuming it didn't fail".

@guggero guggero merged commit f46ae2f into lightningnetwork:master Oct 17, 2024
@yyforyongyu yyforyongyu deleted the optimize-itest-setup branch October 17, 2024 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

itests Issues related to integration tests. optimization size/micro small bug fix or feature, less than 15 mins of review, less than 250

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants