Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytest: Add grpc based CLN client to test grpc coverage #5362

Merged
merged 18 commits into from
Jul 21, 2022

Commits on Jul 20, 2022

  1. msggen: Do not override method names when loading Schema

    We were overriding the name right when loading, which is bad since in
    some languages we use the method name as tag in the requests, thus
    renaming causes us to call something that isn't defined.
    
    Changelog-Fixed: cln-rpc: Fixed a naming mismatch for `ConnectPeer` causing `connectpeer` to be called on the JSON-RPC
    cdecker committed Jul 20, 2022
    Configuration menu
    Copy the full SHA
    7545671 View commit details
    Browse the repository at this point in the history
  2. pytest: Move generated grpc bindings to pyln-testing

    These may eventually end up in pyln-client, as they allow talking to
    the GRPC interface exposed by cln-grpc, however for now they are used
    for testing only. Once we have sufficient API and test coverage we can
    move them and leave imports in their place.
    cdecker committed Jul 20, 2022
    Configuration menu
    Copy the full SHA
    1df054e View commit details
    Browse the repository at this point in the history
  3. msggen: Add a new generator for grpc -> python converter

    To test the grpc interface we'll want to emulate the JSON-RPC
    interface as best we can, hence when talking to the grpc interface we
    want to convert back into a parsed JSON format as LightningRpc would
    have returned it. This is just the simplest way of closing the loop
    here:
    
    ```
      pyln-testing --grpc-> cln-grpc --grpc2json
         ^                                  |
         |                                  v
         |                               JSON-RPC
         |                                  |
        TEST                                v
         ^                                 CLN
         |                                  |
         |                                  v
      pyln-testing <-grpc2py-- cln-grpc <- json2grpc
    ```
    cdecker committed Jul 20, 2022
    Configuration menu
    Copy the full SHA
    7f46d74 View commit details
    Browse the repository at this point in the history
  4. pytest: Add a new RPC interface to talk to grpc

    This allows us to re-use existing tests (assuming the call and fields
    are covered by `cln-rpc` and `cln-grpc`) to test the full roundtrip
    from test over the grpc interface to the json-rpc interface and back
    again.
    
    You can switch to the grpc interface by setting the `CLN_TEST_GRPC`
    environment variable to 1, but for now only very few shims are
    implemented (due to the non-generated nature of LightningRpc).
    cdecker committed Jul 20, 2022
    Configuration menu
    Copy the full SHA
    07576bf View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    4724cde View commit details
    Browse the repository at this point in the history
  6. cln-grpc: Skip serializing fields when Option<Vec<T>> is empty too

    The CLN API is rather strict about the fact that we should skip
    providing a field whenever it is empty. Checking for `is_none` would
    still include empty arrays.
    
    Changelog-Fixed cln-rpc: Optional empty arrays will no longer be serialized in requests
    cdecker committed Jul 20, 2022
    Configuration menu
    Copy the full SHA
    3bef363 View commit details
    Browse the repository at this point in the history
  7. cln-plugin: Notify waiting tasks if the lightningd connection closes

    This is usually a signal that lightningd is shutting down, so notify
    any instance that is waiting on `plugin.join()`.
    
    Changelog-Fixed: cln-plugin: Fixed an issue where plugins would hang indefinitely despite `lightningd` closing the connection
    cdecker committed Jul 20, 2022
    Configuration menu
    Copy the full SHA
    8c16bfb View commit details
    Browse the repository at this point in the history
  8. msggen: Add stop method to generators

    We'll need this when testing the grpc interface in pyln-testing,
    otherwise tests just slowly die and wither.
    cdecker committed Jul 20, 2022
    Configuration menu
    Copy the full SHA
    39891ac View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    d60c264 View commit details
    Browse the repository at this point in the history
  10. pyln-testing: Add a couple of methods used in tests

    These are the most used methods in tests, so we can start getting our
    test coverage up.
    cdecker committed Jul 20, 2022
    Configuration menu
    Copy the full SHA
    6391cc7 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    48688ab View commit details
    Browse the repository at this point in the history
  12. msggen: Ignore state_changes in grpc2py

    It's being skipped in grpc so we don't have it later anyway.
    cdecker committed Jul 20, 2022
    Configuration menu
    Copy the full SHA
    0270d7f View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    1b9d683 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    80abccf View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    7ec272d View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    7fb54d8 View commit details
    Browse the repository at this point in the history
  17. schema: Add missing mindepth argument to fundchannel

    This was likely missed during the zeroconf PR.
    
    Changelog-None
    cdecker committed Jul 20, 2022
    Configuration menu
    Copy the full SHA
    487c8b0 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    0741499 View commit details
    Browse the repository at this point in the history