From 1e0a279179c9ccf53a345bb33a57268923016b6e Mon Sep 17 00:00:00 2001 From: Clement Michaud Date: Tue, 24 Jul 2018 23:36:04 +0200 Subject: [PATCH] Fix issues with integration tests in master --- server/src/lib/authentication/totp/TotpHandler.ts | 4 ++-- server/src/lib/routes/firstfactor/get.ts | 3 +-- server/src/lib/routes/secondfactor/redirect.ts | 3 +-- server/test/storage/mongo/MongoCollection.test.ts | 7 +++---- test/features/step_definitions/authentication.ts | 2 +- test/features/step_definitions/hooks.ts | 4 ++-- test/features/step_definitions/resilience.ts | 2 +- 7 files changed, 11 insertions(+), 14 deletions(-) diff --git a/server/src/lib/authentication/totp/TotpHandler.ts b/server/src/lib/authentication/totp/TotpHandler.ts index f51124a8..dfab502a 100644 --- a/server/src/lib/authentication/totp/TotpHandler.ts +++ b/server/src/lib/authentication/totp/TotpHandler.ts @@ -15,7 +15,7 @@ export class TotpHandler implements ITotpHandler { generate(label: string, issuer: string): TOTPSecret { const secret = this.speakeasy.generateSecret({ otpauth_url: false - }); + }) as TOTPSecret; secret.otpauth_url = this.speakeasy.otpauthURL({ secret: secret.ascii, @@ -33,4 +33,4 @@ export class TotpHandler implements ITotpHandler { window: WINDOW }); } -} \ No newline at end of file +} diff --git a/server/src/lib/routes/firstfactor/get.ts b/server/src/lib/routes/firstfactor/get.ts index bddba7e0..a4ee1b4b 100644 --- a/server/src/lib/routes/firstfactor/get.ts +++ b/server/src/lib/routes/firstfactor/get.ts @@ -1,7 +1,6 @@ import express = require("express"); import objectPath = require("object-path"); -import winston = require("winston"); import Endpoints = require("../../../../../shared/api"); import BluebirdPromise = require("bluebird"); import { AuthenticationSessionHandler } from "../../AuthenticationSessionHandler"; @@ -56,4 +55,4 @@ export default function (vars: ServerVariables) { resolve(); }); }; -} \ No newline at end of file +} diff --git a/server/src/lib/routes/secondfactor/redirect.ts b/server/src/lib/routes/secondfactor/redirect.ts index 6ae28c3f..5d84d9eb 100644 --- a/server/src/lib/routes/secondfactor/redirect.ts +++ b/server/src/lib/routes/secondfactor/redirect.ts @@ -1,7 +1,6 @@ import express = require("express"); import objectPath = require("object-path"); -import winston = require("winston"); import Endpoints = require("../../../../../shared/api"); import { ServerVariables } from "../../ServerVariables"; import BluebirdPromise = require("bluebird"); @@ -28,4 +27,4 @@ export default function (vars: ServerVariables) { .catch(ErrorReplies.replyWithError200(req, res, vars.logger, UserMessages.OPERATION_FAILED)); }; -} \ No newline at end of file +} diff --git a/server/test/storage/mongo/MongoCollection.test.ts b/server/test/storage/mongo/MongoCollection.test.ts index 5edd4670..bce9026c 100644 --- a/server/test/storage/mongo/MongoCollection.test.ts +++ b/server/test/storage/mongo/MongoCollection.test.ts @@ -6,7 +6,7 @@ import { MongoClientStub } from "../../mocks/connectors/mongo/MongoClientStub"; import { MongoCollection } from "../../../src/lib/storage/mongo/MongoCollection"; describe("MongoCollection", function () { - let mongoCollectionStub: MongoDB.Collection; + let mongoCollectionStub: any; let findStub: Sinon.SinonStub; let findOneStub: Sinon.SinonStub; let insertStub: Sinon.SinonStub; @@ -15,8 +15,7 @@ describe("MongoCollection", function () { let countStub: Sinon.SinonStub; before(function () { - const Collection = require("mongodb").Collection; - mongoCollectionStub = Sinon.createStubInstance(Collection); + mongoCollectionStub = Sinon.createStubInstance(require("mongodb").Collection as any); findStub = mongoCollectionStub.find as Sinon.SinonStub; findOneStub = mongoCollectionStub.findOne as Sinon.SinonStub; insertStub = mongoCollectionStub.insert as Sinon.SinonStub; @@ -102,4 +101,4 @@ describe("MongoCollection", function () { }); }); }); -}); \ No newline at end of file +}); diff --git a/test/features/step_definitions/authentication.ts b/test/features/step_definitions/authentication.ts index ec30573f..4fad123a 100644 --- a/test/features/step_definitions/authentication.ts +++ b/test/features/step_definitions/authentication.ts @@ -64,7 +64,7 @@ When("I visit {string} and get redirected {string}", const that = this; return this.driver.get(url) .then(function () { - return that.driver.wait(seleniumWebdriver.until.urlIs(redirectUrl), 2000); + return that.driver.wait(seleniumWebdriver.until.urlIs(redirectUrl), 6000); }); }); diff --git a/test/features/step_definitions/hooks.ts b/test/features/step_definitions/hooks.ts index ddfaceec..0615b30f 100644 --- a/test/features/step_definitions/hooks.ts +++ b/test/features/step_definitions/hooks.ts @@ -60,14 +60,14 @@ function declareNeedsConfiguration(tag: string, cb: () => BluebirdPromise) .then(function () { return exec("./scripts/example-commit/dc-example.sh -f " + "./example/compose/authelia/docker-compose.test.yml up -d authelia &&" + - " sleep 1"); + " sleep 3"); }) }); After({ tags: "@needs-" + tag + "-config", timeout: 20 * 1000 }, function () { return exec("rm config.test.yml") .then(function () { - return exec("./scripts/example-commit/dc-example.sh up -d authelia && sleep 1"); + return exec("./scripts/example-commit/dc-example.sh up -d authelia && sleep 3"); }); }); } diff --git a/test/features/step_definitions/resilience.ts b/test/features/step_definitions/resilience.ts index 2032d78a..897cf962 100644 --- a/test/features/step_definitions/resilience.ts +++ b/test/features/step_definitions/resilience.ts @@ -6,5 +6,5 @@ import BluebirdPromise = require("bluebird"); When(/^the application restarts$/, {timeout: 15 * 1000}, function () { const exec = BluebirdPromise.promisify(ChildProcess.exec); - return exec("./scripts/example-commit/dc-example.sh restart authelia && sleep 1"); + return exec("./scripts/example-commit/dc-example.sh restart authelia && sleep 3"); }); \ No newline at end of file