2019-03-03 04:27:54 +07:00
|
|
|
import fs from 'fs';
|
|
|
|
import { exec } from "../../helpers/utils/exec";
|
|
|
|
import AutheliaServer from "../../helpers/context/AutheliaServer";
|
|
|
|
import DockerEnvironment from "../../helpers/context/DockerEnvironment";
|
|
|
|
|
|
|
|
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',
|
|
|
|
'example/compose/smtp/docker-compose.yml',
|
|
|
|
])
|
|
|
|
|
|
|
|
async function setup() {
|
2019-03-03 05:16:53 +07:00
|
|
|
await exec(`cp ${__dirname}/users_database.yml ${__dirname}/users_database.test.yml`);
|
2019-03-03 04:27:54 +07:00
|
|
|
await exec('mkdir -p /tmp/authelia/db');
|
|
|
|
await exec('./example/compose/nginx/portal/render.js ' + (fs.existsSync('.suite') ? '': '--production'));
|
|
|
|
await dockerEnv.start();
|
|
|
|
await autheliaServer.start();
|
|
|
|
}
|
|
|
|
|
|
|
|
async function teardown() {
|
|
|
|
await dockerEnv.stop();
|
|
|
|
await autheliaServer.stop();
|
|
|
|
await exec('rm -r /tmp/authelia/db');
|
|
|
|
}
|
|
|
|
|
|
|
|
export { setup, teardown };
|