From 64f17880c739e9feef8ce69ed221d83586b773a1 Mon Sep 17 00:00:00 2001 From: smizrahi Date: Thu, 26 Sep 2024 21:02:50 +0200 Subject: [PATCH] fix(tests): Add timeout on all async tests --- Tests/spec/CalDAVPreventInvitationsSpec.js | 4 ++++ Tests/spec/CalDAVPropertiesSpec.js | 4 ++++ Tests/spec/CalDAVSchedulingSpec.js | 6 +++++- Tests/spec/CardDAVSpec.js | 6 +++++- Tests/spec/ConfigSpec.js | 4 ++++ Tests/spec/DAVAddressBookAclSpec.js | 4 ++++ Tests/spec/DAVCalendarAclSpec.js | 4 ++++ Tests/spec/DAVCalendarAppleiCalSpec.js | 6 +++++- Tests/spec/DAVCalendarClassificationSpec.js | 6 +++++- Tests/spec/DAVCalendarPublicAclSpec.js | 4 ++++ Tests/spec/DAVCalendarSuperUserAclSpec.js | 4 ++++ Tests/spec/DAVContactsCategoriesSpec.js | 4 ++++ Tests/spec/DAVPublicAccessSpec.js | 4 ++++ Tests/spec/HTTPCalendarSpec.js | 4 ++++ Tests/spec/HTTPPreferencesSpec.js | 4 ++++ Tests/spec/MailDAVSpec.js | 4 ++++ Tests/spec/SieveSpec.js | 4 ++++ Tests/spec/SogoToolSpec.js | 4 ++++ Tests/spec/WebDAVSpec.js | 4 ++++ Tests/spec/WebDavSyncSpec.js | 4 ++++ 20 files changed, 84 insertions(+), 4 deletions(-) diff --git a/Tests/spec/CalDAVPreventInvitationsSpec.js b/Tests/spec/CalDAVPreventInvitationsSpec.js index e77d593c1..506c4560c 100644 --- a/Tests/spec/CalDAVPreventInvitationsSpec.js +++ b/Tests/spec/CalDAVPreventInvitationsSpec.js @@ -13,6 +13,10 @@ let utility, user, attendee1, attendee1Delegate let userCalendar, attendee1Calendar, attendee1DelegateCalendar let icsName, icsList, vcalendar +beforeAll(function () { + jasmine.DEFAULT_TIMEOUT_INTERVAL = config.timeout || 10000; +}); + describe('PreventInvitations', function() { const _getEvent = async function(client, calendarName, filename, expectedCode = 200) { diff --git a/Tests/spec/CalDAVPropertiesSpec.js b/Tests/spec/CalDAVPropertiesSpec.js index 0c9ddb000..dff2d1296 100644 --- a/Tests/spec/CalDAVPropertiesSpec.js +++ b/Tests/spec/CalDAVPropertiesSpec.js @@ -2,6 +2,10 @@ import config from '../lib/config' import WebDAV from '../lib/WebDAV' import TestUtility from '../lib/utilities' +beforeAll(function () { + jasmine.DEFAULT_TIMEOUT_INTERVAL = config.timeout || 10000; +}); + describe('read and set calendar properties', function() { const webdav = new WebDAV(config.username, config.password) const utility = new TestUtility(webdav) diff --git a/Tests/spec/CalDAVSchedulingSpec.js b/Tests/spec/CalDAVSchedulingSpec.js index 7c724d795..b2cf76abf 100644 --- a/Tests/spec/CalDAVSchedulingSpec.js +++ b/Tests/spec/CalDAVSchedulingSpec.js @@ -3,6 +3,10 @@ import WebDAV from '../lib/WebDAV' import TestUtility from '../lib/utilities' import ICAL from 'ical.js' +beforeAll(function () { + jasmine.DEFAULT_TIMEOUT_INTERVAL = config.timeout || 10000; +}); + describe('CalDAV Scheduling', function() { const webdav = new WebDAV(config.username, config.password) const webdav_su = new WebDAV(config.superuser, config.superuser_password) @@ -933,5 +937,5 @@ describe('CalDAV Scheduling', function() { vcalendarInvitationAttendee = await _getEvent(webdavAttendee1, attendee1Calendar, icsName, 404) vcalendarInvitationDelegate = await _getEvent(webdavAttendee1Delegate, attendee1DelegateCalendar, icsName, 404) - }, 10000) // increase timeout for this long test + }) // increase timeout for this long test }) \ No newline at end of file diff --git a/Tests/spec/CardDAVSpec.js b/Tests/spec/CardDAVSpec.js index 23cf91329..398e16c4b 100644 --- a/Tests/spec/CardDAVSpec.js +++ b/Tests/spec/CardDAVSpec.js @@ -70,6 +70,10 @@ X-AIM:pseudo aim END:VCARD` } +beforeAll(function () { + jasmine.DEFAULT_TIMEOUT_INTERVAL = config.timeout || 10000; +}); + describe('CardDAV extensions', function() { const webdav = new WebDAV(config.username, config.password) const webdav_su = new WebDAV(config.superuser, config.superuser_password) @@ -232,7 +236,7 @@ describe('CardDAV extensions', function() { expect(emails) .withContext(`Returned vCard has email of ${config.attendee1_username} (${config.attendee1})`) .toContain(config.attendee1) - }, 10000) // increase timeout for this long test + }) // increase timeout for this long test // CARDDAV:addressbook-multiget Report // https://datatracker.ietf.org/doc/html/rfc6352#section-8.7 diff --git a/Tests/spec/ConfigSpec.js b/Tests/spec/ConfigSpec.js index 419da043d..82c550c0b 100644 --- a/Tests/spec/ConfigSpec.js +++ b/Tests/spec/ConfigSpec.js @@ -1,5 +1,9 @@ import config from '../lib/config' +beforeAll(function () { + jasmine.DEFAULT_TIMEOUT_INTERVAL = config.timeout || 10000; +}); + describe('config tests', function() { it('required configuration parameters', async function() { diff --git a/Tests/spec/DAVAddressBookAclSpec.js b/Tests/spec/DAVAddressBookAclSpec.js index 65b09fc9c..972003ad7 100644 --- a/Tests/spec/DAVAddressBookAclSpec.js +++ b/Tests/spec/DAVAddressBookAclSpec.js @@ -2,6 +2,10 @@ import config from '../lib/config' import WebDAV from '../lib/WebDAV' import TestUtility from '../lib/utilities' +beforeAll(function () { + jasmine.DEFAULT_TIMEOUT_INTERVAL = config.timeout || 10000; +}); + describe('create, read, modify, delete tasks for regular user', function() { const webdav = new WebDAV(config.username, config.password) const webdav_su = new WebDAV(config.superuser, config.superuser_password) diff --git a/Tests/spec/DAVCalendarAclSpec.js b/Tests/spec/DAVCalendarAclSpec.js index f5ee52a45..c6e1e3115 100644 --- a/Tests/spec/DAVCalendarAclSpec.js +++ b/Tests/spec/DAVCalendarAclSpec.js @@ -2,6 +2,10 @@ import config from '../lib/config' import WebDAV from '../lib/WebDAV' import TestUtility from '../lib/utilities' +beforeAll(function () { + jasmine.DEFAULT_TIMEOUT_INTERVAL = config.timeout || 10000; +}); + describe('create, read, modify, delete events for regular user', function() { const webdav = new WebDAV(config.username, config.password) const webdav_su = new WebDAV(config.superuser, config.superuser_password) diff --git a/Tests/spec/DAVCalendarAppleiCalSpec.js b/Tests/spec/DAVCalendarAppleiCalSpec.js index fb2833a6f..83d24acdc 100644 --- a/Tests/spec/DAVCalendarAppleiCalSpec.js +++ b/Tests/spec/DAVCalendarAppleiCalSpec.js @@ -10,6 +10,10 @@ import TestUtility from '../lib/utilities' * additional calendars. */ +beforeAll(function () { + jasmine.DEFAULT_TIMEOUT_INTERVAL = config.timeout || 10000; +}); + describe('Apple iCal', function() { const webdav = new WebDAV(config.username, config.password) const webdav_su = new WebDAV(config.superuser, config.superuser_password) @@ -229,5 +233,5 @@ describe('Apple iCal', function() { .toBe(0) await webdav_su.deleteObject(otherResource) - }, 10000) // increase timeout for this long test + }) // increase timeout for this long test }) \ No newline at end of file diff --git a/Tests/spec/DAVCalendarClassificationSpec.js b/Tests/spec/DAVCalendarClassificationSpec.js index ca72dfc19..008144437 100644 --- a/Tests/spec/DAVCalendarClassificationSpec.js +++ b/Tests/spec/DAVCalendarClassificationSpec.js @@ -1,6 +1,10 @@ import config from '../lib/config' import { default as WebDAV, DAVInverse } from '../lib/WebDAV' +beforeAll(function () { + jasmine.DEFAULT_TIMEOUT_INTERVAL = config.timeout || 10000; +}); + describe('calendar classification', function() { const webdav = new WebDAV(config.username, config.password) @@ -35,7 +39,7 @@ describe('calendar classification', function() { expect(status) .withContext('Setting an invalid classification') .toBe(403) - }) + }) it('setting a valid classification', async function() { for (let component of ['events', 'tasks']) { diff --git a/Tests/spec/DAVCalendarPublicAclSpec.js b/Tests/spec/DAVCalendarPublicAclSpec.js index 54607eaee..c87a261b8 100644 --- a/Tests/spec/DAVCalendarPublicAclSpec.js +++ b/Tests/spec/DAVCalendarPublicAclSpec.js @@ -2,6 +2,10 @@ import config from '../lib/config' import WebDAV from '../lib/WebDAV' import TestUtility from '../lib/utilities' +beforeAll(function () { + jasmine.DEFAULT_TIMEOUT_INTERVAL = config.timeout || 10000; +}); + describe('public access', function() { const webdav = new WebDAV(config.username, config.password) const webdav_anon = new WebDAV() diff --git a/Tests/spec/DAVCalendarSuperUserAclSpec.js b/Tests/spec/DAVCalendarSuperUserAclSpec.js index 3ad6fdda6..24206a1a3 100644 --- a/Tests/spec/DAVCalendarSuperUserAclSpec.js +++ b/Tests/spec/DAVCalendarSuperUserAclSpec.js @@ -2,6 +2,10 @@ import config from '../lib/config' import WebDAV from '../lib/WebDAV' import TestUtility from '../lib/utilities' +beforeAll(function () { + jasmine.DEFAULT_TIMEOUT_INTERVAL = config.timeout || 10000; +}); + describe('DAVCalendarSuperUserAcl', function() { const webdav = new WebDAV(config.username, config.password) const webdav_su = new WebDAV(config.superuser, config.superuser_password) diff --git a/Tests/spec/DAVContactsCategoriesSpec.js b/Tests/spec/DAVContactsCategoriesSpec.js index d21b2c94a..434fc5071 100644 --- a/Tests/spec/DAVContactsCategoriesSpec.js +++ b/Tests/spec/DAVContactsCategoriesSpec.js @@ -1,6 +1,10 @@ import config from '../lib/config' import { default as WebDAV, DAVInverse } from '../lib/WebDAV' +beforeAll(function () { + jasmine.DEFAULT_TIMEOUT_INTERVAL = config.timeout || 10000; +}); + describe('contacts categories', function() { const webdav = new WebDAV(config.username, config.password) diff --git a/Tests/spec/DAVPublicAccessSpec.js b/Tests/spec/DAVPublicAccessSpec.js index d837dd067..5685b4af2 100644 --- a/Tests/spec/DAVPublicAccessSpec.js +++ b/Tests/spec/DAVPublicAccessSpec.js @@ -1,6 +1,10 @@ import config from '../lib/config' import WebDAV from '../lib/WebDAV' +beforeAll(function () { + jasmine.DEFAULT_TIMEOUT_INTERVAL = config.timeout || 10000; +}); + describe('public access', function() { const webdav_anon = new WebDAV() diff --git a/Tests/spec/HTTPCalendarSpec.js b/Tests/spec/HTTPCalendarSpec.js index 53046c4a7..be75f7ec8 100644 --- a/Tests/spec/HTTPCalendarSpec.js +++ b/Tests/spec/HTTPCalendarSpec.js @@ -3,6 +3,10 @@ import WebDAV from '../lib/WebDAV' let webdav, resource +beforeAll(function () { + jasmine.DEFAULT_TIMEOUT_INTERVAL = config.timeout || 10000; +}); + describe('HTTP Calendar', function() { beforeAll(async function() { diff --git a/Tests/spec/HTTPPreferencesSpec.js b/Tests/spec/HTTPPreferencesSpec.js index 3ecc92030..9408e50f9 100644 --- a/Tests/spec/HTTPPreferencesSpec.js +++ b/Tests/spec/HTTPPreferencesSpec.js @@ -3,6 +3,10 @@ import Preferences from '../lib/Preferences' const prefs = new Preferences(config.username, config.password) +beforeAll(function () { + jasmine.DEFAULT_TIMEOUT_INTERVAL = config.timeout || 10000; +}); + describe('preferences', function() { // preferencesTest diff --git a/Tests/spec/MailDAVSpec.js b/Tests/spec/MailDAVSpec.js index 736ff0d30..f4dba4832 100644 --- a/Tests/spec/MailDAVSpec.js +++ b/Tests/spec/MailDAVSpec.js @@ -152,6 +152,10 @@ let msg3Size = 720 let webdav, utility let user, resource, mailboxesList +beforeAll(function () { + jasmine.DEFAULT_TIMEOUT_INTERVAL = config.timeout || 10000; +}); + // DAVMailCollectionTest describe('MailDAV', function() { diff --git a/Tests/spec/SieveSpec.js b/Tests/spec/SieveSpec.js index 2d90fdd44..10adcea5e 100644 --- a/Tests/spec/SieveSpec.js +++ b/Tests/spec/SieveSpec.js @@ -6,6 +6,10 @@ import ManageSieve from '../lib/ManageSieve' let prefs, webdav, utility, manageSieve, user +beforeAll(function () { + jasmine.DEFAULT_TIMEOUT_INTERVAL = config.timeout || 10000; +}); + describe('Sieve', function() { async function _getSogoSieveScript() { diff --git a/Tests/spec/SogoToolSpec.js b/Tests/spec/SogoToolSpec.js index 076dc1077..9556b6ec4 100644 --- a/Tests/spec/SogoToolSpec.js +++ b/Tests/spec/SogoToolSpec.js @@ -5,6 +5,10 @@ const os = require('os') const path = require('path') const { execSync } = require('child_process') +beforeAll(function () { + jasmine.DEFAULT_TIMEOUT_INTERVAL = config.timeout || 10000; +}); + describe('sogo-tool tests', function() { let tmpdir, isRoot diff --git a/Tests/spec/WebDAVSpec.js b/Tests/spec/WebDAVSpec.js index 44516ffc5..b51f798a1 100644 --- a/Tests/spec/WebDAVSpec.js +++ b/Tests/spec/WebDAVSpec.js @@ -2,6 +2,10 @@ import config from '../lib/config' import WebDAV from '../lib/WebDAV' import TestUtility from '../lib/utilities' +beforeAll(function () { + jasmine.DEFAULT_TIMEOUT_INTERVAL = config.timeout || 10000; +}); + describe('WebDAV', function() { var webdav var utility diff --git a/Tests/spec/WebDavSyncSpec.js b/Tests/spec/WebDavSyncSpec.js index 49ce48d3c..13e772d52 100644 --- a/Tests/spec/WebDavSyncSpec.js +++ b/Tests/spec/WebDavSyncSpec.js @@ -3,6 +3,10 @@ import WebDAV from '../lib/WebDAV' import { DAVNamespace, DAVNamespaceShorthandMap } from 'tsdav' import convert from 'xml-js' +beforeAll(function () { + jasmine.DEFAULT_TIMEOUT_INTERVAL = config.timeout || 10000; +}); + describe('webdav sync', function() { const webdav = new WebDAV(config.username, config.password) const webdav_su = new WebDAV(config.superuser, config.superuser_password)