mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into spdvpk
This commit is contained in:
commit
768d06444f
|
@ -1,5 +1,5 @@
|
||||||
/*jshint globalstrict:false, strict:true */
|
/*jshint globalstrict:false, strict:true */
|
||||||
/*global assertEqual, assertNotEqual, ARGUMENTS */
|
/*global assertEqual, ARGUMENTS */
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief tests for client-specific functionality
|
/// @brief tests for client-specific functionality
|
||||||
|
@ -29,7 +29,6 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
var jsunity = require("jsunity");
|
var jsunity = require("jsunity");
|
||||||
var console = require("console");
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief test suite
|
/// @brief test suite
|
||||||
|
@ -45,16 +44,37 @@ function agencyTestSuite () {
|
||||||
var agencyServers = ARGUMENTS;
|
var agencyServers = ARGUMENTS;
|
||||||
var whoseTurn = 0; // used to do round robin on agencyServers
|
var whoseTurn = 0; // used to do round robin on agencyServers
|
||||||
|
|
||||||
let request = require("@arangodb/request");
|
var request = require("@arangodb/request");
|
||||||
|
|
||||||
function readAgency(list) {
|
function readAgency(list) {
|
||||||
// We simply try all agency servers in turn until one gives us an HTTP
|
// We simply try all agency servers in turn until one gives us an HTTP
|
||||||
// response:
|
// response:
|
||||||
while (true) {
|
var res = request({url: agencyServers[whoseTurn] + "/read", method: "POST",
|
||||||
var res = request({url: agencyServers[whoseTurn], method: "POST",
|
followRedirects: true, body: JSON.stringify(list),
|
||||||
followRedirects: true, body: JSON.stringify(list)});
|
headers: {"Content-Type": "application/json"}});
|
||||||
console.log(res);
|
res.bodyParsed = JSON.parse(res.body);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function writeAgency(list) {
|
||||||
|
// We simply try all agency servers in turn until one gives us an HTTP
|
||||||
|
// response:
|
||||||
|
var res = request({url: agencyServers[whoseTurn] + "/write", method: "POST",
|
||||||
|
followRedirects: true, body: JSON.stringify(list),
|
||||||
|
headers: {"Content-Type": "application/json"}});
|
||||||
|
res.bodyParsed = JSON.parse(res.body);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
function readAndCheck(list) {
|
||||||
|
var res = readAgency(list);
|
||||||
|
assertEqual(res.statusCode, 200);
|
||||||
|
return res.bodyParsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeAndCheck(list) {
|
||||||
|
var res = writeAgency(list);
|
||||||
|
assertEqual(res.statusCode, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -75,16 +95,44 @@ function agencyTestSuite () {
|
||||||
},
|
},
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief test global help function
|
/// @brief test to write a single top level key
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
testWait : function () {
|
testSingleTopLevel : function () {
|
||||||
require("internal").print("Hallo1", agencyServers);
|
assertEqual(readAndCheck([["x"]]), [{}]);
|
||||||
require("internal").wait(5);
|
writeAndCheck([[{x:12}]]);
|
||||||
require("internal").print("Hallo1");
|
assertEqual(readAndCheck([["x"]]), [{x:12}]);
|
||||||
readAgency();
|
writeAndCheck([[{x:{"op":"delete"}}]]);
|
||||||
assertEqual(1, 1);
|
assertEqual(readAndCheck([["x"]]), [{}]);
|
||||||
assertNotEqual(1, 2);
|
},
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief test to write a single non-top level key
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
testSingleNonTopLevel : function () {
|
||||||
|
assertEqual(readAndCheck([["x/y"]]), [{}]);
|
||||||
|
writeAndCheck([[{"x/y":12}]]);
|
||||||
|
assertEqual(readAndCheck([["x/y"]]), [{x:{y:12}}]);
|
||||||
|
writeAndCheck([[{"x/y":{"op":"delete"}}]]);
|
||||||
|
assertEqual(readAndCheck([["x"]]), [{x:{}}]);
|
||||||
|
writeAndCheck([[{"x":{"op":"delete"}}]]);
|
||||||
|
assertEqual(readAndCheck([["x"]]), [{}]);
|
||||||
|
},
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief test a precondition
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
testPrecondition : function () {
|
||||||
|
writeAndCheck([[{"a":12}]]);
|
||||||
|
assertEqual(readAndCheck([["a"]]), [{a:12}]);
|
||||||
|
writeAndCheck([[{"a":13},{"a":12}]]);
|
||||||
|
assertEqual(readAndCheck([["a"]]), [{a:13}]);
|
||||||
|
var res = writeAgency([[{"a":14},{"a":12}]]);
|
||||||
|
assertEqual(res.statusCode, 412);
|
||||||
|
assertEqual(res.bodyParsed, {error:true, successes:[]});
|
||||||
|
writeAndCheck([[{a:{op:"delete"}}]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
JAVASCRIPT_JSLINT="\
|
if [ "x$@" == "x" ] ; then
|
||||||
|
JAVASCRIPT_JSLINT="\
|
||||||
`find ./js/actions -name "*.js"` \
|
`find ./js/actions -name "*.js"` \
|
||||||
`find ./js/common/bootstrap -name "*.js"` \
|
`find ./js/common/bootstrap -name "*.js"` \
|
||||||
`find ./js/client/bootstrap -name "*.js"` \
|
`find ./js/client/bootstrap -name "*.js"` \
|
||||||
|
@ -36,7 +37,10 @@ JAVASCRIPT_JSLINT="\
|
||||||
./js/server/upgrade-database.js \
|
./js/server/upgrade-database.js \
|
||||||
\
|
\
|
||||||
./js/apps/system/_admin/aardvark/APP/frontend/js/shell/browser.js \
|
./js/apps/system/_admin/aardvark/APP/frontend/js/shell/browser.js \
|
||||||
"
|
"
|
||||||
|
else
|
||||||
|
JAVASCRIPT_JSLINT="$@"
|
||||||
|
fi
|
||||||
|
|
||||||
FILELIST=""
|
FILELIST=""
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue