Commit Graph

101 Commits

Author SHA1 Message Date
Daniel García Aubert
c1ed382949 Merge branch 'master' into dgaubert/ch87185/log-system-revamp-sql-api 2020-06-30 17:50:10 +02:00
Daniel García Aubert
762a240890 Breaking changes:
- Log system revamp:
  - Logs to stdout, disabled while testing
  - Use header `X-Request-Id`, or create a new `uuid` when no present, to identyfy log entries
  - Be able to set log level from env variable `LOG_LEVEL`, useful while testing: `LOG_LEVEL=info npm test`; even more human-readable: `LOG_LEVEL=info npm t | ./node_modules/.bin/pino-pretty`
  - Be able to reduce the footprint in the final log file depending on the environment
  - Use one logger for every service: Queries, Batch Queries (Jobs), and Data Ingestion (CopyTo/CopyFrom)
  - Stop using headers such as: `X-SQL-API-Log`, `X-SQL-API-Profiler`, and `X-SQL-API-Errors` as a way to log info.
  - Be able to tag requests with labels as an easier way to provide business metrics
  - Metro: Add log-collector utility (`metro`), it will be moved to its own repository. Attaching it here fro development purposes. Try it with the following command `LOG_LEVEL=info npm t | node metro`
  - Metro: Creates `metrics-collector.js` a stream to update Prometheus' counters and histograms and exposes them via Express' app (`:9145/metrics`). Use the ones defined in `grok_exporter`

Announcements:
- Profiler is always set. No need to check its existence anymore
- Unify profiler usage for every endpoint

Bug fixes:
- Avoid hung requests while fetching user identifier
2020-06-30 17:42:59 +02:00
Álvaro Manera
a4a100e65a respond with user-id and client in the headers
added headers to the test-client callback to be able to check them
2020-06-22 09:47:22 +02:00
Raúl Marín
349c4d72c4 Remove py_sleep test
I think this was added for historical reasons when upstream plpython
was not interrumpible, but that's not the case anymore.

Right now, either we adapt it to use plpython2u or plpython3u depending
on what's available, or we just remove it since upstream was fixed
several years ago. It's simpler to remove it
2020-04-13 12:33:25 +02:00
Daniel García Aubert
014158c968 Eslint errors 2019-12-26 17:46:27 +01:00
Daniel García Aubert
ac7d60d97d Fix lint errors 2019-12-26 14:51:09 +01:00
Daniel García Aubert
cc535b13d2 Use asert.strict mode 2019-12-26 14:23:21 +01:00
Daniel García Aubert
5a96dbb59c Run eslint --fix 2019-12-23 18:19:08 +01:00
Daniel García Aubert
06a47a8afc Changed folder structure to reflect application functionallity. Renamed files using hyphens instead of underscore to have a more consistent naming across the whole project 2019-10-03 18:24:39 +02:00
Raúl Marín
df523960a2
Fix test timeouts (#612)
* Tests: Work with re-runs

* Test: Adapt copyfrom test
- Reduce timeout from 10 to 1 ms.
- Increase the size of the file from 6 to 2016 rows.

* Use node-cartodb-psql 0.14.0

Ref: https://github.com/CartoDB/CartoDB-SQL-API/pull/612
2019-09-13 11:28:37 +02:00
Raul Marin
7b02bf13af Add tests for x-sqlapi-log length 2019-07-31 15:58:05 +02:00
Daniel García Aubert
4a342bce83 Merge branch 'master' into 498-pgtypes 2019-06-03 20:49:10 +02:00
Daniel García Aubert
bd9de97b79 Add tests 2019-06-03 20:42:49 +02:00
Raul Marin
be9f657958 Tests: Stop downloading individual files and use the full cartodb extension 2019-06-03 17:42:54 +02:00
Simon Martín
1c6cb293d4 testing log middleware 2019-02-27 10:09:08 +01:00
Daniel García Aubert
a616982ec3 Use strict mode 2018-10-24 15:42:33 +02:00
Rafa de la Torre
942b0073d8 Please jshint
As suggested by jshint:
- Remove the unused `res` return value
- Add a semicolon at the end of the file
2018-07-30 12:36:16 +02:00
Rafa de la Torre
2afe845d78 More descriptive comment about the intent of the code
As suggested in review comment.
2018-07-30 12:34:29 +02:00
Rafa de la Torre
bf1d5bf3b4 Early return instead of if/else
As suggested in review comment.
2018-07-30 12:31:57 +02:00
Rafa de la Torre
7277143c27 Merge remote-tracking branch 'origin/master' into 521-test-robustness-pgbouncer 2018-07-25 15:07:55 +02:00
Rafa de la Torre
44858df713 Add a mock for DB quota functions 2018-07-23 15:29:53 +02:00
Rafa de la Torre
20d1db78dc Helper to reset pgbouncer connections #521
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).
2018-07-19 18:43:17 +02:00
Simon Martín
5b87defb97 remove unneeded test table copy_endpoints_test2 2018-06-20 15:09:37 +02:00
Simon Martín
1174499dcf Merge branch 'master' into pgcopy-stream 2018-06-11 14:38:52 +02:00
Eneko Lakasta
03e484c5da FIX tests. Create jobs should return 403 if auth fails 2018-06-05 15:49:15 +02:00
Simon Martín
791967877c addining gzip support to copyfrom 2018-05-11 13:33:54 +02:00
Simon Martín
a2d0163ece ensuring works with sql parameter in query string 2018-05-08 12:51:52 +02:00
Simon Martín
41a585d761 test of copyfrom 2018-05-03 18:32:39 +02:00
Simon Martín
7e71f8dc3b supporting multipart requests 2018-05-03 18:32:15 +02:00
Simon Martín
bb929bf3dc adding rediscell files for linux and mac 2018-03-27 12:14:28 +02:00
Daniel García Aubert
418ec1304f Fix issue with auth fallback, it wasn't authenticated when apikey master was provided 2018-02-26 18:13:49 +01:00
Daniel García Aubert
bcf88093e9 Support basic-auth for batch api 2018-02-16 11:52:57 +01:00
Daniel García Aubert
2cadfe6f18 Add support for Basic Auth 2018-02-16 10:46:58 +01:00
Daniel García Aubert
ea6e8b5315 Implement fallback mechanism to be able to authenticate as usual in case of apikey is not found 2018-02-14 16:22:36 +01:00
Daniel García Aubert
974d219aad Add test for batch api 2018-02-13 19:47:00 +01:00
Daniel García Aubert
7ba95d28cc Add test to check regular api keys 2018-02-13 17:53:27 +01:00
Daniel García Aubert
5c7f5fbaa5 Merge branch 'master' into auth-api 2018-02-12 16:30:09 +01:00
Daniel García Aubert
d13dd9549e Implemtent first acceptance test to check auth-api happy cases 2017-11-23 17:39:28 +01:00
Simon Martín
63238ddd89 fix EOF line and forgotten 'only' 2017-11-17 13:17:42 +01:00
Simon Martín
3a5c28cced py_sleep postgres function 2017-11-17 13:09:37 +01:00
Daniel García Aubert
102a17c12b Fix test 2017-09-20 16:17:33 +02:00
Daniel García Aubert
b774a0ff5c Use method 'psql.end' exposed by 'cartodb-psql' instead of using the pg's one directly 2017-08-11 15:11:07 +02:00
Daniel García Aubert
fd39027c6c Add TODOs 2017-08-09 18:56:51 +02:00
Daniel García Aubert
74b92bc782 Implement tests 2017-08-09 12:53:59 +02:00
Daniel García Aubert
ee9709199a Expose method to configure user's
metadata
2017-08-09 12:51:21 +02:00
Daniel García Aubert
d7d2c73c3a Add test to check that export api handles user timeout limit 2017-08-04 17:12:49 +02:00
Daniel García Aubert
8b6ec95108 Add test to check timeout error while exporting 2017-08-03 19:15:24 +02:00
Raul Ochoa
afcb25be76 Dont debug that much 2016-12-19 15:30:03 +01:00
Raul Ochoa
38c3c4b4b0 More debug 2016-12-19 15:29:52 +01:00
Raul Ochoa
e2c916f4ea Add debugging info in assert.response 2016-12-19 15:29:41 +01:00