Commit d08972da authored by Renato Figueiro Maia's avatar Renato Figueiro Maia
Browse files

Testes da validação do arquivo de configuração.

[SOMA-6916][SOMA-6857]
parent 70c513fe
......@@ -4,6 +4,47 @@ const chakram = require("chakram");
const events = require("events");
const utils = require("./utils");
describe("Starting SGA", function () {
afterEach(utils.clearAllResources);
const invalidConfigVals = {
csbase_server: [null],
platform: [null],
sgad_host: [null],
sgad_port: [-1, 0, 65536],
sga_name: [null, "sga-for-testing", "sga.for.testing", "sga/for/testing"],
status_interval_s: [-1, 0],
exec_polling_interval_s: [-1, 0],
register_retry_s: [-1, 0],
project_root_dir: [null],
algorithm_root_dir: [null],
runtime_data_dir: [null],
sandbox_root_dir: [null],
driver: [null],
resources: ["some resources", 0, 1, false, true],
};
for (let propName in invalidConfigVals) {
const vals = invalidConfigVals[propName];
for (let i = 0; i < vals.length; i++) {
it(
"should exit with code 1 on invalid " + propName + " configuration",
async () => {
const config = { csbase_server: "http://localhost" };
config[propName] = vals[i];
utils.fillSgaConfig(config);
const sga = new utils.SgaDaemon(config);
await sga.start();
const [exitVal] = await sga.terminated();
expect(exitVal).toEqual(1);
}
);
}
}
});
describe("Registering SGA", function () {
afterEach(utils.clearAllResources);
......
......@@ -52,7 +52,9 @@ function writeAsLua(stream, value, prefix = "") {
}
break;
case "object":
{
if (value === null) {
stream.write("nil");
} else {
const newPrefix = prefix + " ";
stream.write("{\n");
if (Array.isArray(value)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment