Open m1sterc001guy opened 2 weeks 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.
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
fedimint-ln-tests
, the gateway'sintegration_tests.rs
, and tests that exist indevimint
. When adding new tests its unclear where they should go.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
text_can_attach_extra_meta_to_receive_operation
- goodcannot_pay_same_internal_invoice_twice
- goodgateway_protects_preimage_for_payment
- should be devimint testcannot_pay_same_external_invoice_twice
- gateway needs to be mockedmakes_internal_payments_within_federation
- gateway needs to be mockedcan_receive_for_other_user
- gateway needs to be mockedcan_receive_for_other_user_tweaked
- gateway needs to be mockedrejects_wrong_network_invoice
- gateway needs to be mockedintegration_tests.rs
test_gateway_client_pay_valid_invoice
- no real LNtest_can_change_default_routing_fees
- should be devimint testtest_can_change_federation_routing_fees
- should be devimint testtest_gateway_enforces_fees
- should be devimint testtest_gateway_cannot_claim_invalid_preimage
- no real LNtest_gateway_client_pay_unpayable_invoice
- no real LNtest_gateway_client_intercept_valid_htlc
- no real LNtest_gateway_client_intercept_offer_does_not_exist
- no real LNtest_gateway_client_intercept_htlc_no_funds
- no real LNtest_gateway_client_intercept_htlc_invalid_offer
- no real LNtest_gateway_register_with_federation
- should be devimint testtest_gateway_cannot_pay_expired_invoice
- no real LNtest_gateway_filters_route_hints_by_inbound
- should be devimint testtest_cannot_connect_same_federation
- should be devimint testtest_gateway_configuration
- should be devimint testtest_gateway_supports_connecting_multiple_federations
- should be devimint testtest_gateway_shows_info_about_all_connected_federations
- should be devimint testtest_gateway_can_leave_connected_federations
- should be devimint testtest_gateway_shows_balance_for_any_connected_federations
- should be devimint testtest_gateway_executes_swaps_between_connected_federations
- remove webserver RPCsSome of these can probably be combined together. There shouldn't be any RPCs in
integration_tests.rs
.