2019-03-22 15:54:27 +00:00
|
|
|
import fs from 'fs';
|
|
|
|
import { exec } from "../../helpers/utils/exec";
|
|
|
|
import AutheliaServer from "../../helpers/context/AutheliaServer";
|
|
|
|
import DockerEnvironment from "../../helpers/context/DockerEnvironment";
|
|
|
|
|
2019-03-27 20:57:16 +00:00
|
|
|
// required to query duo-api over https
|
|
|
|
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0 as any;
|
|
|
|
|
2019-03-22 15:54:27 +00:00
|
|
|
const autheliaServer = new AutheliaServer(__dirname + '/config.yml');
|
|
|
|
const dockerEnv = new DockerEnvironment([
|
|
|
|
'docker-compose.yml',
|
|
|
|
'example/compose/nginx/backend/docker-compose.yml',
|
|
|
|
'example/compose/nginx/portal/docker-compose.yml',
|
2019-04-10 19:56:55 +00:00
|
|
|
'example/compose/httpbin/docker-compose.yml',
|
2019-03-22 15:54:27 +00:00
|
|
|
'example/compose/smtp/docker-compose.yml',
|
2019-03-27 20:57:16 +00:00
|
|
|
'example/compose/duo-api/docker-compose.yml',
|
2019-03-22 15:54:27 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
async function setup() {
|
|
|
|
await exec(`cp ${__dirname}/users_database.yml ${__dirname}/users_database.test.yml`);
|
|
|
|
await exec('./example/compose/nginx/portal/render.js ' + (fs.existsSync('.suite') ? '': '--production'));
|
|
|
|
await dockerEnv.start();
|
|
|
|
await autheliaServer.start();
|
|
|
|
}
|
|
|
|
|
|
|
|
async function teardown() {
|
|
|
|
await autheliaServer.stop();
|
|
|
|
await dockerEnv.stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
const setup_timeout = 30000;
|
|
|
|
const teardown_timeout = 30000;
|
|
|
|
|
|
|
|
export {
|
|
|
|
setup,
|
|
|
|
setup_timeout,
|
|
|
|
teardown,
|
|
|
|
teardown_timeout
|
|
|
|
};
|