You may be wondering: why it checks for 1.99 GB but it says the limit is
at 2 GB? The actual hard-limit is set in nginx, but we want the app to
catch this error condition and report it properly to the client,
hence the 0.5 % license.
In order to give the DB quota middleware a chance of getting executed,
increase the 1 ms timeout to 10 ms. This is short but enough, as the
quota mocks are constant functions.
This is needed to make the setup a little bit more robust: when trying
to delete the test database, it won't be able if there are "idle
sessions" in the db (that is, connections from pgbouncer to the test
database).
Otherwise it fails when trying to create the database, because there's
already one with the same name.
This sends a PAUSE and RESUME to pgbouncer (in case there's one) before
and after executing tests, to make sure new connections are established
in the tests.
This may be especially important when role or session settings are
modified in the DB (same happens in prod, BTW).
pgbouncer does not support the `--client-min-messages` option. Actually
it fails connections if used like that with this somewhat cryptic
message:
```
psql: ERROR: Unsupported startup parameter: options
```
In order to be able to execute tests against pgbouncer port (which is
desirable IMO), we either need to remove that option (with little to no
impact) or change the lines above to choose the batch API port from the
config.
Mind that this affects just test setup.
For the endpoint `api/v2/sql` the parameter to pass queries is `q`.
It is important to fix because it is in the SQL API front page. Thanks
@ibrahimmenem for spotting it.