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 system-postgres DB provider and allow pyln-testing to run on older CLN versions too #6947

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

cdecker
Copy link
Member

@cdecker cdecker commented Dec 15, 2023

This tackles two problems:

  • By using a system-wide installed postgres we can cut down on the overhead of spinning the DB up and down for the tests. More importantly this allows us to run the tests as root, since we no longer run into postgres complaining about not wanting to run as root. This is for example the case if we run in CI or in docker, where the files are often owned by root, and having to switch to another user can result in permission issues.
  • The recent v23.11 release of pyln-testing broke backwards compatibility with prior CLN versions because it just bluntly assumes --developer is a valid CLI option. It was introduced in v23.11 and therefore causes all prior versions to just abort().

@cdecker cdecker force-pushed the 20231215-pytest-system-progres branch from 1157260 to 8a5ebef Compare December 29, 2023 13:52
@cdecker cdecker force-pushed the 20231215-pytest-system-progres branch 3 times, most recently from a2dae52 to 7cbfe67 Compare January 23, 2024 11:26
@cdecker
Copy link
Member Author

cdecker commented Jan 23, 2024

Fixed a minor issue when parsing non-release version.

@cdecker cdecker force-pushed the 20231215-pytest-system-progres branch from 84a409b to 3031ff6 Compare January 23, 2024 17:47
@cdecker cdecker changed the title pytest: Add system-progres DB provider and allow pyln-testing to run on older CLN versions too pytest: Add system-postgres DB provider and allow pyln-testing to run on older CLN versions too Jan 26, 2024
@cdecker cdecker force-pushed the 20231215-pytest-system-progres branch 5 times, most recently from 48dc658 to 109d384 Compare February 2, 2024 08:31
@cdecker cdecker force-pushed the 20231215-pytest-system-progres branch 3 times, most recently from e0a4d20 to 9a50c77 Compare February 9, 2024 13:55
@cdecker cdecker force-pushed the 20231215-pytest-system-progres branch 2 times, most recently from 3fe35ed to c1f52cb Compare February 21, 2024 11:02
Spinning `postgres` up and down for the tests can be rather slow, and
forces us to switch user away from `root`. The forced switch away
from `root` is generally a good idea, but rather annoying in CI,
where the file permissions often just take on `root` as default.

The system-wide postgres requires extra config, the DB DSN, but allows
us to have either a remote DB, or a system-provided one, or another
container in `docker-compose`.

Changelog-Added pyln-testing: Added a `system-postgres` DB provider to run tests against a system-wide or even remote DB.
We changed the way we configure CLN to run in developer mode, which
promptly broke anything that wasn't v23.11 and later. So we parse the
version, and make it comparable, so we can determine what to do on the
fly, and maintain a better backwards compatibility.

Changelog-Changed: pyln-testing: pyln-testing is now version-aware and can customize the run based on the version.
We weren't compiling with tags, causing the version command to just
return the git commit hash, rather than a valid version string.
@cdecker cdecker force-pushed the 20231215-pytest-system-progres branch from c1f52cb to ae9c71c Compare February 21, 2024 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant