fedimint / fedimint

Federated E-Cash Mint
https://fedimint.org/
MIT License
536 stars 210 forks source link

Lightning Test Improvements #5168

Open m1sterc001guy opened 2 weeks ago

m1sterc001guy commented 2 weeks ago

With the development of the gateway (and devimint in parallel) our lightning tests have grown and morphed to a point where they are now difficult to work with. This issue describes the current issues and has a proposal for how to fix these tests going forward.

Issues

Proposal

At the time most of this test suite was created, we did not have devimint tests like we do today. I believe most of the LN tests should be refactored into standalone devimint tests. These can run in parallel much easier since they use their own daemons.

fedimint-ln-tests: should only contain tests verifying state machine transitions of the LN client. All necessary dependencies should be mocked (i.e gateway) integration_tests.rs: should only contain tests verifying state machine transitions of the gateway client. All necessary dependencies should be mocked (i.e LN node)

All other tests should be refactored to devimint tests.

GatewayTest should be deleted. fedimint-testing/src/ln/real.rs should be deleted.

Test Breakdown

fedimint-ln-tests

integration_tests.rs

Some of these can probably be combined together. There shouldn't be any RPCs in integration_tests.rs.

m1sterc001guy commented 19 hours ago

I've investigated trying to mock out the user client for the gateway tests and it looks like its going to be more complicated than initially hoped. We would need to manually write into each federation database to simulate the creation of a contract, which is error prone and might lead to bugs in the long run. For now I think its best to keep these tests with both the user client and gateway client.

We should still remove any RPCs and webserver requests in these tests though.