-
Notifications
You must be signed in to change notification settings - Fork 912
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
Fix default args, fix flake #5460
Merged
niftynei
merged 5 commits into
ElementsProject:master
from
rustyrussell:guilt/fix-default-args
Jul 26, 2022
Merged
Fix default args, fix flake #5460
niftynei
merged 5 commits into
ElementsProject:master
from
rustyrussell:guilt/fix-default-args
Jul 26, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ACK 44272b2 |
rustyrussell
force-pushed
the
guilt/fix-default-args
branch
from
July 26, 2022 01:56
44272b2
to
bdd1178
Compare
Fix skipIf typo, add YA flake fix! |
rustyrussell
force-pushed
the
guilt/fix-default-args
branch
from
July 26, 2022 01:58
bdd1178
to
fb22f3b
Compare
ACK fb22f3b |
…TS=1) As we'll see in the next patch, this wasn't *supposed* to work wihtout dblog-file, but it did, creating a dblog called "null". Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
I wondered how `tests/plugins/dblog.py` worked, since it is supposed to fail unless the `dblog-file` arg is set: ``` @plugin.init() def init(configuration, options, plugin): if not plugin.get_option('dblog-file'): raise RpcError("No dblog-file specified") ``` But it was set to "null". That's because 'None' in python is turned into a literal JSON "null", and we take that as the default value. We also cleanup the popt->description double-assignment (a leftover from when this was optional). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Fixed: plugins: setting the default value of a parameter to `null` is the same as not setting it (pyln plugins did this!).
This was weird. Here is the message (with \n turned into real new lines): ``` 2022-07-24T07:20:08.9144998Z Plugin '/home/runner/work/lightning/lightning/tests/plugins/dblog.py' returned an invalid response to the db_write hook: {"jsonrpc": "2.0", "id": 40, "error": {"code": -32600, "message": "Error while processing db_write: UNIQUE constraint failed: shachain_known.shachain_id, shachain_known.pos", "traceback": "Traceback (most recent call last): File \"/home/runner/work/lightning/lightning/contrib/pyln-client/pyln/client/plugin.py\", line 631, in _dispatch_request result = self._exec_func(method.func, request) File \"/home/runner/work/lightning/lightning/contrib/pyln-client/pyln/client/plugin.py\", line 616, in _exec_func return func(*ba.args, **ba.kwargs) File \"/home/runner/work/lightning/lightning/tests/plugins/dblog.py\", line 45, in db_write plugin.conn.execute(c) sqlite3.IntegrityError: UNIQUE constraint failed: shachain_known.shachain_id, shachain_known.pos "}} ``` Finally, I realized that we *kill* l2: this means it has updated the plugin db but not the real db. This is expected: a real backup plugin would handle this case. Simply disable the test for this case. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Otherwise we left it in the cache, causing "New cmd replacing old" messages.
On fast machines, we don't get failures sometimes on commando commands. (*But* we still got "New cmd replacing old" messages, which is how I realized we weren't freeing them promptly, hence the previous fix). ``` # Should have exactly one discard msg from each discard > nodes[0].daemon.wait_for_logs([r"New cmd from .*, replacing old"] * discards) tests/test_plugin.py:2839: ... > raise TimeoutError('Unable to find "{}" in logs.'.format(exs)) E TimeoutError: Unable to find "[]" in logs. ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
rustyrussell
force-pushed
the
guilt/fix-default-args
branch
from
July 26, 2022 04:12
fb22f3b
to
95baee5
Compare
Trivial dumb typo fix. Ack 95baee5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Turns out python plugins saw the string "null" as their options if there was no default value. Best to fix this in core, and ship in 0.12.
I appended two commando fixes which I found while testing this locally...