Leave more room for Authelia to spawn and terminate.

This commit is contained in:
Clement Michaud 2019-02-24 14:01:17 +01:00
parent afb39fc8d0
commit ecdc91b221

View File

@ -1,9 +1,9 @@
import ChildProcess from 'child_process'; import ChildProcess from 'child_process';
export default function WithAutheliaRunning(configPath: string, waitTimeout: number = 3000) { export default function WithAutheliaRunning(configPath: string, waitTimeout: number = 5000) {
before(function() { before(function() {
this.timeout(5000); this.timeout(10000);
console.log('Spawning Authelia server with configuration %s.', configPath); console.log('Spawning Authelia server with configuration %s.', configPath);
const authelia = ChildProcess.spawn( const authelia = ChildProcess.spawn(
@ -21,10 +21,14 @@ export default function WithAutheliaRunning(configPath: string, waitTimeout: num
}); });
after(function() { after(function() {
this.timeout(1000); this.timeout(10000);
console.log('Killing Authelia server.'); console.log('Killing Authelia server.');
// Kill the group of processes. // Kill the group of processes.
process.kill(-this.authelia.pid); process.kill(-this.authelia.pid);
// Leave 5 seconds for the process to terminate.
const waitPromise = new Promise((resolve, reject) => setTimeout(() => resolve(), 5000));
return waitPromise;
}); });
} }