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

Add a configuration to test expanded SQL statements during pytest #4092

Closed
wants to merge 4 commits into from

Conversation

cdecker
Copy link
Member

@cdecker cdecker commented Sep 24, 2020

This builds on top of #4090 and adds the dblog.py plugin if running on sqlite3 and if the plugin doesn't clash with other command line arguments.

It also runs this checker configuration in one of the faster travis configurations so we should be safe for this kind of issue in the future.

Closes #4091

m-schmoock and others added 4 commits September 24, 2020 16:34
I discovered this accidentally when using the `tests/plugins/dblog.py`
plugin on another testcase: tests/test_connection.py::test_fail_unconfirmed

There the plugin/hook crashes because it can't execute the statement:
```json
{
  "jsonrpc": "2.0",
  "id": 34,
  "error": {
    "code": -32600,
    "message": "Error while processing db_write: unrecognized token: \"174WHERE\"",
    "traceback": "Traceback (most recent call last):\n  File \"/home/will/projects/lightning.git/contrib/pyln-client/pyln/client/plugin.py\", line 535, in _dispatch_request\n    result = self._exec_func(method.func, request)\n  File \"/home/will/projects/lightning.git/contrib/pyln-client/pyln/client/plugin.py\", line 520, in _exec_func\n    return func(*ba.args, **ba.kwargs)\n  File \"/home/will/projects/lightning.git/tests/plugins/dblog.py\", line 45, in db_write\n    plugin.conn.execute(c)\nsqlite3.OperationalError: unrecognized token: \"174WHERE\"\n"
  }
}
```

Changelog-Fixed: plugin: Regression with SQL statement expansion that could result in invalid statements being passed to the `db_write` hook.
This can be used to find instances of unparseable expanded SQL statements like
the one fixed in ElementsProject#4090
@cdecker
Copy link
Member Author

cdecker commented Sep 25, 2020

Closing in favor of #4090 which cherry-picked my changes 😉

@cdecker cdecker closed this Sep 25, 2020
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.

2 participants