authelia/scripts/authelia-scripts-suites-start
Clement Michaud 76fa325f08 [BREAKING] Create a suite for kubernetes tests.
Authelia client uses hash router instead of browser router in order to work
with Kubernetes nginx-ingress-controller. This is also better for users having
old browsers.

This commit is breaking because it requires to change the configuration of the
proxy to include the # in the URL of the login portal.
2019-03-16 00:13:27 +01:00

60 lines
1.5 KiB
JavaScript
Executable File

#!/usr/bin/env node
var program = require('commander');
var spawn = require('child_process').spawn;
var fs = require('fs');
var ListSuites = require('./utils/ListSuites');
let suite;
program
.description(`Start the suite provided as argument. You can list the suites with the 'list' command.`)
.arguments('<suite>')
.action((suiteArg) => suite = suiteArg)
.parse(process.argv)
if (!suite) {
program.help();
}
if (ListSuites().indexOf(suite) == -1) {
console.log("[WARNING] This suite does not exist. Use 'list' command to check the existing suites.");
process.exit(1);
}
const ENVIRONMENT_FILENAME = '.suite';
let runEnvProcess;
// Sometime SIGINT is received twice, we make sure with this variable that we cleanup
// only once.
var alreadyCleaningUp = false;
// Properly cleanup server and client if ctrl-c is hit
process.on('SIGINT', function() {
if (alreadyCleaningUp) return;
alreadyCleaningUp = true;
console.log('Cleanup procedure is running...');
});
async function main() {
fs.writeFileSync(ENVIRONMENT_FILENAME, suite);
// Start the environment from ts-node process.
runEnvProcess = spawn('./node_modules/.bin/ts-node -P test/tsconfig.json -- ./scripts/run-environment.ts ' + suite, {
shell: true
});
runEnvProcess.stdout.pipe(process.stdout);
runEnvProcess.stderr.pipe(process.stderr);
runEnvProcess.on('exit', function(statusCode) {
fs.unlinkSync(ENVIRONMENT_FILENAME);
process.exit(statusCode);
});
}
main()
.catch((err) => {
console.error(err);
process.exit(1)
});