Commit Graph

826 Commits

Author SHA1 Message Date
Simon Martín
60702faa57 adding Authorization to Access-Control-Allow-Headers 2019-01-10 15:55:08 +01:00
Raul Marin
03701ae695 Set platform limits message on streaming responses too 2019-01-02 16:21:33 +01:00
Raul Marin
7eb412cf59 Test: Accept PG11 error messages 2019-01-02 16:21:33 +01:00
Rafa de la Torre
2f8357ee4f Properly mock Date.now() for tests 2018-12-11 11:50:53 +01:00
Rafa de la Torre
aeec1922ee Fix test and add const #543 2018-12-05 19:15:57 +01:00
Rafa de la Torre
b6251568eb Test first, with hardcoded values (WIP) #543 2018-12-05 18:59:11 +01:00
Rafa de la Torre
8505857412 Make error_handler.test.js independent from other tests #543
This is needed to avoid a "test race" and get it closer to a real unit
test.

When running it along with others it passes:

```
$ make test-unit
...
  48 passing (54ms)
  12 pending
```

(note it relies on the ordering produced by `find`)

when running it along with some other test that reads the config, it
works as well:

```
$ test/run_tests.sh  test/unit/apikeyauth.test.js test/unit/error_handler.test.js
...
  3 passing (9ms)
  12 pending
```

but when run in isolation, it fails:

```
$ test/run_tests.sh test/unit/error_handler.test.js
...
  0 passing (15ms)
  3 failing

  1) error-handler should return a header with errors:
     TypeError: Cannot read property 'environment' of undefined
      at errorMiddleware (app/middlewares/error.js:10:28)
      at Context.<anonymous> (test/unit/error_handler.test.js:53:26)

  2) error-handler JSONP should return a header with error statuscode:
     TypeError: Cannot read property 'environment' of undefined
      at errorMiddleware (app/middlewares/error.js:10:28)
      at Context.<anonymous> (test/unit/error_handler.test.js:79:26)

  3) error-handler should escape chars that broke logs regex:
     TypeError: Cannot read property 'environment' of undefined
      at errorMiddleware (app/middlewares/error.js:10:28)
      at Context.<anonymous> (test/unit/error_handler.test.js:108:26)
```
2018-12-05 16:22:48 +01:00
Simon Martín
4dbd4d8b80 tests ensuring cancel query with Quota exceeded or max POST size 2018-11-29 18:42:04 +01:00
Daniel García Aubert
35dd404a0b Rename lock files before installing with different versions of npm 2018-11-07 20:24:14 +01:00
Daniel García Aubert
99b92c65fe Run configure before installing 2018-11-07 19:21:46 +01:00
Daniel García Aubert
721bf139b3 Install dependencies depending on the version of Node.js while running CI 2018-11-07 19:03:52 +01:00
Daniel García Aubert
54343162a3 Be able run CI test agaisnt Node.js 6 and 10 2018-11-07 18:37:05 +01:00
Daniel García Aubert
a616982ec3 Use strict mode 2018-10-24 15:42:33 +02:00
Rafa de la Torre
a927a6993a Add a test to reproduce the issue w/ COPY TO #590 2018-09-17 16:46:09 +02:00
Simon Martín
cc9e6eae43 new tmpDir more verbose 2018-08-30 15:10:43 +02:00
Simon Martín
a0db81369a forgotten .only (shame on me) 2018-08-30 15:06:07 +02:00
Simon Martín
3468353876 ensure tmpDir test 2018-08-30 12:50:50 +02:00
Simon Martín
e008eb66df remove only 2018-08-10 14:40:23 +02:00
Simon Martín
c0ea5be5d3 Improve gzip error message 2018-08-10 14:38:50 +02:00
Rafa de la Torre
8a76df8884 Fix for unhandled gunzip/zlib errors #528 2018-08-10 12:37:49 +02:00
Rafa de la Torre
6193f58dd2 Test for faulty gzip headers scenario 2018-08-10 12:15:31 +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
75f25a6c02 Test for the max POST size 2018-07-23 16:58:05 +02:00
Rafa de la Torre
a8e538aba4 Test for COPY TO and DB quota 2018-07-23 16:20:15 +02:00
Rafa de la Torre
7b405cee5d Add test for DB quota exceeded 2018-07-23 16:14:10 +02:00
Rafa de la Torre
153ae3ea3d Fix test: increase timeout for DB quota middleware
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.
2018-07-23 15:36:13 +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
fdab0136e6 Fix copy/paste test 2018-07-20 16:17:44 +02:00
Rafa de la Torre
ce409b4925 Fix typo in test describe 2018-07-20 16:09:10 +02:00
Rafa de la Torre
0f8e1f43c4 Add more tests for copy_timeout 2018-07-20 15:57:36 +02:00
Rafa de la Torre
682d7e6812 Simplify timeout tests 2018-07-20 15:38:20 +02:00
Rafa de la Torre
f437df9045 Fix timeout tests 2018-07-20 15:33:12 +02:00
Rafa de la Torre
632e6818fa Test that COPY uses db_batch_port 2018-07-20 12:04:06 +02:00
Rafa de la Torre
5b65252c4a Ensure no connection pgbouncer -> test_db #521
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.
2018-07-19 18:46:28 +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
Rafa de la Torre
6eeb949583 This is a bash script #521
And using sh can make some things fail. E.g:

```
[[: not found
```
2018-07-19 18:40:31 +02:00
Rafa de la Torre
d3e31a9d6c Allow tests to be executed against pgbouncer
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.
2018-07-18 15:50:57 +02:00
Eneko Lakasta
1bf8a06ec2 Rephrase error message 2018-06-29 13:19:32 +02:00
Eneko Lakasta
3c603d65c8 update tests messages accordingly 2018-06-27 16:27:10 +02:00
Simon Martín
e7750eb4c8 undo remove line 2018-06-21 16:36:21 +02:00
Simon Martín
7e593bb3c9 copy to tests: cancel query with only 1 connection 2018-06-21 13:06:38 +02:00
Simon Martín
f46669fd4f details from merge 2018-06-21 12:25:19 +02:00
Simon Martín
6955d254f8 Merge branch 'master' into pgcopy-stream-refactor2-dgaubert 2018-06-21 12:19:16 +02:00
Simon Martín
dd088215c1 unify client disconnect timeout 2018-06-20 19:03:23 +02:00
Simon Martín
030a8f1ef4 checking connection reuse properly 2018-06-20 19:02:34 +02:00
Simon Martín
50da363ae0 improving name dropTableOptions 2018-06-20 18:39:17 +02:00
Simon Martín
5b87defb97 remove unneeded test table copy_endpoints_test2 2018-06-20 15:09:37 +02:00