From 1b2894bf99281109e980a851527c35b289a7a0e4 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Sun, 9 Feb 2020 14:21:45 +0200 Subject: [PATCH] Fix increasing test timeout on github actions --- test/plugins/auth/ldap.js | 4 ++-- test/plugins/link.js | 4 ++-- test/plugins/sqlite.js | 4 +++- test/plugins/storage.js | 4 ++-- test/server.js | 3 ++- test/util.js | 3 +++ 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/test/plugins/auth/ldap.js b/test/plugins/auth/ldap.js index d3adfe91..484279b0 100644 --- a/test/plugins/auth/ldap.js +++ b/test/plugins/auth/ldap.js @@ -125,8 +125,8 @@ function testLdapAuth() { describe("LDAP authentication plugin", function() { // Increase timeout due to unpredictable I/O on CI services - this.timeout(process.env.CI ? 25000 : 5000); - this.slow(200); + this.timeout(TestUtil.isRunningOnCI() ? 25000 : 5000); + this.slow(300); let server; diff --git a/test/plugins/link.js b/test/plugins/link.js index 59d8e317..d995d43f 100644 --- a/test/plugins/link.js +++ b/test/plugins/link.js @@ -8,8 +8,8 @@ const link = require("../../src/plugins/irc-events/link.js"); describe("Link plugin", function() { // Increase timeout due to unpredictable I/O on CI services - this.timeout(process.env.CI ? 25000 : 5000); - this.slow(200); + this.timeout(util.isRunningOnCI() ? 25000 : 5000); + this.slow(300); const loremIpsum = `Lorem ipsum dolor sit amet, consectetur adipiscing elit.\ Vivamus at pretium mauris. Aenean eu orci id erat pulvinar\ diff --git a/test/plugins/sqlite.js b/test/plugins/sqlite.js index 6051632d..90f07040 100644 --- a/test/plugins/sqlite.js +++ b/test/plugins/sqlite.js @@ -3,13 +3,15 @@ const fs = require("fs"); const path = require("path"); const expect = require("chai").expect; +const util = require("../util"); const Msg = require("../../src/models/msg"); const Helper = require("../../src/helper"); const MessageStorage = require("../../src/plugins/messageStorage/sqlite.js"); describe("SQLite Message Storage", function() { // Increase timeout due to unpredictable I/O on CI services - this.timeout(process.env.CI ? 25000 : 5000); + this.timeout(util.isRunningOnCI() ? 25000 : 5000); + this.slow(300); const expectedPath = path.join(Helper.getHomePath(), "logs", "testUser.sqlite3"); let store; diff --git a/test/plugins/storage.js b/test/plugins/storage.js index 12f82ef2..378a917b 100644 --- a/test/plugins/storage.js +++ b/test/plugins/storage.js @@ -10,8 +10,8 @@ const link = require("../../src/plugins/irc-events/link.js"); describe("Image storage", function() { // Increase timeout due to unpredictable I/O on CI services - this.timeout(process.env.CI ? 25000 : 5000); - this.slow(200); + this.timeout(util.isRunningOnCI() ? 25000 : 5000); + this.slow(300); const testImagePath = path.resolve(__dirname, "../../client/img/logo-grey-bg-120x120px.png"); const correctImageHash = crypto diff --git a/test/server.js b/test/server.js index c33c9ae2..d0396065 100644 --- a/test/server.js +++ b/test/server.js @@ -6,11 +6,12 @@ const expect = require("chai").expect; const stub = require("sinon").stub; const got = require("got"); const io = require("socket.io-client"); +const util = require("./util"); const changelog = require("../src/plugins/changelog"); describe("Server", function() { // Increase timeout due to unpredictable I/O on CI services - this.timeout(process.env.CI ? 25000 : 5000); + this.timeout(util.isRunningOnCI() ? 25000 : 5000); let server; diff --git a/test/util.js b/test/util.js index 3cb8b38e..85e73d1e 100644 --- a/test/util.js +++ b/test/util.js @@ -61,4 +61,7 @@ module.exports = { return express(); }, sanitizeLog, + isRunningOnCI() { + return process.env.CI || process.env.GITHUB_ACTIONS; + }, };