From 05fe4904ed2527d772c6934600eb395951133320 Mon Sep 17 00:00:00 2001 From: John McLear Date: Wed, 27 Jan 2021 21:59:06 +0000 Subject: [PATCH] various timeout changes --- tests/backend/specs/api/api.js | 2 +- tests/backend/specs/api/characterEncoding.js | 2 +- tests/backend/specs/socketio.js | 46 ++++++++++---------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/tests/backend/specs/api/api.js b/tests/backend/specs/api/api.js index e3dd953c6..1580b3388 100644 --- a/tests/backend/specs/api/api.js +++ b/tests/backend/specs/api/api.js @@ -37,7 +37,7 @@ describe(__filename, function () { describe('OpenAPI definition', function () { it('generates valid openapi definition document', function (done) { - this.timeout(10000); + this.timeout(15000); api .get('/api/openapi.json') .expect((res) => { diff --git a/tests/backend/specs/api/characterEncoding.js b/tests/backend/specs/api/characterEncoding.js index 72c5bdec3..f55c04282 100644 --- a/tests/backend/specs/api/characterEncoding.js +++ b/tests/backend/specs/api/characterEncoding.js @@ -64,7 +64,7 @@ describe(__filename, function () { describe('setHTML', function () { it('Sets the HTML of a Pad attempting to weird utf8 encoded content', function (done) { - this.timeout(600); + this.timeout(1000); fs.readFile('../tests/backend/specs/api/emojis.html', 'utf8', (err, html) => { api.post(endPoint('setHTML')) .send({ diff --git a/tests/backend/specs/socketio.js b/tests/backend/specs/socketio.js index ea48e2b38..2f5e40678 100644 --- a/tests/backend/specs/socketio.js +++ b/tests/backend/specs/socketio.js @@ -137,27 +137,27 @@ describe(__filename, function () { describe('Normal accesses', function () { it('!authn anonymous cookie /p/pad -> 200, ok', async function () { - this.timeout(400); + this.timeout(600); const res = await agent.get('/p/pad').expect(200); socket = await connect(res); const clientVars = await handshake(socket, 'pad'); assert.equal(clientVars.type, 'CLIENT_VARS'); }); it('!authn !cookie -> ok', async function () { - this.timeout(250); + this.timeout(400); socket = await connect(null); const clientVars = await handshake(socket, 'pad'); assert.equal(clientVars.type, 'CLIENT_VARS'); }); it('!authn user /p/pad -> 200, ok', async function () { - this.timeout(250); + this.timeout(400); const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); socket = await connect(res); const clientVars = await handshake(socket, 'pad'); assert.equal(clientVars.type, 'CLIENT_VARS'); }); it('authn user /p/pad -> 200, ok', async function () { - this.timeout(250); + this.timeout(400); settings.requireAuthentication = true; const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); socket = await connect(res); @@ -165,7 +165,7 @@ describe(__filename, function () { assert.equal(clientVars.type, 'CLIENT_VARS'); }); it('authz user /p/pad -> 200, ok', async function () { - this.timeout(250); + this.timeout(400); settings.requireAuthentication = true; settings.requireAuthorization = true; const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); @@ -174,7 +174,7 @@ describe(__filename, function () { assert.equal(clientVars.type, 'CLIENT_VARS'); }); it('supports pad names with characters that must be percent-encoded', async function () { - this.timeout(250); + this.timeout(400); settings.requireAuthentication = true; // requireAuthorization is set to true here to guarantee that the user's padAuthorizations // object is populated. Technically this isn't necessary because the user's padAuthorizations @@ -191,7 +191,7 @@ describe(__filename, function () { describe('Abnormal access attempts', function () { it('authn anonymous /p/pad -> 401, error', async function () { - this.timeout(250); + this.timeout(400); settings.requireAuthentication = true; const res = await agent.get('/p/pad').expect(401); // Despite the 401, try to create the pad via a socket.io connection anyway. @@ -207,7 +207,7 @@ describe(__filename, function () { assert.equal(message.accessStatus, 'deny'); }); it('authorization bypass attempt -> error', async function () { - this.timeout(250); + this.timeout(400); // Only allowed to access /p/pad. authorize = (req) => req.path === '/p/pad'; settings.requireAuthentication = true; @@ -228,7 +228,7 @@ describe(__filename, function () { }); it("level='create' -> can create", async function () { - this.timeout(250); + this.timeout(400); authorize = () => 'create'; const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); socket = await connect(res); @@ -237,7 +237,7 @@ describe(__filename, function () { assert.equal(clientVars.data.readonly, false); }); it('level=true -> can create', async function () { - this.timeout(250); + this.timeout(400); authorize = () => true; const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); socket = await connect(res); @@ -246,7 +246,7 @@ describe(__filename, function () { assert.equal(clientVars.data.readonly, false); }); it("level='modify' -> can modify", async function () { - this.timeout(250); + this.timeout(400); await padManager.getPad('pad'); // Create the pad. authorize = () => 'modify'; const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); @@ -256,7 +256,7 @@ describe(__filename, function () { assert.equal(clientVars.data.readonly, false); }); it("level='create' settings.editOnly=true -> unable to create", async function () { - this.timeout(250); + this.timeout(400); authorize = () => 'create'; settings.editOnly = true; const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); @@ -265,7 +265,7 @@ describe(__filename, function () { assert.equal(message.accessStatus, 'deny'); }); it("level='modify' settings.editOnly=false -> unable to create", async function () { - this.timeout(250); + this.timeout(400); authorize = () => 'modify'; settings.editOnly = false; const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); @@ -274,7 +274,7 @@ describe(__filename, function () { assert.equal(message.accessStatus, 'deny'); }); it("level='readOnly' -> unable to create", async function () { - this.timeout(250); + this.timeout(400); authorize = () => 'readOnly'; const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); socket = await connect(res); @@ -282,7 +282,7 @@ describe(__filename, function () { assert.equal(message.accessStatus, 'deny'); }); it("level='readOnly' -> unable to modify", async function () { - this.timeout(250); + this.timeout(400); await padManager.getPad('pad'); // Create the pad. authorize = () => 'readOnly'; const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); @@ -299,7 +299,7 @@ describe(__filename, function () { }); it('user.canCreate = true -> can create and modify', async function () { - this.timeout(250); + this.timeout(400); settings.users.user.canCreate = true; const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); socket = await connect(res); @@ -308,7 +308,7 @@ describe(__filename, function () { assert.equal(clientVars.data.readonly, false); }); it('user.canCreate = false -> unable to create', async function () { - this.timeout(250); + this.timeout(400); settings.users.user.canCreate = false; const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); socket = await connect(res); @@ -316,7 +316,7 @@ describe(__filename, function () { assert.equal(message.accessStatus, 'deny'); }); it('user.readOnly = true -> unable to create', async function () { - this.timeout(250); + this.timeout(400); settings.users.user.readOnly = true; const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); socket = await connect(res); @@ -324,7 +324,7 @@ describe(__filename, function () { assert.equal(message.accessStatus, 'deny'); }); it('user.readOnly = true -> unable to modify', async function () { - this.timeout(250); + this.timeout(400); await padManager.getPad('pad'); // Create the pad. settings.users.user.readOnly = true; const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); @@ -334,7 +334,7 @@ describe(__filename, function () { assert.equal(clientVars.data.readonly, true); }); it('user.readOnly = false -> can create and modify', async function () { - this.timeout(250); + this.timeout(400); settings.users.user.readOnly = false; const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); socket = await connect(res); @@ -343,7 +343,7 @@ describe(__filename, function () { assert.equal(clientVars.data.readonly, false); }); it('user.readOnly = true, user.canCreate = true -> unable to create', async function () { - this.timeout(250); + this.timeout(400); settings.users.user.canCreate = true; settings.users.user.readOnly = true; const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); @@ -360,7 +360,7 @@ describe(__filename, function () { }); it('authorize hook does not elevate level from user settings', async function () { - this.timeout(250); + this.timeout(400); settings.users.user.readOnly = true; authorize = () => 'create'; const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); @@ -369,7 +369,7 @@ describe(__filename, function () { assert.equal(message.accessStatus, 'deny'); }); it('user settings does not elevate level from authorize hook', async function () { - this.timeout(250); + this.timeout(400); settings.users.user.readOnly = false; settings.users.user.canCreate = true; authorize = () => 'readOnly';