Commit graph

78 commits

Author SHA1 Message Date
Jakob Ackermann
7e8e231059 [misc] run format_fix and lint:fix 2021-07-13 12:04:45 +01:00
Jakob Ackermann
a26ae73597 [misc] switch from settings-sharelatex to @overleaf/settings 2021-07-12 17:47:18 +01:00
Eric Mc Sween
b9e7cbf73b Add global test setup
Configure chai and SandboxedModule in a central place. Configure
SandboxedModule globals that are needed in Node 12.
2021-03-18 16:41:31 -04:00
Jakob Ackermann
b7b13a90d1 [misc] ApplyUpdateTests: process all the pending-updates-lists 2021-03-01 15:26:18 +00:00
Jakob Ackermann
15af5c7977 [misc] bump @overleaf/redis-wrapper to version 2.0.0 2020-11-11 16:24:22 +00:00
Jakob Ackermann
e846192db0 [MatrixTests] add a large testing matrix
Layers/Dimensions:
- users: anonymous, registered, registeredWithOwnedProject
- session setup: noop, joinReadWriteProject, joinReadWriteProjectAndDoc,
   joinOwnProject, joinOwnProjectAndDoc
- invalid requests: noop, joinProjectWithDocId, joinDocWithDocId,
   joinProjectWithProjectId, joinDocWithProjectId,
   joinProjectWithProjectIdThenJoinDocWithDocId
2020-10-07 16:20:21 +01:00
Jakob Ackermann
4ec73acb88 Merge branches 'jpa-prepare-for-matrix-tests' and 'jpa-setup-session-helper' into jpa-matrix-tests 2020-10-01 12:57:40 +01:00
Jakob Ackermann
2900c60c4a [FixturesManager] add a helper for setting up project and doc together 2020-10-01 12:33:15 +01:00
Jakob Ackermann
78fbd04ef8 [MockWebServer] grant users at least the privileges of anonymous users 2020-10-01 12:28:39 +01:00
Jakob Ackermann
4f860995d8 [MockDocUpdaterServer] return a 404 when a requested doc does not exist 2020-10-01 12:25:41 +01:00
Jakob Ackermann
4960bdd6fe [misc] re-level log: 404 from web -> WARN and emit 'project not found'
A stale browser tab tried to join a deleted project.
Emitting 'project not found'/'ProjectNotFound' will trigger a page
 reload in the frontend, upon web can render a 404.
See frontend: ConnectionManager.joinProject callback
2020-08-27 11:51:57 +01:00
Jakob Ackermann
55d938ba14 [misc] add tests for web replying with a 404 for joinProject 2020-08-27 11:51:56 +01:00
Jakob Ackermann
884b340c75 [misc] re-level log: 403 from web goes to WARN and emit 'not authorized'
Users will get redirected to the login page and will see a 'restricted'
 page after logging in again.
See frontend: ConnectionManager.reportConnectionError
2020-08-27 11:51:56 +01:00
Jakob Ackermann
d2a2b9d46e [misc] add tests for web replying with a 403 for joinProject 2020-08-27 11:51:56 +01:00
Jakob Ackermann
c76bcb7732 [misc] fix eslint errors in XMLHttpRequest.js 2020-06-24 10:52:37 +01:00
decaffeinate
53058452ee prettier: convert miscellaneous files to Prettier format 2020-06-24 10:28:28 +01:00
decaffeinate
8a7fc78dc8 prettier: convert test/acceptance decaffeinated files to Prettier format 2020-06-23 18:30:45 +01:00
decaffeinate
db98fdac0a decaffeinate: rename test/acceptance/coffee to test/acceptance/js 2020-06-23 18:30:37 +01:00
decaffeinate
5443450abb decaffeinate: Run post-processing cleanups on ApplyUpdateTests.coffee and 18 other files 2020-06-23 18:30:34 +01:00
decaffeinate
d318e4fd0e decaffeinate: Convert ApplyUpdateTests.coffee and 18 other files to JS 2020-06-23 18:30:29 +01:00
decaffeinate
30a9c6ed2c decaffeinate: Rename ApplyUpdateTests.coffee and 18 other files from .coffee to .js 2020-06-23 18:30:23 +01:00
Jakob Ackermann
8ac973e767 [misc] help prettier/decaffeinate with scoping a comment into a fn body 2020-06-23 18:04:09 +01:00
Jakob Ackermann
06a8dc8ec1 Merge pull request #155 from overleaf/jpa-backport-receiveupdate-tests
[backport] 107 and 116: Improve ReceiveUpdate acceptance tests
2020-06-10 11:28:25 +02:00
Jakob Ackermann
10eb30e572 Merge pull request #154 from overleaf/jpa-backport-httpcontroller-tests
[backport] 111 HttpController: 404 for missing clients and add tests
2020-06-10 11:28:17 +02:00
Jakob Ackermann
45ac2bdd97 Merge pull request #153 from overleaf/jpa-backport-drainmanager-tests
[backport] 108 and 112: DrainManager acceptance tests
2020-06-10 11:28:08 +02:00
Jakob Ackermann
cfe37dcbb5 Merge pull request #152 from overleaf/jpa-vendor-cookie
[misc] vendor a patched session.socket.io middleware
2020-06-10 11:27:58 +02:00
Jakob Ackermann
b2e4448992 [misc] test/acceptance: ReceiveUpdateTests: test remotely sent update 2020-06-10 09:53:48 +01:00
Jakob Ackermann
83e3ff0ed7 [misc] test/acceptance: ReceiveUpdateTests: add 2nd project/3rd client
...and check for cross project leakage.
2020-06-10 09:53:29 +01:00
Jakob Ackermann
56fda1f9b0 [misc] test/acceptance: use the correct redis instances 2020-06-10 09:43:15 +01:00
Jakob Ackermann
bc44494466 [HttpController] return 404 in case of a missing client and add tests
Add acceptance tests for the client view.
2020-06-10 09:41:36 +01:00
Jakob Ackermann
eabff1d6b2 [perf] test/acceptance: DrainManagerTests: cleanup previous clients
...before starting to drain.
2020-06-09 18:02:38 +01:00
Jakob Ackermann
91e296533f [misc] test/acceptance: add tests for the draining of connections 2020-06-09 18:00:44 +01:00
Jakob Ackermann
acb7d7df5a [misc] add test cases for the validation of the callback argument
When the user provides a function as last argument for socket.emit,
 socket.io will flag this as an RPC and add a cb as the last argument
 to the client.on('event', ...) handler on the server side.
Without a function as last argument for socket.emit, the callback
 argument on the server side is undefined, leading to invalid function
 calls (`undefined()`) and an unhandled exception.
The user can also provide lots of other arguments, so the 2nd/3rd ...
 argument is of arbitrary type, again leading to invalid function calls
 -- e.g. `1()`.
2020-06-09 16:30:03 +01:00
Jakob Ackermann
dc553c4150 [misc] vendor a patched session.socket.io middleware 2020-06-09 15:21:33 +01:00
Jakob Ackermann
5238e6ad36 Merge pull request #145 from overleaf/jpa-backport-140
[backport] 140: stop processing requests as we detect a client disconnect
2020-06-09 14:41:12 +02:00
Jakob Ackermann
589bedc3dd Merge pull request #146 from overleaf/jpa-downgrade-logging
[misc] downgrade logging when running tests
2020-06-09 14:40:59 +02:00
Jakob Ackermann
f40241a037 [misc] downgrade logging when running tests 2020-06-05 11:38:09 +01:00
Jakob Ackermann
ddcb9cf8c8 [misc] downgrade a warning message from clients leaving non-joined rooms
This can now happen all the time, as we skip the join for clients that
 disconnect before joinProject/joinDoc completed.

(cherry-picked from commit f357931de74e088800f3cced3898cce4f251dad0)
2020-06-05 11:32:43 +01:00
Jakob Ackermann
7fa9061015 [misc] stop processing requests as we detect a client disconnect
v2 expose `client.connected`; v0 exposes `client.disconnected`

(cherry-picked from commit a9d70484343ca9be367d45bf7bb949e4be449647)
2020-06-05 11:32:13 +01:00
Jakob Ackermann
c6d08647c7 [misc] socket.io: use a secondary publicId for public facing usages 2020-06-04 17:18:07 +01:00
Jakob Ackermann
d13acb8ca3 [ChannelManager] port related and still mostly valid test from v2
I skipped the bulk of verifyConsistentBehaviour tests which are not
 valid for the new implementation -- there is no optimization and
 always cleanup.
2020-05-15 18:39:33 +02:00
Jakob Ackermann
af53d3b603 [misc] skip duplicate JSON serialization for size check 2020-03-24 11:22:28 +01:00
Jakob Ackermann
15244a54be [misc] WebsocketController: limit the update size to 7mb
bail out early on -- especially do not push the update into redis for
 doc-updater to discard it.

Confirm the update silently, otherwise the frontend will send it again.
Broadcast a 'otUpdateError' message and disconnect the client, like
 doc-updater would do.
2020-03-24 09:12:12 +01:00
Simon Detheridge
21e294c6eb Generate retryable error when hitting rate limits in web 2019-09-02 11:27:04 +01:00
Brian Gough
478a727c61 ignore spurious requests to leave other docs 2019-07-29 15:19:08 +01:00
Brian Gough
04a171171f fix async behaviour of join/leave 2019-07-29 11:54:02 +01:00
Henry Oswald
2c9b222437 fix breaking tests from using ioredis with inbuilt promises
because a promise is returned from ioredis it errors in mocha as it
can't take a promise and a callback
2019-05-30 10:58:05 +01:00
Chrystal Griffiths
507c4e5ce2 Fix test to accommodate changes to anonymous users 2019-02-15 15:18:17 +00:00
Henry Oswald
a07e516f65 update redis key 2019-02-04 10:22:26 +00:00
Henry Oswald
327fa79f1c update build scripts, acceptence tests now pass. includes dockerfile 1.1.3 2018-05-23 15:00:46 +01:00