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

[Mint] Write test pipeline with LIGHTNING=True #128

Open
callebtc opened this issue Mar 5, 2023 · 8 comments
Open

[Mint] Write test pipeline with LIGHTNING=True #128

callebtc opened this issue Mar 5, 2023 · 8 comments
Labels
mint About the Nutshell mint tests Tests wallet About the Nutshell wallet

Comments

@callebtc
Copy link
Collaborator

callebtc commented Mar 5, 2023

All tests right now use LIGHTNING=False (a lot easier to test things) but it would be great if some also test Lightning functions. We would have to set up an LNbits instance in the tests (with FakeWallet, i.e. not using the real Lightning network).

@callebtc callebtc added wallet About the Nutshell wallet mint About the Nutshell mint tests Tests labels Apr 28, 2023
@AngusP
Copy link
Collaborator

AngusP commented May 18, 2023

I've used this testing library VCR a lot before, it's great for testing things that need to make requests where it's a pain to set up all the things you need to make requests to, or where responses can change over time making tests non-deterministic (e.g. secrets are ephemeral, tokens are invalid once spent, etc.).

It stores fixtures for responses and intercepts/monkey-patches the requesting library (works with requests, aiohttp, httpx, etc.) mocking the fixture in.

Also useful for catching regressions and unintended behaviour changes too

@callebtc
Copy link
Collaborator Author

Maybe @xphade would be interested in this issue. Emulating Lightning with FakeWallet should work well by now!

@xphade
Copy link
Collaborator

xphade commented Jul 4, 2023

Yes! I was pretty low on time the last couple of weeks but I would definitely like to work on the tests a bit next. So this would be something I can look into.

@dyKiU
Copy link
Contributor

dyKiU commented Aug 3, 2023

Here's a branch with cashu using python 3.10 and a cashu friendly version of lnbits as dependency.

https://github.com/dyKiU/cashu/tree/fake-lnbits-test

This is to avoid to a circular dependency of cashu -> lnbits -> old cashu
The script tests/lnbits_env.sh sets up env for lnbits, runs poetry install and launches lnbits in the background
Tests have been changed to use lightning and lnbits FakeWallet (!!! very broken still !!!)

@dyKiU
Copy link
Contributor

dyKiU commented Aug 28, 2023

So close to cashu tests with lighting via lnbits, until the main branch hit us with deps update. Now trying to get lnbits to use pydandic v2. This is challenging! Brain needs help https://github.com/dyKiU/cashu/tree/topic/tests_with_ln_brrr

@dni
Copy link
Collaborator

dni commented Aug 29, 2023

i want lnbits with pydantic v2 aswell :) first needs lnurl lib to use it though, and i am struggling to make it happen here. lnbits/lnurl#21

@dyKiU
Copy link
Contributor

dyKiU commented Aug 29, 2023

Thanks @dni, your repos made me think about a way around lnbits as a dependency using docker compose, but we actually need some of the lnbits python in the tests. The maintanance and package updates for cashu will be quite challenging with lnbits in tow.

@dni
Copy link
Collaborator

dni commented Aug 29, 2023

i would rather use the lib directly #297 like here with the bolt11 lib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mint About the Nutshell mint tests Tests wallet About the Nutshell wallet
Projects
None yet
Development

No branches or pull requests

5 participants