mirror of https://gitee.com/bigwinds/arangodb
WIP
This commit is contained in:
parent
9d26ab1bbc
commit
cf416c686c
|
@ -104,17 +104,21 @@ function resultsToXml(results, baseName, cluster) {
|
|||
failures: failuresFound,
|
||||
tests: total,
|
||||
name: xmlName,
|
||||
time: current.duration
|
||||
time: 0 + current.duration
|
||||
});
|
||||
|
||||
let seen = false;
|
||||
|
||||
for (let oneTestName in current) {
|
||||
if (isSignificant(current, oneTestName)) {
|
||||
const oneTest = current[oneTestName];
|
||||
const success = (oneTest.status === true);
|
||||
|
||||
seen = true;
|
||||
|
||||
xml.elem("testcase", {
|
||||
name: clprefix + oneTestName,
|
||||
time: oneTest.duration
|
||||
time: 0 + oneTest.duration
|
||||
}, success);
|
||||
|
||||
if (!success) {
|
||||
|
@ -126,18 +130,11 @@ function resultsToXml(results, baseName, cluster) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!current.status) {
|
||||
if (!seen) {
|
||||
xml.elem("testcase", {
|
||||
name: 'all tests in ' + xmlName,
|
||||
time: current.duration
|
||||
}, false);
|
||||
|
||||
xml.elem("failure");
|
||||
xml.text('<![CDATA[' +
|
||||
JSON.stringify(current.message || "unknown failure reason") +
|
||||
']]>\n');
|
||||
xml.elem("/failure");
|
||||
xml.elem("/testcase");
|
||||
time: 0 + current.duration
|
||||
}, 0 < failuresFound);
|
||||
}
|
||||
|
||||
xml.elem("/testsuite");
|
||||
|
|
|
@ -169,7 +169,7 @@ void ServerFeature::validateOptions(std::shared_ptr<ProgramOptions>) {
|
|||
void ServerFeature::start() {
|
||||
LOG_TOPIC(TRACE, Logger::STARTUP) << name() << "::start";
|
||||
|
||||
if (_operationMode != OperationMode::MODE_CONSOLE) {
|
||||
if (_operationMode != OperationMode::MODE_CONSOLE && _restServer) {
|
||||
auto scheduler = dynamic_cast<SchedulerFeature*>(
|
||||
ApplicationServer::lookupFeature("Scheduler"));
|
||||
|
||||
|
@ -189,10 +189,24 @@ void ServerFeature::start() {
|
|||
|
||||
*_result = EXIT_SUCCESS;
|
||||
|
||||
if (_operationMode == OperationMode::MODE_UNITTESTS) {
|
||||
*_result = runUnitTests();
|
||||
} else if (_operationMode == OperationMode::MODE_SCRIPT) {
|
||||
*_result = runScript();
|
||||
switch (_operationMode) {
|
||||
case OperationMode::MODE_UNITTESTS:
|
||||
LOG_TOPIC(TRACE, Logger::STARTUP) << "server about to run unit-tests";
|
||||
*_result = runUnitTests();
|
||||
break;
|
||||
|
||||
case OperationMode::MODE_SCRIPT:
|
||||
LOG_TOPIC(TRACE, Logger::STARTUP) << "server about to run scripts";
|
||||
*_result = runScript();
|
||||
break;
|
||||
|
||||
case OperationMode::MODE_CONSOLE:
|
||||
LOG_TOPIC(TRACE, Logger::STARTUP) << "server operation mode: CONSOLE";
|
||||
break;
|
||||
|
||||
case OperationMode::MODE_SERVER:
|
||||
LOG_TOPIC(TRACE, Logger::STARTUP) << "server operation mode: SERVER";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -297,6 +311,7 @@ int ServerFeature::runScript() {
|
|||
{
|
||||
v8::Context::Scope contextScope(localContext);
|
||||
for (auto script : _scripts) {
|
||||
LOG(TRACE) << "executing script '" << script << "'";
|
||||
bool r = TRI_ExecuteGlobalJavaScriptFile(isolate, script.c_str(), true);
|
||||
|
||||
if (!r) {
|
||||
|
|
|
@ -78,11 +78,11 @@ void UpgradeFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
|
|||
}
|
||||
|
||||
if (!_upgrade) {
|
||||
LOG(TRACE) << "executing upgrade check: not disable server features";
|
||||
LOG(TRACE) << "executing upgrade check: not disabling server features";
|
||||
return;
|
||||
}
|
||||
|
||||
LOG(TRACE) << "executing upgrade procedure: disable server features";
|
||||
LOG(TRACE) << "executing upgrade procedure: disabling server features";
|
||||
|
||||
ApplicationServer::disableFeatures(_nonServerFeatures);
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ void SchedulerFeature::start() {
|
|||
LOG_TOPIC(TRACE, Logger::STARTUP) << name() << "::start";
|
||||
|
||||
buildScheduler();
|
||||
buildControlCHandler();
|
||||
buildHangupHandler();
|
||||
|
||||
bool ok = _scheduler->start(nullptr);
|
||||
|
||||
|
@ -286,7 +286,7 @@ void SchedulerFeature::buildControlCHandler() {
|
|||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
if (_scheduler != nullptr) {
|
||||
Task* controlC = new ControlCTask(server());
|
||||
|
||||
int res = _scheduler->registerTask(controlC);
|
||||
|
@ -296,8 +296,9 @@ void SchedulerFeature::buildControlCHandler() {
|
|||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// hangup handler
|
||||
void SchedulerFeature::buildHangupHandler() {
|
||||
#ifndef WIN32
|
||||
{
|
||||
Task* hangup = new HangupTask();
|
||||
|
|
|
@ -57,6 +57,7 @@ class SchedulerFeature final : public application_features::ApplicationFeature {
|
|||
size_t concurrency() const { return static_cast<size_t>(_nrSchedulerThreads); }
|
||||
void setProcessorAffinity(std::vector<size_t> const& cores);
|
||||
void buildControlCHandler();
|
||||
void buildHangupHandler();
|
||||
|
||||
private:
|
||||
void buildScheduler();
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
# config file for arango-dfdb
|
||||
|
||||
no-upgrade = true
|
||||
no-server = true
|
||||
|
||||
[database]
|
||||
upgrade = false
|
||||
upgrade-check = false
|
||||
directory= @LOCALSTATEDIR@/lib/arangodb
|
||||
# maximal-journal-size=33554432
|
||||
|
||||
[server]
|
||||
rest-server = false
|
||||
authenication = false
|
||||
# set number of threads to 1 so we don't have concurrency
|
||||
threads = 1
|
||||
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
no-upgrade = true
|
||||
no-server = true
|
||||
|
||||
[database]
|
||||
# directory= /var/arangodb
|
||||
# maximal-journal-size = 33554432
|
||||
upgrade = false
|
||||
upgrade-check = false
|
||||
|
||||
[server]
|
||||
disable-authentication = true
|
||||
rest-server = false
|
||||
authentication = false
|
||||
# set number of threads to 1 so we don't have concurrency
|
||||
threads = 1
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ const optionsDocumentation = [
|
|||
' - `skipAql`: if set to true the AQL tests are skipped',
|
||||
' - `skipArangoBNonConnKeepAlive`: if set to true benchmark do not use keep-alive',
|
||||
' - `skipArangoB`: if set to true benchmark tests are skipped',
|
||||
' - `skipAuth : testing authentication and authentication_paramaters will be skipped.',
|
||||
' - `skipAuthenication : testing authentication and authentication_paramaters will be skipped.',
|
||||
' - `skipBoost`: if set to true the boost unittests are skipped',
|
||||
' - `skipConfig`: omit the noisy configuration tests',
|
||||
' - `skipFoxxQueues`: omit the test for the foxx queues',
|
||||
|
@ -151,6 +151,7 @@ const optionsDefaults = {
|
|||
"skipAql": false,
|
||||
"skipArangoB": false,
|
||||
"skipArangoBNonConnKeepAlive": true,
|
||||
"skipAuthenication": false,
|
||||
"skipBoost": false,
|
||||
"skipGeo": false,
|
||||
"skipLogAnalysis": false,
|
||||
|
@ -980,6 +981,10 @@ function runInArangosh(options, instanceInfo, file, addArgs) {
|
|||
args["server.endpoint"] = instanceInfo.endpoint;
|
||||
args["javascript.unit-tests"] = fs.join(TOP_DIR, file);
|
||||
|
||||
if (!options.verbose) {
|
||||
args["log.level"] = "warning";
|
||||
}
|
||||
|
||||
if (addArgs !== undefined) {
|
||||
args = _.extend(args, addArgs);
|
||||
}
|
||||
|
@ -1871,9 +1876,18 @@ let testFuncs = {
|
|||
|
||||
testFuncs.arangosh = function(options) {
|
||||
let ret = {
|
||||
"testArangoshExitCodeFail": { status: true, total: 0 },
|
||||
"testArangoshExitCodeSuccess": { status: true, total: 0 },
|
||||
"testArangoshShebang": { status: true, total: 0 },
|
||||
"testArangoshExitCodeFail": {
|
||||
status: true,
|
||||
total: 0
|
||||
},
|
||||
"testArangoshExitCodeSuccess": {
|
||||
status: true,
|
||||
total: 0
|
||||
},
|
||||
"testArangoshShebang": {
|
||||
status: true,
|
||||
total: 0
|
||||
},
|
||||
};
|
||||
|
||||
print("--------------------------------------------------------------------------------");
|
||||
|
@ -1882,7 +1896,7 @@ testFuncs.arangosh = function(options) {
|
|||
|
||||
let args = makeArgsArangosh(options);
|
||||
args["javascript.execute-string"] = "throw('foo')";
|
||||
args["log.level"] = "fatal";
|
||||
args["log.level"] = "error";
|
||||
|
||||
const startTime = time();
|
||||
let rc = executeExternalAndWait(ARANGOSH_BIN, toArgv(args));
|
||||
|
@ -1905,7 +1919,7 @@ testFuncs.arangosh = function(options) {
|
|||
print("--------------------------------------------------------------------------------");
|
||||
|
||||
args["javascript.execute-string"] = ";";
|
||||
args["log.level"] = "fatal";
|
||||
args["log.level"] = "warning";
|
||||
|
||||
const startTime2 = time();
|
||||
rc = executeExternalAndWait(ARANGOSH_BIN, toArgv(args));
|
||||
|
@ -2096,11 +2110,11 @@ testFuncs.arangob = function(options) {
|
|||
}
|
||||
|
||||
let results = {};
|
||||
|
||||
let continueTesting = true;
|
||||
|
||||
for (let i = 0; i < benchTodos.length; i++) {
|
||||
const benchTodo = benchTodos[i];
|
||||
const name = "case" + i;
|
||||
|
||||
if ((options.skipArangoBNonConnKeepAlive) &&
|
||||
benchTodo.hasOwnProperty('keep-alive') &&
|
||||
|
@ -2134,8 +2148,6 @@ testFuncs.arangob = function(options) {
|
|||
let oneResult = runArangoBenchmark(options, instanceInfo, args);
|
||||
print();
|
||||
|
||||
let name = "case" + i;
|
||||
|
||||
results[name] = oneResult;
|
||||
results[name].total++;
|
||||
|
||||
|
@ -2163,7 +2175,7 @@ testFuncs.arangob = function(options) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testFuncs.authentication = function(options) {
|
||||
if (options.skipAuth === true) {
|
||||
if (options.skipAuthenication === true) {
|
||||
print("skipping Authentication tests!");
|
||||
|
||||
return {
|
||||
|
@ -2174,7 +2186,7 @@ testFuncs.authentication = function(options) {
|
|||
};
|
||||
}
|
||||
|
||||
print("Authentication tests...");
|
||||
print(CYAN + "Authentication tests..." + RESET);
|
||||
|
||||
let instanceInfo = startInstance("tcp", options, {
|
||||
"server.authentication": "true"
|
||||
|
@ -2194,9 +2206,11 @@ testFuncs.authentication = function(options) {
|
|||
results.authentication = runInArangosh(options, instanceInfo,
|
||||
fs.join("js", "client", "tests", "auth.js"));
|
||||
|
||||
print("Shutting down...");
|
||||
print(CYAN + "Shutting down..." + RESET);
|
||||
shutdownInstance(instanceInfo, options);
|
||||
print("done.");
|
||||
print(CYAN + "done." + RESET);
|
||||
|
||||
print();
|
||||
|
||||
return results;
|
||||
};
|
||||
|
@ -2229,13 +2243,13 @@ const authTestNames = [
|
|||
|
||||
const authTestServerParams = [{
|
||||
"server.authentication": "true",
|
||||
"server.authenticate-system-only": "false"
|
||||
"server.authentication-system-only": "false"
|
||||
}, {
|
||||
"server.authentication": "true",
|
||||
"server.authenticate-system-only": "true"
|
||||
"server.authentication-system-only": "true"
|
||||
}, {
|
||||
"server.authentication": "false",
|
||||
"server.authenticate-system-only": "true"
|
||||
"server.authentication-system-only": "true"
|
||||
}];
|
||||
|
||||
function checkBodyForJsonToParse(request) {
|
||||
|
@ -2245,8 +2259,8 @@ function checkBodyForJsonToParse(request) {
|
|||
}
|
||||
|
||||
testFuncs.authentication_parameters = function(options) {
|
||||
if (options.skipAuth === true) {
|
||||
print("skipping Authentication with parameters tests!");
|
||||
if (options.skipAuthenication === true) {
|
||||
print(CYAN + "skipping Authentication with parameters tests!" + RESET);
|
||||
return {
|
||||
authentication_parameters: {
|
||||
status: true,
|
||||
|
@ -2255,7 +2269,7 @@ testFuncs.authentication_parameters = function(options) {
|
|||
};
|
||||
}
|
||||
|
||||
print("Authentication with parameters tests...");
|
||||
print(CYAN + "Authentication with parameters tests..." + RESET);
|
||||
|
||||
let downloadOptions = {
|
||||
followRedirects: false,
|
||||
|
@ -2285,7 +2299,7 @@ testFuncs.authentication_parameters = function(options) {
|
|||
};
|
||||
}
|
||||
|
||||
print(Date() + " Starting " + authTestNames[test] + " test");
|
||||
print(CYAN + Date() + " Starting " + authTestNames[test] + " test" + RESET);
|
||||
|
||||
const testName = 'auth_' + authTestNames[test];
|
||||
results[testName] = {
|
||||
|
@ -2298,10 +2312,10 @@ testFuncs.authentication_parameters = function(options) {
|
|||
|
||||
++results[testName].total;
|
||||
|
||||
print(" URL: " + instanceInfo.url + authTestUrl);
|
||||
print(CYAN + " URL: " + instanceInfo.url + authTestUrl + RESET);
|
||||
|
||||
if (!continueTesting) {
|
||||
print("Skipping " + authTestUrl + ", server is gone.");
|
||||
print(RED + "Skipping " + authTestUrl + ", server is gone." + RESET);
|
||||
|
||||
results[testName][authTestUrl] = {
|
||||
status: false,
|
||||
|
@ -2339,11 +2353,13 @@ testFuncs.authentication_parameters = function(options) {
|
|||
|
||||
results[testName].status = results[testName].failed === 0;
|
||||
|
||||
print("Shutting down " + authTestNames[test] + " test...");
|
||||
print(CYAN + "Shutting down " + authTestNames[test] + " test..." + RESET);
|
||||
shutdownInstance(instanceInfo, options);
|
||||
print("done with " + authTestNames[test] + " test.");
|
||||
print(CYAN + "done with " + authTestNames[test] + " test." + RESET);
|
||||
}
|
||||
|
||||
print();
|
||||
|
||||
return results;
|
||||
};
|
||||
|
||||
|
@ -2392,11 +2408,13 @@ testFuncs.config = function(options) {
|
|||
let results = {
|
||||
absolut: {
|
||||
status: true,
|
||||
total: 0
|
||||
total: 0,
|
||||
duration: 0
|
||||
},
|
||||
relative: {
|
||||
status: true,
|
||||
total: 0
|
||||
total: 0,
|
||||
duration: 0
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -2412,6 +2430,8 @@ testFuncs.config = function(options) {
|
|||
print("absolute config tests");
|
||||
print("--------------------------------------------------------------------------------");
|
||||
|
||||
let startTime = time();
|
||||
|
||||
for (let i = 0; i < ts.length; i++) {
|
||||
const test = ts[i];
|
||||
print(CYAN + "checking '" + test + "'" + RESET);
|
||||
|
@ -2438,10 +2458,14 @@ testFuncs.config = function(options) {
|
|||
}
|
||||
}
|
||||
|
||||
results.absolut.duration = time() - startTime;
|
||||
|
||||
print("\n--------------------------------------------------------------------------------");
|
||||
print("relative config tests");
|
||||
print("--------------------------------------------------------------------------------");
|
||||
|
||||
startTime = time();
|
||||
|
||||
for (let i = 0; i < ts.length; i++) {
|
||||
const test = ts[i];
|
||||
print(CYAN + "checking '" + test + "'" + RESET);
|
||||
|
@ -2468,6 +2492,8 @@ testFuncs.config = function(options) {
|
|||
}
|
||||
}
|
||||
|
||||
results.relative.duration = time() - startTime;
|
||||
|
||||
print();
|
||||
|
||||
return results;
|
||||
|
@ -2479,7 +2505,7 @@ testFuncs.config = function(options) {
|
|||
|
||||
testFuncs.dfdb = function(options) {
|
||||
const dataDir = fs.getTempFile();
|
||||
const args = ["-c", "etc/relative/arango-dfdb.conf", "--no-server", dataDir];
|
||||
const args = ["-c", "etc/relative/arango-dfdb.conf", dataDir];
|
||||
|
||||
let results = {};
|
||||
|
||||
|
@ -3734,8 +3760,7 @@ function unitTestPrettyPrintResults(r) {
|
|||
|
||||
if (details.skipped) {
|
||||
print(YELLOW + " [SKIPPED] " + name + RESET);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
print(GREEN + " [SUCCESS] " + name + RESET);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue