mirror of https://gitee.com/bigwinds/arangodb
Bug fix/fix duplicate testcasenames (#7003)
This commit is contained in:
parent
87d5d29e5f
commit
15a366b17f
|
@ -89,3 +89,19 @@ exports.Helper = {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
exports.deriveTestSuite = function (deriveFrom, deriveTo, namespace) {
|
||||
for (let testcase in deriveFrom) {
|
||||
let targetTestCase = testcase + namespace;
|
||||
if (testcase === "setUp" ||
|
||||
testcase === "tearDown" ||
|
||||
testcase === "setUpAll" ||
|
||||
testcase === "tearDownAll") {
|
||||
targetTestCase = testcase;
|
||||
}
|
||||
if (deriveTo.hasOwnProperty(targetTestCase)) {
|
||||
throw("Duplicate testname - deriveTo already has the property " + targetTestCase);
|
||||
}
|
||||
deriveTo[targetTestCase] = deriveFrom[testcase];
|
||||
}
|
||||
};
|
||||
|
|
|
@ -174,11 +174,19 @@ function Run (testsuite) {
|
|||
FAILED += result.failed;
|
||||
DURATION += result.duration;
|
||||
|
||||
let duplicates = [];
|
||||
for (var attrname in RESULTS) {
|
||||
if (RESULTS.hasOwnProperty(attrname)) {
|
||||
if (COMPLETE.hasOwnProperty(attrname)) {
|
||||
print("Duplicate testsuite '" + attrname + "' - already have: " + JSON.stringify(COMPLETE[attrname]) + "");
|
||||
duplicates.push(attrname);
|
||||
}
|
||||
COMPLETE[attrname] = RESULTS[attrname];
|
||||
}
|
||||
}
|
||||
if (duplicates.length !== 0) {
|
||||
throw("Duplicate testsuite '" + duplicates + "'");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ function StatementStreamSuite () {
|
|||
/// @brief test cursor
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testCursor : function () {
|
||||
testStreamCursor : function () {
|
||||
var stmt = db._createStatement({ query: "FOR i IN 1..100 RETURN i",
|
||||
options: { stream: true },
|
||||
batchSize: 50});
|
||||
|
@ -202,7 +202,7 @@ function StatementStreamSuite () {
|
|||
/// @brief test to string
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testToString : function () {
|
||||
testStreamToString : function () {
|
||||
var stmt = db._createStatement({ query: "FOR i IN 1..11 RETURN i",
|
||||
options: { stream: true } });
|
||||
var cursor = stmt.execute();
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
var jsunity = require("jsunity");
|
||||
var db = require("@arangodb").db;
|
||||
var ERRORS = require("@arangodb").errors;
|
||||
var deriveTestSuite = require('@arangodb/test-helper').deriveTestSuite;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test suite
|
||||
|
@ -527,15 +528,27 @@ jsunity.run(function IResearchAqlTestSuite_s1_r1() {
|
|||
});
|
||||
|
||||
jsunity.run(function IResearchAqlTestSuite_s4_r1() {
|
||||
return IResearchAqlTestSuite({ numberOfShards: 4, replicationFactor: 1 });
|
||||
let suite = {};
|
||||
|
||||
deriveTestSuite(IResearchAqlTestSuite({ numberOfShards: 4, replicationFactor: 1 }),
|
||||
suite, "_FourShards");
|
||||
return suite;
|
||||
});
|
||||
|
||||
jsunity.run(function IResearchAqlTestSuite_s1_r2() {
|
||||
return IResearchAqlTestSuite({ numberOfShards: 1, replicationFactor: 2 });
|
||||
let suite = {};
|
||||
|
||||
deriveTestSuite(IResearchAqlTestSuite({ numberOfShards: 1, replicationFactor: 2 }),
|
||||
suite, "_ReplTwo");
|
||||
return suite;
|
||||
});
|
||||
|
||||
jsunity.run(function IResearchAqlTestSuite_s4_r3() {
|
||||
return IResearchAqlTestSuite({ numberOfShards: 4, replicationFactor: 2 });
|
||||
let suite = {};
|
||||
|
||||
deriveTestSuite(IResearchAqlTestSuite({ numberOfShards: 4, replicationFactor: 2 }),
|
||||
suite, "_FourShardsReplTwo");
|
||||
return suite;
|
||||
});
|
||||
|
||||
return jsunity.done();
|
||||
|
|
|
@ -80,7 +80,7 @@ function arrayHashIndexSuite () {
|
|||
/// @brief test: get index
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testIndex : function () {
|
||||
testHashIndex : function () {
|
||||
var id = collection.ensureHashIndex("a[*]");
|
||||
|
||||
var idx = collection.index(id.id);
|
||||
|
@ -100,7 +100,7 @@ function arrayHashIndexSuite () {
|
|||
/// @brief test: Multiple identical elements in unique array
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testInsertAndReadArrayCombinedUnique : function () {
|
||||
testHashInsertAndReadArrayCombinedUnique : function () {
|
||||
collection.ensureHashIndex("a[*]", "b[*]", {unique: true});
|
||||
|
||||
collection.save({a: [1, 2], b: ["a", "b"]});
|
||||
|
@ -141,7 +141,7 @@ function arrayHashIndexSuite () {
|
|||
/// @brief test: Multiple identical elements in array with unique constraint
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testInsertAndReadArrayIdenticalElementsUnique : function () {
|
||||
testHashInsertAndReadArrayIdenticalElementsUnique : function () {
|
||||
collection.ensureUniqueConstraint("a[*]");
|
||||
|
||||
collection.save({a: [1, 2, 1, 3, 1]});
|
||||
|
@ -160,7 +160,7 @@ function arrayHashIndexSuite () {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
testInsertBatches : function () {
|
||||
testHashInsertBatches : function () {
|
||||
// this really needs to be 1,000,000 documents to reproduce a bug that
|
||||
// occurred with exactly this value and no others
|
||||
for (var i = 0; i < 1000 * 1000; ++i) {
|
||||
|
@ -226,7 +226,7 @@ function arraySkiplistIndexSuite () {
|
|||
/// @brief test: get index
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testIndex : function () {
|
||||
testSkipIndex : function () {
|
||||
var id = collection.ensureSkiplist("a[*]");
|
||||
|
||||
var idx = collection.index(id.id);
|
||||
|
@ -246,7 +246,7 @@ function arraySkiplistIndexSuite () {
|
|||
/// @brief test: Unique index insertion and reading
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testInsertAndReadArrayUnique : function () {
|
||||
testSkipInsertAndReadArrayUnique : function () {
|
||||
collection.ensureUniqueSkiplist("a[*]");
|
||||
|
||||
collection.save({a: [1, 2]});
|
||||
|
@ -264,7 +264,7 @@ function arraySkiplistIndexSuite () {
|
|||
/// @brief test: Multiple identical elements in array with unique constraint
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testInsertAndReadArrayIdenticalElementsUnique : function () {
|
||||
testSkipInsertAndReadArrayIdenticalElementsUnique : function () {
|
||||
collection.ensureUniqueSkiplist("a[*]");
|
||||
|
||||
collection.save({a: [1, 2, 1, 3, 1]});
|
||||
|
|
|
@ -289,7 +289,7 @@ function EdgeShardingSuite() {
|
|||
db._drop(name1);
|
||||
},
|
||||
|
||||
testCreateWithInvalidSharding : function () {
|
||||
testEdgeCreateWithInvalidSharding : function () {
|
||||
try {
|
||||
db._createEdgeCollection(name1, { shardingStrategy: "peng", numberOfShards: 5 });
|
||||
fail();
|
||||
|
@ -298,7 +298,7 @@ function EdgeShardingSuite() {
|
|||
}
|
||||
},
|
||||
|
||||
testCreateWithNoneSharding : function () {
|
||||
testEdgeCreateWithNoneSharding : function () {
|
||||
try {
|
||||
db._createEdgeCollection(name1, { shardingStrategy: "none", numberOfShards: 5 });
|
||||
fail();
|
||||
|
@ -307,7 +307,7 @@ function EdgeShardingSuite() {
|
|||
}
|
||||
},
|
||||
|
||||
testCreateWithCommunitySharding : function () {
|
||||
testEdgeCreateWithCommunitySharding : function () {
|
||||
let c = db._createEdgeCollection(name1, { shardingStrategy: communityCompat, numberOfShards: 5 });
|
||||
assertEqual(communityCompat, c.properties()["shardingStrategy"]);
|
||||
assertEqual(5, c.properties()["numberOfShards"]);
|
||||
|
@ -324,7 +324,7 @@ function EdgeShardingSuite() {
|
|||
}
|
||||
},
|
||||
|
||||
testCreateWithEnterpriseSharding : function () {
|
||||
testEdgeCreateWithEnterpriseSharding : function () {
|
||||
if (!isEnterprise) {
|
||||
try {
|
||||
db._createEdgeCollection(name1, { shardingStrategy: enterpriseCompat, numberOfShards: 5 });
|
||||
|
@ -334,7 +334,7 @@ function EdgeShardingSuite() {
|
|||
}
|
||||
},
|
||||
|
||||
testCreateWithNonDefaultKeysMissingValues : function () {
|
||||
testEdgeCreateWithNonDefaultKeysMissingValues : function () {
|
||||
let c = db._createEdgeCollection(name1, { shardingStrategy: communityCompat, shardKeys: ["value"], numberOfShards: 5 });
|
||||
assertEqual(communityCompat, c.properties()["shardingStrategy"]);
|
||||
assertEqual(5, c.properties()["numberOfShards"]);
|
||||
|
@ -352,7 +352,7 @@ function EdgeShardingSuite() {
|
|||
});
|
||||
},
|
||||
|
||||
testCreateWithNonDefaultKeysNumericValues : function () {
|
||||
testEdgeCreateWithNonDefaultKeysNumericValues : function () {
|
||||
let c = db._createEdgeCollection(name1, { shardingStrategy: communityCompat, shardKeys: ["value"], numberOfShards: 5 });
|
||||
assertEqual(communityCompat, c.properties()["shardingStrategy"]);
|
||||
assertEqual(5, c.properties()["numberOfShards"]);
|
||||
|
@ -370,7 +370,7 @@ function EdgeShardingSuite() {
|
|||
});
|
||||
},
|
||||
|
||||
testCreateWithNonDefaultKeysNullValues : function () {
|
||||
testEdgeCreateWithNonDefaultKeysNullValues : function () {
|
||||
let c = db._createEdgeCollection(name1, { shardingStrategy: communityCompat, shardKeys: ["value"], numberOfShards: 5 });
|
||||
assertEqual(communityCompat, c.properties()["shardingStrategy"]);
|
||||
assertEqual(5, c.properties()["numberOfShards"]);
|
||||
|
@ -388,7 +388,7 @@ function EdgeShardingSuite() {
|
|||
});
|
||||
},
|
||||
|
||||
testDistributeShardsLikeWithNonDefaultKeys : function () {
|
||||
testEdgeDistributeShardsLikeWithNonDefaultKeys : function () {
|
||||
let c1 = db._createEdgeCollection(name1, { shardingStrategy: communityCompat, shardKeys: ["value"], numberOfShards: 5 });
|
||||
let c2 = db._createEdgeCollection(name2, { distributeShardsLike: name1, shardKeys: ["value"] });
|
||||
assertEqual(communityCompat, c1.properties()["shardingStrategy"]);
|
||||
|
|
|
@ -343,7 +343,7 @@ function EdgeShardingSuite() {
|
|||
db._drop(name1);
|
||||
},
|
||||
|
||||
testCreateWithoutSharding : function () {
|
||||
testEdgeCreateWithoutSharding : function () {
|
||||
let c = db._createEdgeCollection(name1, { numberOfShards: 5 });
|
||||
assertEqual(defaultSharding, c.properties()["shardingStrategy"]);
|
||||
assertEqual(5, c.properties()["numberOfShards"]);
|
||||
|
@ -360,7 +360,7 @@ function EdgeShardingSuite() {
|
|||
}
|
||||
},
|
||||
|
||||
testCreateWithInvalidSharding : function () {
|
||||
testEdgeCreateWithInvalidSharding : function () {
|
||||
try {
|
||||
db._createEdgeCollection(name1, { shardingStrategy: "peng", numberOfShards: 5 });
|
||||
fail();
|
||||
|
@ -369,7 +369,7 @@ function EdgeShardingSuite() {
|
|||
}
|
||||
},
|
||||
|
||||
testCreateWithNoneSharding : function () {
|
||||
testEdgeCreateWithNoneSharding : function () {
|
||||
try {
|
||||
db._createEdgeCollection(name1, { shardingStrategy: "none", numberOfShards: 5 });
|
||||
fail();
|
||||
|
@ -378,7 +378,7 @@ function EdgeShardingSuite() {
|
|||
}
|
||||
},
|
||||
|
||||
testCreateWithCommunitySharding : function () {
|
||||
testEdgeCreateWithCommunitySharding : function () {
|
||||
let c = db._createEdgeCollection(name1, { shardingStrategy: hash, numberOfShards: 5 });
|
||||
assertEqual(hash, c.properties()["shardingStrategy"]);
|
||||
assertEqual(5, c.properties()["numberOfShards"]);
|
||||
|
@ -395,7 +395,7 @@ function EdgeShardingSuite() {
|
|||
}
|
||||
},
|
||||
|
||||
testCreateWithEnterpriseSharding : function () {
|
||||
testEdgeCreateWithEnterpriseSharding : function () {
|
||||
if (!isEnterprise) {
|
||||
try {
|
||||
db._createEdgeCollection(name1, { shardingStrategy: "enterprise-compat", numberOfShards: 5 });
|
||||
|
@ -405,7 +405,7 @@ function EdgeShardingSuite() {
|
|||
}
|
||||
},
|
||||
|
||||
testDistributeShardsLikeWithoutSharding : function () {
|
||||
testEdgeDistributeShardsLikeWithoutSharding : function () {
|
||||
let c1 = db._createEdgeCollection(name1, { numberOfShards: 5 });
|
||||
let c2 = db._createEdgeCollection(name2, { distributeShardsLike: name1 });
|
||||
assertEqual(defaultSharding, c1.properties()["shardingStrategy"]);
|
||||
|
@ -426,7 +426,7 @@ function EdgeShardingSuite() {
|
|||
}
|
||||
},
|
||||
|
||||
testCreateWithNonDefaultKeysMissingValues : function () {
|
||||
testEdgeCreateWithNonDefaultKeysMissingValues : function () {
|
||||
let c = db._createEdgeCollection(name1, { shardingStrategy: hash, shardKeys: ["value"], numberOfShards: 5 });
|
||||
assertEqual(hash, c.properties()["shardingStrategy"]);
|
||||
assertEqual(5, c.properties()["numberOfShards"]);
|
||||
|
@ -444,7 +444,7 @@ function EdgeShardingSuite() {
|
|||
});
|
||||
},
|
||||
|
||||
testCreateWithNonDefaultKeysNumericValues : function () {
|
||||
testEdgeCreateWithNonDefaultKeysNumericValues : function () {
|
||||
let c = db._createEdgeCollection(name1, { shardingStrategy: hash, shardKeys: ["value"], numberOfShards: 5 });
|
||||
assertEqual(hash, c.properties()["shardingStrategy"]);
|
||||
assertEqual(5, c.properties()["numberOfShards"]);
|
||||
|
@ -462,7 +462,7 @@ function EdgeShardingSuite() {
|
|||
});
|
||||
},
|
||||
|
||||
testCreateWithNonDefaultKeysNullValues : function () {
|
||||
testEdgeCreateWithNonDefaultKeysNullValues : function () {
|
||||
let c = db._createEdgeCollection(name1, { shardingStrategy: hash, shardKeys: ["value"], numberOfShards: 5 });
|
||||
assertEqual(hash, c.properties()["shardingStrategy"]);
|
||||
assertEqual(5, c.properties()["numberOfShards"]);
|
||||
|
@ -480,7 +480,7 @@ function EdgeShardingSuite() {
|
|||
});
|
||||
},
|
||||
|
||||
testDistributeShardsLikeWithoutShardingNonDefaultKeysStringValues : function () {
|
||||
testEdgeDistributeShardsLikeWithoutShardingNonDefaultKeysStringValues : function () {
|
||||
let c1 = db._createEdgeCollection(name1, { numberOfShards: 5, shardKeys: ["value"] });
|
||||
let c2 = db._createEdgeCollection(name2, { distributeShardsLike: name1, shardKeys: ["value"] });
|
||||
assertEqual(defaultSharding, c1.properties()["shardingStrategy"]);
|
||||
|
@ -502,7 +502,7 @@ function EdgeShardingSuite() {
|
|||
});
|
||||
},
|
||||
|
||||
testDistributeShardsLikeWithoutShardingNonDefaultKeys : function () {
|
||||
testEdgeDistributeShardsLikeWithoutShardingNonDefaultKeys : function () {
|
||||
let c1 = db._createEdgeCollection(name1, { numberOfShards: 5, shardKeys: ["value"] });
|
||||
let c2 = db._createEdgeCollection(name2, { distributeShardsLike: name1, shardKeys: ["value"] });
|
||||
assertEqual(defaultSharding, c1.properties()["shardingStrategy"]);
|
||||
|
@ -522,7 +522,7 @@ function EdgeShardingSuite() {
|
|||
});
|
||||
},
|
||||
|
||||
testDistributeShardsLikeWithNonDefaultKeys : function () {
|
||||
testEdgeDistributeShardsLikeWithNonDefaultKeys : function () {
|
||||
let c1 = db._createEdgeCollection(name1, { shardingStrategy: hash, shardKeys: ["value"], numberOfShards: 5 });
|
||||
let c2 = db._createEdgeCollection(name2, { distributeShardsLike: name1, shardKeys: ["value"] });
|
||||
assertEqual(hash, c1.properties()["shardingStrategy"]);
|
||||
|
|
|
@ -1427,7 +1427,7 @@ function DatabaseDocumentSuiteErrorHandling () {
|
|||
/// @brief bad handle
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testErrorHandlingBadHandle : function () {
|
||||
testDBErrorHandlingBadHandle : function () {
|
||||
try {
|
||||
db._document(" 123456");
|
||||
fail();
|
||||
|
@ -1441,7 +1441,7 @@ function DatabaseDocumentSuiteErrorHandling () {
|
|||
/// @brief bad handle replace
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testErrorHandlingBadHandleReplace : function () {
|
||||
testDBErrorHandlingBadHandleReplace : function () {
|
||||
try {
|
||||
db._replace("123456 ", {});
|
||||
fail();
|
||||
|
@ -1455,7 +1455,7 @@ function DatabaseDocumentSuiteErrorHandling () {
|
|||
/// @brief bad handle delete
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testErrorHandlingBadHandleDelete : function () {
|
||||
testDBErrorHandlingBadHandleDelete : function () {
|
||||
try {
|
||||
db._remove("123/45/6");
|
||||
fail();
|
||||
|
@ -1469,7 +1469,7 @@ function DatabaseDocumentSuiteErrorHandling () {
|
|||
/// @brief unknown document identifier
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testErrorHandlingUnknownDocument : function () {
|
||||
testDBErrorHandlingUnknownDocument : function () {
|
||||
var collection = db._create(cn, { waitForSync : false });
|
||||
|
||||
try {
|
||||
|
@ -1521,7 +1521,7 @@ function DatabaseDocumentSuite () {
|
|||
/// @brief read a document
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReadDocument : function () {
|
||||
testDBReadDocument : function () {
|
||||
var d = collection.save({ "Hello" : "World" });
|
||||
|
||||
var doc = db._document(d._id);
|
||||
|
@ -1539,7 +1539,7 @@ function DatabaseDocumentSuite () {
|
|||
/// @brief read a document with conflict
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReadDocumentConflict : function () {
|
||||
testDBReadDocumentConflict : function () {
|
||||
var d = collection.save({ "Hello" : "World" });
|
||||
|
||||
var doc = db._document(d._id);
|
||||
|
@ -1568,7 +1568,7 @@ function DatabaseDocumentSuite () {
|
|||
/// @brief exists
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testExistsDocument : function () {
|
||||
testDBExistsDocument : function () {
|
||||
var d1 = collection.save({ _key : "baz" });
|
||||
|
||||
// string keys
|
||||
|
@ -1621,7 +1621,7 @@ function DatabaseDocumentSuite () {
|
|||
/// @brief replace a document
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReplaceDocument : function () {
|
||||
testDBReplaceDocument : function () {
|
||||
var a1 = collection.save({ a : 1});
|
||||
|
||||
assertTypeOf("string", a1._id);
|
||||
|
@ -1663,7 +1663,7 @@ function DatabaseDocumentSuite () {
|
|||
/// @brief tests the _replace function with new signature
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testReplaceWithNewSignatureDocument : function () {
|
||||
testDBReplaceWithNewSignatureDocument : function () {
|
||||
var a1 = collection.save({ a : 1});
|
||||
|
||||
assertTypeOf("string", a1._id);
|
||||
|
@ -1705,7 +1705,7 @@ function DatabaseDocumentSuite () {
|
|||
/// @brief update a document
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testUpdateDocument : function () {
|
||||
testDBUpdateDocument : function () {
|
||||
var a1 = collection.save({ a : 1});
|
||||
|
||||
assertTypeOf("string", a1._id);
|
||||
|
@ -1822,7 +1822,7 @@ function DatabaseDocumentSuite () {
|
|||
/// @brief tests update function with new signature
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testNewsignatureOf_UpdateDocument : function () {
|
||||
testDBNewsignatureOf_UpdateDocument : function () {
|
||||
var a1 = collection.save({ a : 1});
|
||||
|
||||
assertTypeOf("string", a1._id);
|
||||
|
@ -1940,7 +1940,7 @@ function DatabaseDocumentSuite () {
|
|||
/// @brief delete a document
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testDeleteDocument : function () {
|
||||
testDBDeleteDocument : function () {
|
||||
var a1 = collection.save({ a : 1});
|
||||
|
||||
assertTypeOf("string", a1._id);
|
||||
|
@ -1980,7 +1980,7 @@ function DatabaseDocumentSuite () {
|
|||
/// of the remove function
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testDeleteWithNewSignatureDocument : function () {
|
||||
testDBDeleteWithNewSignatureDocument : function () {
|
||||
var a1 = collection.save({ a : 1});
|
||||
|
||||
assertTypeOf("string", a1._id);
|
||||
|
@ -2019,7 +2019,7 @@ function DatabaseDocumentSuite () {
|
|||
/// @brief delete a deleted document
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testDeleteDeletedDocument : function () {
|
||||
testDBDeleteDeletedDocument : function () {
|
||||
var a1 = collection.save({ a : 1});
|
||||
|
||||
assertTypeOf("string", a1._id);
|
||||
|
@ -2040,7 +2040,7 @@ function DatabaseDocumentSuite () {
|
|||
/// @brief create a very big document
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testDocumentVeryLarge : function () {
|
||||
testDBDocumentVeryLarge : function () {
|
||||
// create a very big and silly document, just to blow up the datafiles
|
||||
var doc = { };
|
||||
for (var i = 0; i < 60000; ++i) {
|
||||
|
@ -2057,7 +2057,7 @@ function DatabaseDocumentSuite () {
|
|||
/// @brief create a document bigger than shape file size
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testBigShape : function () {
|
||||
testDBBigShape : function () {
|
||||
// create a very big and silly document, just to blow up the datafiles
|
||||
var doc = { _key : "mydoc" };
|
||||
for (var i = 0; i < 50000; ++i) {
|
||||
|
|
|
@ -1784,7 +1784,7 @@ function GeneralGraphTraversalSuite () {
|
|||
/// @brief test outbound expander
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testOutboundExpander : function () {
|
||||
testGGOutboundExpander : function () {
|
||||
var config = {
|
||||
sort: function (l, r) { return l._key < r._key ? -1 : 1; },
|
||||
datasource: traversal.generalGraphDatasourceFactory(gn)
|
||||
|
@ -1819,7 +1819,7 @@ function GeneralGraphTraversalSuite () {
|
|||
/// @brief test inbound expander
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testInboundExpander : function () {
|
||||
testGGInboundExpander : function () {
|
||||
var config = {
|
||||
sort: function (l, r) { return l._key < r._key ? -1 : 1; },
|
||||
datasource: traversal.generalGraphDatasourceFactory(gn)
|
||||
|
@ -1854,7 +1854,7 @@ function GeneralGraphTraversalSuite () {
|
|||
/// @brief test iteration
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testIterateFullOutbound : function () {
|
||||
testGGIterateFullOutbound : function () {
|
||||
var config = {
|
||||
datasource: traversal.generalGraphDatasourceFactory(gn),
|
||||
strategy: Traverser.DEPTH_FIRST,
|
||||
|
@ -1893,7 +1893,7 @@ function GeneralGraphTraversalSuite () {
|
|||
/// @brief test iteration
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testIterateInbound : function () {
|
||||
testGGIterateInbound : function () {
|
||||
var config = {
|
||||
datasource: traversal.generalGraphDatasourceFactory(gn),
|
||||
strategy: Traverser.DEPTH_FIRST,
|
||||
|
@ -1925,7 +1925,7 @@ function GeneralGraphTraversalSuite () {
|
|||
/// @brief test iteration
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testIterateUniqueGlobalVertices : function () {
|
||||
testGGIterateUniqueGlobalVertices : function () {
|
||||
var config = {
|
||||
datasource: traversal.generalGraphDatasourceFactory(gn),
|
||||
strategy: Traverser.DEPTH_FIRST,
|
||||
|
@ -1964,7 +1964,7 @@ function GeneralGraphTraversalSuite () {
|
|||
/// @brief test iteration
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testIterateUniquePathVertices : function () {
|
||||
testGGIterateUniquePathVertices : function () {
|
||||
var config = {
|
||||
datasource: traversal.generalGraphDatasourceFactory(gn),
|
||||
strategy: Traverser.DEPTH_FIRST,
|
||||
|
@ -2007,7 +2007,7 @@ function GeneralGraphTraversalSuite () {
|
|||
/// @brief test iteration
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testIterateUniqueEdges : function () {
|
||||
testGGIterateUniqueEdges : function () {
|
||||
var config = {
|
||||
datasource: traversal.generalGraphDatasourceFactory(gn),
|
||||
strategy: Traverser.DEPTH_FIRST,
|
||||
|
|
|
@ -1022,7 +1022,7 @@ function SphericalIndexCreationSuite() {
|
|||
/// @brief test: updates
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testUpdates : function () {
|
||||
testSPIUpdates : function () {
|
||||
collection.truncate();
|
||||
|
||||
//collection.ensureGeoIndex("coordinates", true);
|
||||
|
@ -1096,7 +1096,7 @@ function SphericalIndexCreationSuite() {
|
|||
/// @brief test: index creation (list)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testCreationIndexLocationList : function () {
|
||||
testSPICreationIndexLocationList : function () {
|
||||
//var idx = collection.ensureGeoIndex("loc");
|
||||
let idx = collection.ensureIndex({type: "geo", fields:["loc"], geoJson: false, legacy: false});
|
||||
var id = idx.id;
|
||||
|
@ -1145,7 +1145,7 @@ function SphericalIndexCreationSuite() {
|
|||
/// @brief test: index creation (list, geo-json)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testCreationIndexLocationListGeo : function () {
|
||||
testSPICreationIndexLocationListGeo : function () {
|
||||
//var idx = collection.ensureGeoIndex("loc", true);
|
||||
let idx = collection.ensureIndex({type: "geo", fields:["loc"], geoJson: true, legacy: false});
|
||||
var id = idx.id;
|
||||
|
@ -1194,7 +1194,7 @@ function SphericalIndexCreationSuite() {
|
|||
/// @brief test: index creation (attributes)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testCreationIndexLocationAttributes : function () {
|
||||
testSPICreationIndexLocationAttributes : function () {
|
||||
//var idx = collection.ensureGeoIndex("lat", "lon");
|
||||
let idx = collection.ensureIndex({type: "geo", fields:["lat", "lon"], legacy: false});
|
||||
var id = idx.id;
|
||||
|
@ -1227,7 +1227,7 @@ function SphericalIndexCreationSuite() {
|
|||
/// @brief test: constraint creation (list)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testCreationConstraintLocationList : function () {
|
||||
testSPICreationConstraintLocationList : function () {
|
||||
//var idx = collection.ensureGeoConstraint("loc", false);
|
||||
let idx = collection.ensureIndex({type: "geo", fields:["loc"], geoJson: false, legacy: false});
|
||||
var id = idx.id;
|
||||
|
|
|
@ -742,7 +742,7 @@ function getIndexesEdgesSuite() {
|
|||
/// @brief test: get primary
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testGetPrimary : function () {
|
||||
testEdgeGetPrimary : function () {
|
||||
var res = collection.getIndexes();
|
||||
|
||||
assertEqual(2, res.length);
|
||||
|
@ -777,7 +777,7 @@ function getIndexesEdgesSuite() {
|
|||
/// @brief test: get geo constraint
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testGetGeoConstraint1 : function () {
|
||||
testEdgeGetGeoConstraint1 : function () {
|
||||
collection.ensureGeoConstraint("lat", "lon", false);
|
||||
var res = collection.getIndexes();
|
||||
|
||||
|
@ -797,7 +797,7 @@ function getIndexesEdgesSuite() {
|
|||
/// @brief test: get geo constraint
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testGetGeoConstraint2 : function () {
|
||||
testEdgeGetGeoConstraint2 : function () {
|
||||
collection.ensureGeoConstraint("lat", "lon", true);
|
||||
var res = collection.getIndexes();
|
||||
|
||||
|
@ -817,7 +817,7 @@ function getIndexesEdgesSuite() {
|
|||
/// @brief test: get geo constraint
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testGetGeoConstraint3 : function () {
|
||||
testEdgeGetGeoConstraint3 : function () {
|
||||
collection.ensureGeoConstraint("lat", true, true);
|
||||
var res = collection.getIndexes();
|
||||
|
||||
|
@ -838,7 +838,7 @@ function getIndexesEdgesSuite() {
|
|||
/// @brief test: get geo index
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testGetGeoIndex1 : function () {
|
||||
testEdgeGetGeoIndex1 : function () {
|
||||
collection.ensureGeoIndex("lat", true, true);
|
||||
var res = collection.getIndexes();
|
||||
|
||||
|
@ -859,7 +859,7 @@ function getIndexesEdgesSuite() {
|
|||
/// @brief test: get geo index
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testGetGeoIndex2 : function () {
|
||||
testEdgeGetGeoIndex2 : function () {
|
||||
collection.ensureGeoIndex("lat", "lon");
|
||||
var res = collection.getIndexes();
|
||||
|
||||
|
@ -879,7 +879,7 @@ function getIndexesEdgesSuite() {
|
|||
/// @brief test: get unique hash index
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testGetHashUnique : function () {
|
||||
testEdgeGetHashUnique : function () {
|
||||
collection.ensureUniqueConstraint("value");
|
||||
var res = collection.getIndexes();
|
||||
|
||||
|
@ -899,7 +899,7 @@ function getIndexesEdgesSuite() {
|
|||
/// @brief test: get unique hash index
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testGetSparseHashUnique : function () {
|
||||
testEdgeGetSparseHashUnique : function () {
|
||||
collection.ensureUniqueConstraint("value", { sparse: true });
|
||||
var res = collection.getIndexes();
|
||||
|
||||
|
@ -919,7 +919,7 @@ function getIndexesEdgesSuite() {
|
|||
/// @brief test: get hash index
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testGetHash : function () {
|
||||
testEdgeGetHash : function () {
|
||||
collection.ensureHashIndex("value");
|
||||
var res = collection.getIndexes();
|
||||
|
||||
|
@ -939,7 +939,7 @@ function getIndexesEdgesSuite() {
|
|||
/// @brief test: get hash index
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testGetSparseHash : function () {
|
||||
testEdgeGetSparseHash : function () {
|
||||
collection.ensureHashIndex("value", { sparse: true });
|
||||
var res = collection.getIndexes();
|
||||
|
||||
|
@ -959,7 +959,7 @@ function getIndexesEdgesSuite() {
|
|||
/// @brief test: get unique skiplist index
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testGetSkiplistUnique : function () {
|
||||
testEdgeGetSkiplistUnique : function () {
|
||||
collection.ensureUniqueSkiplist("value");
|
||||
var res = collection.getIndexes();
|
||||
|
||||
|
@ -979,7 +979,7 @@ function getIndexesEdgesSuite() {
|
|||
/// @brief test: get unique skiplist index
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testGetSparseSkiplistUnique : function () {
|
||||
testEdgeGetSparseSkiplistUnique : function () {
|
||||
collection.ensureUniqueSkiplist("value", { sparse: true });
|
||||
var res = collection.getIndexes();
|
||||
|
||||
|
@ -999,7 +999,7 @@ function getIndexesEdgesSuite() {
|
|||
/// @brief test: get skiplist index
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testGetSkiplist : function () {
|
||||
testEdgeGetSkiplist : function () {
|
||||
collection.ensureSkiplist("value");
|
||||
var res = collection.getIndexes();
|
||||
|
||||
|
@ -1018,7 +1018,7 @@ function getIndexesEdgesSuite() {
|
|||
/// @brief test: get skiplist index
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testGetSparseSkiplist : function () {
|
||||
testEdgeGetSparseSkiplist : function () {
|
||||
collection.ensureSkiplist("value", { sparse: true });
|
||||
var res = collection.getIndexes();
|
||||
|
||||
|
@ -1038,7 +1038,7 @@ function getIndexesEdgesSuite() {
|
|||
/// @brief test: get fulltext index
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testGetFulltext: function () {
|
||||
testEdgeGetFulltext: function () {
|
||||
collection.ensureFulltextIndex("value");
|
||||
var res = collection.getIndexes();
|
||||
|
||||
|
|
|
@ -320,7 +320,7 @@ function SimpleQueryRemoveByKeysSuite () {
|
|||
// / @brief remove in empty collection
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testEmptyCollection: function () {
|
||||
testRemoveEmptyCollection: function () {
|
||||
var result = c.removeByKeys([ 'foo', 'bar', 'baz' ]);
|
||||
|
||||
assertEqual({ removed: 0, ignored: 3 }, result);
|
||||
|
@ -330,7 +330,7 @@ function SimpleQueryRemoveByKeysSuite () {
|
|||
// / @brief remove in empty collection and empty lookup list
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testEmptyCollectionAndArray: function () {
|
||||
testRemoveEmptyCollectionAndArray: function () {
|
||||
var result = c.removeByKeys([ ]);
|
||||
|
||||
assertEqual({ removed: 0, ignored: 0 }, result);
|
||||
|
@ -340,7 +340,7 @@ function SimpleQueryRemoveByKeysSuite () {
|
|||
// / @brief remove in collection with empty lookup list
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testEmptyArray: function () {
|
||||
testRemoveEmptyArray: function () {
|
||||
for (var i = 0; i < 100; ++i) {
|
||||
c.insert({ _key: 'test' + i });
|
||||
}
|
||||
|
@ -354,7 +354,7 @@ function SimpleQueryRemoveByKeysSuite () {
|
|||
// / @brief remove in collection with existing and nonexisting keys
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testMixed: function () {
|
||||
testRemoveMixed: function () {
|
||||
var keys = [ ];
|
||||
for (var i = 0; i < 500; ++i) {
|
||||
c.insert({ _key: 'test' + i });
|
||||
|
@ -377,7 +377,7 @@ function SimpleQueryRemoveByKeysSuite () {
|
|||
// / @brief remove in collection with nonexisting keys
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testNonExisting: function () {
|
||||
testRemoveNonExisting: function () {
|
||||
var keys = [ ];
|
||||
for (var i = 0; i < 100; ++i) {
|
||||
keys.push('test' + i);
|
||||
|
@ -392,7 +392,7 @@ function SimpleQueryRemoveByKeysSuite () {
|
|||
// / @brief remove in collection with numeric keys
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testNumericKeys: function () {
|
||||
testRemoveNumericKeys: function () {
|
||||
for (var i = 0; i < 100; ++i) {
|
||||
c.insert({ _key: String(i) });
|
||||
}
|
||||
|
@ -406,7 +406,7 @@ function SimpleQueryRemoveByKeysSuite () {
|
|||
// / @brief remove using invalid keys
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testInvalidKeys: function () {
|
||||
testRemoveInvalidKeys: function () {
|
||||
var result = c.removeByKeys([ ' ', '* ', ' bfffff/\\&, ', '////.,;::' ]);
|
||||
|
||||
assertEqual({ removed: 0, ignored: 4 }, result);
|
||||
|
@ -2127,7 +2127,7 @@ function SimpleQuerySparseRangeSuite () {
|
|||
// / @brief test: range
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testRange: function () {
|
||||
testSparseRange: function () {
|
||||
var l = collection.range('age', 10, 13).toArray().map(age).sort(ageSort);
|
||||
assertEqual([ 10, 11, 12 ], l);
|
||||
|
||||
|
@ -2145,7 +2145,7 @@ function SimpleQuerySparseRangeSuite () {
|
|||
// / @brief test: range
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testRangeMultipleIndexes: function () {
|
||||
testSparseRangeMultipleIndexes: function () {
|
||||
// now we have a sparse and a non-sparse index
|
||||
collection.ensureSkiplist('age', { sparse: false });
|
||||
|
||||
|
@ -2205,7 +2205,7 @@ function SimpleQueryUniqueRangeSuite () {
|
|||
// / @brief test: range
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testRange: function () {
|
||||
testUniqueRange: function () {
|
||||
var l = collection.range('age', 10, 13).toArray().map(age).sort(ageSort);
|
||||
assertEqual([ 10, 11, 12 ], l);
|
||||
|
||||
|
@ -2261,7 +2261,7 @@ function SimpleQueryUniqueSparseRangeSuite () {
|
|||
// / @brief test: range
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testRange: function () {
|
||||
testUniqueSparseRange: function () {
|
||||
var l = collection.range('age', 10, 13).toArray().map(age).sort(ageSort);
|
||||
assertEqual([ 10, 11, 12 ], l);
|
||||
|
||||
|
@ -2279,7 +2279,7 @@ function SimpleQueryUniqueSparseRangeSuite () {
|
|||
// / @brief test: range
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testRangeMultipleIndexes: function () {
|
||||
testUniqueSparseRangeMultipleIndexes: function () {
|
||||
// now we have a sparse and a non-sparse index
|
||||
collection.ensureUniqueSkiplist('age', { sparse: false });
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ function nestedAttributeAccessTestSuite () {
|
|||
/// @brief test direct access
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testDirectAccess : function () {
|
||||
testNestedDirectAccess : function () {
|
||||
var queryRes = [
|
||||
{ 'xpRes': 3, 'q': "FOR item IN @@cn FILTER item.foo.bar == 'searchvalue' RETURN item.whichOne" },
|
||||
{ 'xpRes': 2, 'q': "FOR item IN @@cn FILTER item.`foo.bar` == 'searchvalue' RETURN item.whichOne" },
|
||||
|
@ -196,7 +196,7 @@ function nestedAttributeAccessTestSuite () {
|
|||
}
|
||||
},
|
||||
|
||||
testDirectAccessIndexed : function () {
|
||||
testNestedDirectAccessIndexed : function () {
|
||||
var queryRes = [
|
||||
{ 'xpRes': 3, 'q': "FOR item IN @@cn FILTER item.foo.bar == 'searchvalue' RETURN item.whichOne" },
|
||||
{ 'xpRes': 2, 'q': "FOR item IN @@cn FILTER item.`foo.bar` == 'searchvalue' RETURN item.whichOne" },
|
||||
|
|
|
@ -289,7 +289,7 @@ function ahuacatlCallUserDefinedTestSuite () {
|
|||
/// @brief test call function
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testCall : function () {
|
||||
testUserDefCall : function () {
|
||||
var data = [
|
||||
[ null, [ "UnitTests::func::call", 1234 ] ],
|
||||
[ null, [ "UnitTests::func::call", "foo", "bar" ] ],
|
||||
|
@ -317,7 +317,7 @@ function ahuacatlCallUserDefinedTestSuite () {
|
|||
/// @brief test apply function
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testApply : function () {
|
||||
testUserDefApply : function () {
|
||||
var data = [
|
||||
[ null, [ "UnitTests::func::call", 1234 ] ],
|
||||
[ null, [ "UnitTests::func::call", "foo", "bar" ] ],
|
||||
|
@ -349,7 +349,7 @@ function ahuacatlCallUserDefinedTestSuite () {
|
|||
/// @brief test non-existing functions
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testNonExisting : function () {
|
||||
testUserDefNonExisting : function () {
|
||||
assertQueryError(errors.ERROR_QUERY_FUNCTION_NOT_FOUND.code, "RETURN CALL('UNITTESTS::FUNC::MEOW', 'baz')");
|
||||
assertQueryError(errors.ERROR_QUERY_FUNCTION_NOT_FOUND.code, "RETURN APPLY('UNITTESTS::FUNC::MEOW', [ 'baz' ])");
|
||||
},
|
||||
|
@ -358,7 +358,7 @@ function ahuacatlCallUserDefinedTestSuite () {
|
|||
/// @brief test throwing function
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testThrows : function () {
|
||||
testUserDefThrows : function () {
|
||||
assertQueryWarningAndNull(errors.ERROR_QUERY_FUNCTION_RUNTIME_ERROR.code, "RETURN CALL('UNITTESTS::FUNC::THROWING')");
|
||||
assertQueryWarningAndNull(errors.ERROR_QUERY_FUNCTION_RUNTIME_ERROR.code, "RETURN APPLY('UNITTESTS::FUNC::THROWING', [ ])");
|
||||
},
|
||||
|
@ -367,7 +367,7 @@ function ahuacatlCallUserDefinedTestSuite () {
|
|||
/// @brief test function name passed from the outside
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testFunctionName : function () {
|
||||
testUserDefFunctionName : function () {
|
||||
aqlfunctions.register("UnitTests::func::call", function () { return this.name; });
|
||||
|
||||
var actual = getQueryResults("RETURN UnitTests::func::call()");
|
||||
|
|
|
@ -2139,7 +2139,7 @@ function ahuacatlQueryGeneralCyclesSuite() {
|
|||
/// @brief checks GRAPH_SHORTEST_PATH()
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testGRAPH_SHORTEST_PATH: function () {
|
||||
testCycleGRAPH_SHORTEST_PATH: function () {
|
||||
var actual;
|
||||
actual = getQueryResults("FOR e IN arangodb::GRAPH_SHORTEST_PATH('werKenntWen', {}, " +
|
||||
"{}, {direction : 'inbound', algorithm : 'Floyd-Warshall'}) SORT e.vertices[0], e.vertices[LENGTH(e.vertices) - 1] " +
|
||||
|
@ -2254,7 +2254,7 @@ function ahuacatlQueryGeneralCyclesSuite() {
|
|||
});
|
||||
},
|
||||
|
||||
testGRAPH_CLOSENESS: function () {
|
||||
testCycleGRAPH_CLOSENESS: function () {
|
||||
|
||||
var actual;
|
||||
actual = getQueryResults("RETURN arangodb::GRAPH_ABSOLUTE_CLOSENESS('werKenntWen', {}, {algorithm : 'Floyd-Warshall'})");
|
||||
|
@ -2288,7 +2288,7 @@ function ahuacatlQueryGeneralCyclesSuite() {
|
|||
assertEqual(actual[0]["UnitTests_Leipziger/Gerda"], 0);
|
||||
},
|
||||
|
||||
testGRAPH_CLOSENESS_OUTBOUND: function () {
|
||||
testCycleGRAPH_CLOSENESS_OUTBOUND: function () {
|
||||
var actual;
|
||||
actual = getQueryResults("RETURN arangodb::GRAPH_ABSOLUTE_CLOSENESS('werKenntWen',{}, {direction : 'outbound', algorithm : 'Floyd-Warshall'})");
|
||||
assertEqual(actual[0]["UnitTests_Berliner/Anton"], 4);
|
||||
|
@ -2309,7 +2309,7 @@ function ahuacatlQueryGeneralCyclesSuite() {
|
|||
assertEqual(actual[0]["UnitTests_Leipziger/Gerda"].toFixed(6), (0).toFixed(6));
|
||||
},
|
||||
|
||||
testGRAPH_CLOSENESS_INBOUND: function () {
|
||||
testCycleGRAPH_CLOSENESS_INBOUND: function () {
|
||||
var actual;
|
||||
actual = getQueryResults("RETURN arangodb::GRAPH_ABSOLUTE_CLOSENESS('werKenntWen', {}, {direction : 'inbound', algorithm : 'Floyd-Warshall'})");
|
||||
|
||||
|
@ -2333,7 +2333,7 @@ function ahuacatlQueryGeneralCyclesSuite() {
|
|||
},
|
||||
|
||||
|
||||
testGRAPH_ECCENTRICITY: function () {
|
||||
testCycleGRAPH_ECCENTRICITY: function () {
|
||||
var actual;
|
||||
|
||||
actual = getQueryResults("RETURN arangodb::GRAPH_ABSOLUTE_ECCENTRICITY('werKenntWen',{}, {algorithm : 'Floyd-Warshall'})");
|
||||
|
@ -2383,7 +2383,7 @@ function ahuacatlQueryGeneralCyclesSuite() {
|
|||
},
|
||||
|
||||
/*
|
||||
testGRAPH_BETWEENNESS: function () {
|
||||
testCycleGRAPH_BETWEENNESS: function () {
|
||||
var actual;
|
||||
|
||||
actual = getQueryResults("RETURN arangodb::GRAPH_ABSOLUTE_BETWEENNESS('werKenntWen', {algorithm : 'Floyd-Warshall'})");
|
||||
|
@ -2438,7 +2438,7 @@ function ahuacatlQueryGeneralCyclesSuite() {
|
|||
},
|
||||
*/
|
||||
|
||||
testGRAPH_DIAMETER_AND_RADIUS: function () {
|
||||
testCycleGRAPH_DIAMETER_AND_RADIUS: function () {
|
||||
var actual;
|
||||
actual = getQueryResults("RETURN arangodb::GRAPH_RADIUS('werKenntWen', {algorithm : 'Floyd-Warshall'})");
|
||||
assertEqual(actual[0], 2);
|
||||
|
|
|
@ -1435,7 +1435,7 @@ function ahuacatlQueryGeneralCyclesSuite() {
|
|||
/// @brief checks shortest path with graph name
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testShortestPathWithGraphName: function () {
|
||||
testCycleShortestPathWithGraphName: function () {
|
||||
var actual;
|
||||
var query = `
|
||||
FOR source in ${AQL_START_EVERYWHERE}
|
||||
|
|
|
@ -330,7 +330,7 @@ function namedGraphSuite () {
|
|||
cleanup();
|
||||
},
|
||||
|
||||
testFirstEntryIsVertex: function () {
|
||||
testNamedFirstEntryIsVertex: function () {
|
||||
var query = 'FOR x IN OUTBOUND @startId GRAPH @graph RETURN x';
|
||||
var bindVars = {
|
||||
graph: gn,
|
||||
|
@ -346,7 +346,7 @@ function namedGraphSuite () {
|
|||
});
|
||||
},
|
||||
|
||||
testSecondEntryIsEdge: function () {
|
||||
testNamedSecondEntryIsEdge: function () {
|
||||
var query = 'FOR x, e IN OUTBOUND @startId GRAPH @graph RETURN e';
|
||||
var bindVars = {
|
||||
graph: gn,
|
||||
|
@ -362,7 +362,7 @@ function namedGraphSuite () {
|
|||
});
|
||||
},
|
||||
|
||||
testThirdEntryIsPath: function () {
|
||||
testNamedThirdEntryIsPath: function () {
|
||||
var query = 'FOR x, e, p IN OUTBOUND @startId GRAPH @graph RETURN p';
|
||||
var bindVars = {
|
||||
graph: gn,
|
||||
|
@ -383,7 +383,7 @@ function namedGraphSuite () {
|
|||
});
|
||||
},
|
||||
|
||||
testOutboundDirection: function () {
|
||||
testNamedOutboundDirection: function () {
|
||||
var query = 'FOR x IN OUTBOUND @startId GRAPH @graph RETURN x._id';
|
||||
var bindVars = {
|
||||
graph: gn,
|
||||
|
@ -400,7 +400,7 @@ function namedGraphSuite () {
|
|||
});
|
||||
},
|
||||
|
||||
testInboundDirection: function () {
|
||||
testNamedInboundDirection: function () {
|
||||
var query = 'FOR x IN INBOUND @startId GRAPH @graph RETURN x._id';
|
||||
var bindVars = {
|
||||
graph: gn,
|
||||
|
@ -417,7 +417,7 @@ function namedGraphSuite () {
|
|||
});
|
||||
},
|
||||
|
||||
testAnyDirection: function () {
|
||||
testNamedAnyDirection: function () {
|
||||
var query = 'FOR x IN ANY @startId GRAPH @graph SORT x._id ASC RETURN x._id';
|
||||
var bindVars = {
|
||||
graph: gn,
|
||||
|
@ -438,7 +438,7 @@ function namedGraphSuite () {
|
|||
});
|
||||
},
|
||||
|
||||
testExactNumberSteps: function () {
|
||||
testNamedExactNumberSteps: function () {
|
||||
var query = 'FOR x IN 2 OUTBOUND @startId GRAPH @graph SORT x._id ASC RETURN x._id';
|
||||
var bindVars = {
|
||||
graph: gn,
|
||||
|
@ -456,7 +456,7 @@ function namedGraphSuite () {
|
|||
});
|
||||
},
|
||||
|
||||
testRangeNumberSteps: function () {
|
||||
testNamedRangeNumberSteps: function () {
|
||||
var query = 'FOR x IN 2..3 OUTBOUND @startId GRAPH @graph SORT x._id ASC RETURN x._id';
|
||||
var bindVars = {
|
||||
graph: gn,
|
||||
|
@ -475,7 +475,7 @@ function namedGraphSuite () {
|
|||
});
|
||||
},
|
||||
|
||||
testComputedNumberSteps: function () {
|
||||
testNamedComputedNumberSteps: function () {
|
||||
var query = 'FOR x IN LENGTH([1,2]) OUTBOUND @startId GRAPH @graph SORT x._id ASC RETURN x._id';
|
||||
var bindVars = {
|
||||
graph: gn,
|
||||
|
@ -492,7 +492,7 @@ function namedGraphSuite () {
|
|||
});
|
||||
},
|
||||
|
||||
testZeroSteps: function () {
|
||||
testNamedZeroSteps: function () {
|
||||
// We only include the start vertex
|
||||
var query = 'FOR x IN 0 OUTBOUND @startId GRAPH @graph SORT x._id ASC RETURN x._id';
|
||||
var bindVars = {
|
||||
|
@ -509,7 +509,7 @@ function namedGraphSuite () {
|
|||
});
|
||||
},
|
||||
|
||||
testZeroStartRangeSteps: function () {
|
||||
testNamedZeroStartRangeSteps: function () {
|
||||
// We only include the start vertex
|
||||
var query = 'FOR x IN 0..1 OUTBOUND @startId GRAPH @graph SORT x._id ASC RETURN x._id';
|
||||
var bindVars = {
|
||||
|
@ -527,7 +527,7 @@ function namedGraphSuite () {
|
|||
});
|
||||
},
|
||||
|
||||
testSort: function () {
|
||||
testNamedSort: function () {
|
||||
var query = 'FOR x IN OUTBOUND @startId GRAPH @graph SORT x._id ASC RETURN x._id';
|
||||
var bindVars = {
|
||||
graph: gn,
|
||||
|
@ -554,7 +554,7 @@ function namedGraphSuite () {
|
|||
});
|
||||
},
|
||||
|
||||
testUniqueEdgesOnPath: function () {
|
||||
testNamedUniqueEdgesOnPath: function () {
|
||||
var query = 'FOR x IN 6 OUTBOUND @startId GRAPH @graph RETURN x._id';
|
||||
var bindVars = {
|
||||
graph: gn,
|
||||
|
|
|
@ -242,7 +242,7 @@ function ahuacatlClusterJoinNonKeySuite () {
|
|||
/// @brief test subquery
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testNestedLoopsDifferentCollectionsNonKey : function () {
|
||||
testNestedLoopsDifferentCollectionsNonKeyJNKS : function () {
|
||||
var actual = AQL_EXECUTE("FOR c1 IN @@cn1 FOR c2 IN @@cn2 FILTER c1.value == c2.value RETURN c2.value", { "@cn1": cn1, "@cn2": cn2 });
|
||||
actual.json.sort(sorter);
|
||||
assertEqual([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 ], actual.json);
|
||||
|
@ -252,7 +252,7 @@ function ahuacatlClusterJoinNonKeySuite () {
|
|||
/// @brief test subquery
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testNestedLoopsDifferentCollectionsNonKeyFilter : function () {
|
||||
testNestedLoopsDifferentCollectionsNonKeyFilterJNKS : function () {
|
||||
var actual = AQL_EXECUTE("FOR c1 IN @@cn1 FILTER c1.value IN [ 1, 2, 4 ] FOR c2 IN @@cn2 FILTER c1.value == c2.value RETURN c2.value", { "@cn1": cn1, "@cn2": cn2 });
|
||||
actual.json.sort(sorter);
|
||||
assertEqual([ 1, 2, 4 ], actual.json);
|
||||
|
@ -262,7 +262,7 @@ function ahuacatlClusterJoinNonKeySuite () {
|
|||
/// @brief test subquery
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testNestedLoopsSameCollectionNonShardKey : function () {
|
||||
testNestedLoopsSameCollectionNonShardKeyJNKS : function () {
|
||||
var actual = AQL_EXECUTE("FOR c1 IN @@cn1 FILTER c1.value IN [ 1, 2, 4 ] FOR c2 IN @@cn2 FILTER c1.value == c2.value RETURN c2.value", { "@cn1": cn1, "@cn2": cn1 }); // same collection
|
||||
actual.json.sort(sorter);
|
||||
assertEqual([ 1, 2, 4 ], actual.json);
|
||||
|
@ -272,7 +272,7 @@ function ahuacatlClusterJoinNonKeySuite () {
|
|||
/// @brief test subquery
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSubqueryDifferentCollectionsNonKey : function () {
|
||||
testSubqueryDifferentCollectionsNonKeyJNKS : function () {
|
||||
var actual = AQL_EXECUTE("FOR c1 IN @@cn1 FILTER c1.value IN [ 1, 2, 4 ] LET match = (FOR c2 IN @@cn2 FILTER c1.value == c2.value RETURN c2.value) RETURN match", { "@cn1": cn1, "@cn2": cn2 });
|
||||
actual.json.sort(sorter2);
|
||||
assertEqual([ [ 1 ], [ 2 ], [ 4 ] ], actual.json);
|
||||
|
@ -282,7 +282,7 @@ function ahuacatlClusterJoinNonKeySuite () {
|
|||
/// @brief test subquery
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSubquerySameCollectionNonKey : function () {
|
||||
testSubquerySameCollectionNonKeyJNKS : function () {
|
||||
var actual = AQL_EXECUTE("FOR c1 IN @@cn1 FILTER c1.value IN [ 1, 2, 4 ] LET match = (FOR c2 IN @@cn2 FILTER c1.value == c2.value RETURN c2.value) RETURN match", { "@cn1": cn1, "@cn2": cn1 }); // same collection
|
||||
actual.json.sort(sorter2);
|
||||
assertEqual([ [ 1 ], [ 2 ], [ 4 ] ], actual.json);
|
||||
|
|
|
@ -349,7 +349,7 @@ function ahuacatlRemoveSuite () {
|
|||
/// @brief test remove
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSingle : function () {
|
||||
testSingleRemove : function () {
|
||||
var expected = { writesExecuted: 1, writesIgnored: 0 };
|
||||
var actual = getModifyQueryResults("REMOVE 'test0' IN @@cn", { "@cn": cn1 });
|
||||
|
||||
|
@ -946,7 +946,7 @@ function ahuacatlInsertSuite () {
|
|||
/// @brief test insert
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSingle : function () {
|
||||
testSingleInsert : function () {
|
||||
var expected = { writesExecuted: 1, writesIgnored: 0 };
|
||||
var actual = getModifyQueryResults("INSERT { value: 'foobar', _key: 'test' } IN @@cn", { "@cn": cn1 });
|
||||
|
||||
|
@ -1369,7 +1369,7 @@ function ahuacatlUpdateSuite () {
|
|||
/// @brief test update
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSingle : function () {
|
||||
testSingleUpdate : function () {
|
||||
var expected = { writesExecuted: 1, writesIgnored: 0 };
|
||||
var actual = getModifyQueryResults("UPDATE { value: 'foobar', _key: 'test17' } IN @@cn", { "@cn": cn1 });
|
||||
|
||||
|
|
|
@ -250,7 +250,7 @@ function ahuacatlRemoveSuite () {
|
|||
/// @brief test remove
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSingle : function () {
|
||||
testRemoveSingle : function () {
|
||||
var expected = { writesExecuted: 1, writesIgnored: 0 };
|
||||
var query = "REMOVE 'test0' IN @@cn";
|
||||
var allresults = getQueryMultiplePlansAndExecutions(query, { "@cn": cn1 }, this);
|
||||
|
@ -266,7 +266,7 @@ function ahuacatlRemoveSuite () {
|
|||
/// @brief test remove
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testTwoCollectionsJoin1 : function () {
|
||||
testRemoveTwoCollectionsJoin1 : function () {
|
||||
var expected = { writesExecuted: 50, writesIgnored: 0 };
|
||||
var query = "FOR d IN @@cn1 FILTER d.value1 < 50 REMOVE { _key: d._key } IN @@cn2";
|
||||
var allresults = getQueryMultiplePlansAndExecutions(query, { "@cn1": cn1, "@cn2": cn2 }, this);
|
||||
|
@ -283,7 +283,7 @@ function ahuacatlRemoveSuite () {
|
|||
/// @brief test remove
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testTwoCollectionsJoin2 : function () {
|
||||
testRemoveTwoCollectionsJoin2 : function () {
|
||||
var expected = { writesExecuted: 48, writesIgnored: 0 };
|
||||
var query = "FOR d IN @@cn1 FILTER d.value1 >= 2 && d.value1 < 50 REMOVE { _key: d._key } IN @@cn2";
|
||||
var allresults = getQueryMultiplePlansAndExecutions(query, { "@cn1": cn1, "@cn2": cn2 }, this);
|
||||
|
@ -300,7 +300,7 @@ function ahuacatlRemoveSuite () {
|
|||
/// @brief test remove
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testTwoCollectionsIgnoreErrors1 : function () {
|
||||
testRemoveTwoCollectionsIgnoreErrors1 : function () {
|
||||
var expected = { writesExecuted: 50, writesIgnored: 50 };
|
||||
var query = "FOR d IN @@cn1 REMOVE { _key: d._key } IN @@cn2 OPTIONS { ignoreErrors: true }";
|
||||
var allresults = getQueryMultiplePlansAndExecutions(query, { "@cn1": cn1, "@cn2": cn2 }, this);
|
||||
|
@ -317,7 +317,7 @@ function ahuacatlRemoveSuite () {
|
|||
/// @brief test remove
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testTwoCollectionsIgnoreErrors2 : function () {
|
||||
testRemoveTwoCollectionsIgnoreErrors2 : function () {
|
||||
var expected = { writesExecuted: 0, writesIgnored: 100 };
|
||||
var query = "FOR d IN @@cn1 REMOVE { _key: CONCAT('foo', d._key) } IN @@cn2 OPTIONS { ignoreErrors: true }";
|
||||
var allresults = getQueryMultiplePlansAndExecutions(query, { "@cn1": cn1, "@cn2": cn2 }, this);
|
||||
|
@ -559,7 +559,7 @@ function ahuacatlInsertSuite () {
|
|||
/// @brief test insert
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSingle : function () {
|
||||
testSingleInsert : function () {
|
||||
var expected = { writesExecuted: 1, writesIgnored: 0 };
|
||||
var query = "INSERT { value: 'foobar', _key: 'test' } IN @@cn";
|
||||
var allresults = getQueryMultiplePlansAndExecutions(query, { "@cn": cn1 }, this);
|
||||
|
@ -767,7 +767,7 @@ function ahuacatlUpdateSuite () {
|
|||
/// @brief test update
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSingle : function () {
|
||||
testSingleUpdate : function () {
|
||||
var expected = { writesExecuted: 1, writesIgnored: 0 };
|
||||
var query = "UPDATE { value: 'foobar', _key: 'test17' } IN @@cn";
|
||||
var allresults = getQueryMultiplePlansAndExecutions(query, { "@cn": cn1 });
|
||||
|
|
|
@ -1249,7 +1249,7 @@ function ahuacatlRemoveSuite () {
|
|||
/// @brief test remove
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSingleNotFound : function () {
|
||||
testSingleRemoveNotFound : function () {
|
||||
assertQueryError(errors.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code, "REMOVE 'foobar' IN @@cn", { "@cn": cn1 });
|
||||
},
|
||||
|
||||
|
@ -1257,7 +1257,7 @@ function ahuacatlRemoveSuite () {
|
|||
/// @brief test remove - return what
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSingleNotFoundWhat : function () {
|
||||
testSingleRemoveNotFoundWhat : function () {
|
||||
assertQueryError(errors.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code, "REMOVE 'foobar' IN @@cn LET removed = OLD RETURN removed", { "@cn": cn1 });
|
||||
},
|
||||
|
||||
|
@ -1977,7 +1977,7 @@ function ahuacatlInsertSuite () {
|
|||
/// @brief test insert
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSingle : function () {
|
||||
testSingleInsert : function () {
|
||||
var expected = { writesExecuted: 1, writesIgnored: 0 };
|
||||
var actual = getModifyQueryResults("INSERT { value: 'foobar', _key: 'test' } IN @@cn", { "@cn": cn1 });
|
||||
|
||||
|
@ -1990,7 +1990,7 @@ function ahuacatlInsertSuite () {
|
|||
/// @brief test insert
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSingleWhat : function () {
|
||||
testSingleInsertWhat : function () {
|
||||
var expected = { writesExecuted: 1, writesIgnored: 0 };
|
||||
var actual = getModifyQueryResultsRaw("INSERT { value: 'foobar', _key: 'test' } IN @@cn LET inserted = NEW RETURN inserted", { "@cn": cn1 });
|
||||
|
||||
|
@ -2378,7 +2378,7 @@ function ahuacatlUpdateSuite () {
|
|||
/// @brief test update
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSingleNotFound : function () {
|
||||
testSingleUpdateNotFound : function () {
|
||||
assertQueryError(errors.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code, "UPDATE { _key: 'foobar' } WITH { value1: 1 } IN @@cn", { "@cn": cn1 });
|
||||
},
|
||||
|
||||
|
@ -2386,7 +2386,7 @@ function ahuacatlUpdateSuite () {
|
|||
/// @brief test update
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSingleNotFoundWhatNew : function () {
|
||||
testSingleUpdateNotFoundWhatNew : function () {
|
||||
assertQueryError(errors.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code, "UPDATE { _key: 'foobar' } WITH { value1: 1 } IN @@cn LET updated = NEW RETURN updated", { "@cn": cn1 });
|
||||
},
|
||||
|
||||
|
@ -2394,7 +2394,7 @@ function ahuacatlUpdateSuite () {
|
|||
/// @brief test update
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSingle : function () {
|
||||
testSingleUpdate : function () {
|
||||
var expected = { writesExecuted: 1, writesIgnored: 0 };
|
||||
var actual = getModifyQueryResults("UPDATE { value: 'foobar', _key: 'test17' } IN @@cn", { "@cn": cn1 });
|
||||
|
||||
|
@ -2406,7 +2406,7 @@ function ahuacatlUpdateSuite () {
|
|||
/// @brief test update
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSingleWhatNew : function () {
|
||||
testSingleUpdateWhatNew : function () {
|
||||
var expected = { writesExecuted: 1, writesIgnored: 0 };
|
||||
var actual = getModifyQueryResultsRaw("UPDATE { value: 'foobar', _key: 'test17' } IN @@cn LET updated = NEW RETURN updated", { "@cn": cn1 });
|
||||
|
||||
|
@ -2418,7 +2418,7 @@ function ahuacatlUpdateSuite () {
|
|||
/// @brief test update
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSingleWhatOld : function () {
|
||||
testSingleUpdateWhatOld : function () {
|
||||
var expected = { writesExecuted: 1, writesIgnored: 0 };
|
||||
var actual = getModifyQueryResultsRaw("UPDATE { value: 'foobar', _key: 'test17' } IN @@cn LET old = OLD RETURN old", { "@cn": cn1 });
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ function legacyOptimizerRuleTestSuite() {
|
|||
geocol = null;
|
||||
},
|
||||
|
||||
testRuleBasics : function () {
|
||||
testLegacyRuleBasics : function () {
|
||||
if(enabled.basics){
|
||||
geocol.ensureIndex({ type: "hash", fields: [ "y", "z" ], unique: false });
|
||||
|
||||
|
@ -218,7 +218,7 @@ function legacyOptimizerRuleTestSuite() {
|
|||
}
|
||||
}, // testRuleBasics
|
||||
|
||||
testRuleRemoveNodes : function () {
|
||||
testLegacyRuleRemoveNodes : function () {
|
||||
if(enabled.removeNodes){
|
||||
var queries = [
|
||||
[ "FOR d IN " + colName + " SORT distance(d.lat,d.lon, 0 ,0 ) ASC LIMIT 5 RETURN d", false, false, false ],
|
||||
|
@ -250,7 +250,7 @@ function legacyOptimizerRuleTestSuite() {
|
|||
}
|
||||
}, // testRuleSort
|
||||
|
||||
testRuleSorted : function(){
|
||||
testLegacyRuleSorted : function(){
|
||||
if(enabled.sorted){
|
||||
var old=0;
|
||||
var query = "FOR d IN " + colName + " SORT distance(d.lat, d.lon, 0, 0) RETURN distance(d.lat, d.lon, 0, 0)";
|
||||
|
|
|
@ -134,7 +134,7 @@ function optimizerIndexOnlyEdgeTestSuite () {
|
|||
db._drop("UnitTestsCollection");
|
||||
},
|
||||
|
||||
testNoProjectionsButIndex : function () {
|
||||
testEdgeNoProjectionsButIndex : function () {
|
||||
let queries = [
|
||||
`FOR doc IN ${c.name()} FILTER doc._from == "test/123" RETURN doc`,
|
||||
`FOR doc IN ${c.name()} FILTER doc._from == "test/123" SORT doc._from RETURN doc`,
|
||||
|
@ -161,7 +161,7 @@ function optimizerIndexOnlyEdgeTestSuite () {
|
|||
});
|
||||
},
|
||||
|
||||
testNotCoveringProjection : function () {
|
||||
testEdgeNotCoveringProjection : function () {
|
||||
let queries = [
|
||||
[ `FOR doc IN ${c.name()} FILTER doc._from == "test/123" RETURN doc.b`, ["b"] ],
|
||||
[ `FOR doc IN ${c.name()} FILTER doc._from == "test/123" RETURN [ doc._from, doc.b ]`, ["_from", "b"] ],
|
||||
|
@ -192,7 +192,7 @@ function optimizerIndexOnlyEdgeTestSuite () {
|
|||
});
|
||||
},
|
||||
|
||||
testIndexFromCoveringProjection : function () {
|
||||
testEdgeIndexFromCoveringProjection : function () {
|
||||
let query = `FOR doc IN ${c.name()} FILTER doc._from == "test/123" RETURN doc._from`;
|
||||
|
||||
let plan = AQL_EXPLAIN(query).plan;
|
||||
|
@ -202,7 +202,7 @@ function optimizerIndexOnlyEdgeTestSuite () {
|
|||
assertTrue(nodes[0].indexCoversProjections);
|
||||
},
|
||||
|
||||
testIndexFromCoveringInProjection : function () {
|
||||
testEdgeIndexFromCoveringInProjection : function () {
|
||||
let query = `FOR doc IN ${c.name()} FILTER doc._from IN ["test/123", "test/124", "test/125"] RETURN doc._from`;
|
||||
|
||||
let plan = AQL_EXPLAIN(query).plan;
|
||||
|
@ -212,7 +212,7 @@ function optimizerIndexOnlyEdgeTestSuite () {
|
|||
assertTrue(nodes[0].indexCoversProjections);
|
||||
},
|
||||
|
||||
testIndexToCoveringProjection : function () {
|
||||
testEdgeIndexToCoveringProjection : function () {
|
||||
let query = `FOR doc IN ${c.name()} FILTER doc._to == "test/123" RETURN doc._to`;
|
||||
|
||||
let plan = AQL_EXPLAIN(query).plan;
|
||||
|
@ -223,7 +223,7 @@ function optimizerIndexOnlyEdgeTestSuite () {
|
|||
},
|
||||
|
||||
|
||||
testIndexToCoveringInProjection : function () {
|
||||
testEdgeIndexToCoveringInProjection : function () {
|
||||
let query = `FOR doc IN ${c.name()} FILTER doc._to IN ["test/123", "test/124", "test/125"] RETURN doc._to`;
|
||||
|
||||
let plan = AQL_EXPLAIN(query).plan;
|
||||
|
@ -293,7 +293,7 @@ function optimizerIndexOnlyVPackTestSuite () {
|
|||
});
|
||||
},
|
||||
|
||||
testNoProjectionsButIndex : function () {
|
||||
testVPackNoProjectionsButIndex : function () {
|
||||
c.ensureIndex({ type: "hash", fields: ["a"] });
|
||||
|
||||
let queries = [
|
||||
|
@ -312,7 +312,7 @@ function optimizerIndexOnlyVPackTestSuite () {
|
|||
});
|
||||
},
|
||||
|
||||
testSingleFieldIndexNotCoveringProjection : function () {
|
||||
testVPackSingleFieldIndexNotCoveringProjection : function () {
|
||||
c.ensureIndex({ type: "hash", fields: ["a"] });
|
||||
|
||||
let queries = [
|
||||
|
@ -333,7 +333,7 @@ function optimizerIndexOnlyVPackTestSuite () {
|
|||
});
|
||||
},
|
||||
|
||||
testSingleFieldIndexCoveringProjection : function () {
|
||||
testVPackSingleFieldIndexCoveringProjection : function () {
|
||||
c.ensureIndex({ type: "hash", fields: ["a"] });
|
||||
|
||||
let query = `FOR doc IN ${c.name()} FILTER doc.a >= 0 RETURN doc.a`;
|
||||
|
@ -347,7 +347,7 @@ function optimizerIndexOnlyVPackTestSuite () {
|
|||
assertTrue(nodes[0].indexCoversProjections);
|
||||
},
|
||||
|
||||
testSingleFieldIndexCoveringInProjection : function () {
|
||||
testVPackSingleFieldIndexCoveringInProjection : function () {
|
||||
c.ensureIndex({ type: "hash", fields: ["a"] });
|
||||
|
||||
let query = `FOR doc IN ${c.name()} FILTER doc.a IN [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] RETURN doc.a`;
|
||||
|
@ -361,7 +361,7 @@ function optimizerIndexOnlyVPackTestSuite () {
|
|||
assertTrue(nodes[0].indexCoversProjections);
|
||||
},
|
||||
|
||||
testSingleFieldUniqueIndexCoveringProjection : function () {
|
||||
testVPackSingleFieldUniqueIndexCoveringProjection : function () {
|
||||
c.ensureIndex({ type: "hash", fields: ["b"], unique: true });
|
||||
|
||||
let query = `FOR doc IN ${c.name()} FILTER doc.b >= 0 RETURN doc.b`;
|
||||
|
@ -375,7 +375,7 @@ function optimizerIndexOnlyVPackTestSuite () {
|
|||
assertTrue(nodes[0].indexCoversProjections);
|
||||
},
|
||||
|
||||
testMultipleFieldsIndexCoveringProjection : function () {
|
||||
testVPackMultipleFieldsIndexCoveringProjection : function () {
|
||||
c.ensureIndex({ type: "hash", fields: ["a", "b"] });
|
||||
|
||||
let queries = [
|
||||
|
@ -400,7 +400,7 @@ function optimizerIndexOnlyVPackTestSuite () {
|
|||
});
|
||||
},
|
||||
|
||||
testMultipleFieldsUniqueIndexCoveringProjection : function () {
|
||||
testVPackMultipleFieldsUniqueIndexCoveringProjection : function () {
|
||||
c.ensureIndex({ type: "hash", fields: ["a", "b"], unique: true });
|
||||
|
||||
let queries = [
|
||||
|
|
|
@ -105,7 +105,7 @@ function ahuacatlLegacyGeoTestSuite () {
|
|||
db._drop("UnitTestsAhuacatlLocationsNon");
|
||||
},
|
||||
|
||||
testNearInvalidCoordinate : function () {
|
||||
testLegacyNearInvalidCoordinate : function () {
|
||||
assertQueryError(errors.ERROR_QUERY_INVALID_GEO_VALUE.code, "RETURN NEAR(" + locations.name() + ", 1000, 1000, 10)");
|
||||
},
|
||||
|
||||
|
@ -113,7 +113,7 @@ function ahuacatlLegacyGeoTestSuite () {
|
|||
/// @brief test near function
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testNear1 : function () {
|
||||
testLegacyNear1 : function () {
|
||||
var expected = [ { "distance" : "111194.92664", "latitude" : -1, "longitude" : 0 }, { "distance" : "111194.92664", "latitude" : 0, "longitude" : -1 }, { "distance" : "111194.92664", "latitude" : 0, "longitude" : 1 }, { "distance" : "111194.92664", "latitude" : 1, "longitude" : 0 }, { "distance" : 0, "latitude" : 0, "longitude" : 0 } ];
|
||||
var actual = runQuery("FOR x IN NEAR(" + locations.name() + ", 0, 0, 5, \"distance\") SORT x.distance DESC, x.latitude, x.longitude RETURN x");
|
||||
assertEqual(expected, actual);
|
||||
|
@ -123,7 +123,7 @@ function ahuacatlLegacyGeoTestSuite () {
|
|||
/// @brief test near function
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testNear2 : function () {
|
||||
testLegacyNear2 : function () {
|
||||
var expected = [ { "latitude" : -10, "longitude" : 24 }, { "latitude" : -10, "longitude" : 25 }, { "latitude" : -10, "longitude" : 26 } ];
|
||||
var actual = runQuery("FOR x IN NEAR(" + locations.name() + ", -10, 25, 3) SORT x.latitude, x.longitude RETURN x");
|
||||
assertEqual(expected, actual);
|
||||
|
@ -133,7 +133,7 @@ function ahuacatlLegacyGeoTestSuite () {
|
|||
/// @brief test near function
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testNear3 : function () {
|
||||
testLegacyNear3 : function () {
|
||||
var expected = [ { "distance" : "14891044.54146", "latitude" : 40, "longitude" : -40 },
|
||||
{ "distance" : "14853029.30724", "latitude" : 40, "longitude" : -39 },
|
||||
{ "distance" : "14815001.47646", "latitude" : 40, "longitude" : -38 } ];
|
||||
|
@ -164,7 +164,7 @@ function ahuacatlLegacyGeoTestSuite () {
|
|||
/// @brief test near function
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testNear4 : function () {
|
||||
testLegacyNear4 : function () {
|
||||
var expected = [ {"latitude" : -40, "longitude" : 40 }, { "latitude" : -40, "longitude" : 39 }, { "latitude" : -40, "longitude" : 38 } ];
|
||||
var actual = runQuery("FOR x IN NEAR(" + locations.name() + ", -70, 70, null) SORT x.latitude, x.longitude DESC LIMIT 3 RETURN x");
|
||||
assertEqual(expected, actual);
|
||||
|
@ -174,7 +174,7 @@ function ahuacatlLegacyGeoTestSuite () {
|
|||
assertEqual(expected, actual);
|
||||
},
|
||||
|
||||
testWithinInvalidCoordinate : function () {
|
||||
testLegacyWithinInvalidCoordinate : function () {
|
||||
assertQueryError(errors.ERROR_QUERY_INVALID_GEO_VALUE.code, "RETURN WITHIN(" + locations.name() + ", 1000, 1000, 100000)");
|
||||
},
|
||||
|
||||
|
@ -182,7 +182,7 @@ function ahuacatlLegacyGeoTestSuite () {
|
|||
/// @brief test within function
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testWithin1 : function () {
|
||||
testLegacyWithin1 : function () {
|
||||
var expected = [ { "distance" : 0, "latitude" : 0, "longitude" : 0 } ];
|
||||
var actual = runQuery("FOR x IN WITHIN(" + locations.name() + ", 0, 0, 10000, \"distance\") SORT x.latitude, x.longitude RETURN x");
|
||||
assertEqual(expected, actual);
|
||||
|
@ -192,7 +192,7 @@ function ahuacatlLegacyGeoTestSuite () {
|
|||
/// @brief test within function
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testWithin2 : function () {
|
||||
testLegacyWithin2 : function () {
|
||||
var expected = [ { "distance" : "111194.92664", "latitude" : -1, "longitude" : 0 }, { "distance" : "111194.92664", "latitude" : 0, "longitude" : -1 }, { "distance" : 0, "latitude" : 0, "longitude" : 0 }, { "distance" : "111194.92664", "latitude" : 0, "longitude" : 1 }, { "distance" : "111194.92664", "latitude" : 1, "longitude" : 0 } ];
|
||||
var actual = runQuery("FOR x IN WITHIN(" + locations.name() + ", 0, 0, 150000, \"distance\") SORT x.latitude, x.longitude RETURN x");
|
||||
assertEqual(expected, actual);
|
||||
|
@ -202,7 +202,7 @@ function ahuacatlLegacyGeoTestSuite () {
|
|||
/// @brief test within function
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testWithin3 : function () {
|
||||
testLegacyWithin3 : function () {
|
||||
var expected = [ { "latitude" : -10, "longitude" : 25 } ];
|
||||
var actual = runQuery("FOR x IN WITHIN(" + locations.name() + ", -10, 25, 10000) SORT x.latitude, x.longitude RETURN x");
|
||||
assertEqual(expected, actual);
|
||||
|
@ -212,7 +212,7 @@ function ahuacatlLegacyGeoTestSuite () {
|
|||
/// @brief test within function
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testWithin4 : function () {
|
||||
testLegacyWithin4 : function () {
|
||||
var expected = [
|
||||
{ "latitude" : -11, "longitude" : 25 },
|
||||
{ "latitude" : -10, "longitude" : 24 },
|
||||
|
@ -229,7 +229,7 @@ function ahuacatlLegacyGeoTestSuite () {
|
|||
/// @brief test within function
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testWithin5 : function () {
|
||||
testLegacyWithin5 : function () {
|
||||
var expected = [ ];
|
||||
var actual = runQuery("FOR x IN WITHIN(" + locations.name() + ", -90, 90, 10000) SORT x.latitude, x.longitude RETURN x");
|
||||
assertEqual(expected, actual);
|
||||
|
@ -239,7 +239,7 @@ function ahuacatlLegacyGeoTestSuite () {
|
|||
/// @brief test without geo index available
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testNonIndexed : function () {
|
||||
testLegacyNonIndexed : function () {
|
||||
assertQueryError(errors.ERROR_QUERY_GEO_INDEX_MISSING.code, "RETURN NEAR(" + locationsNon.name() + ", 0, 0, 10)");
|
||||
assertQueryError(errors.ERROR_QUERY_GEO_INDEX_MISSING.code, "RETURN WITHIN(" + locationsNon.name() + ", 0, 0, 10)");
|
||||
},
|
||||
|
@ -248,7 +248,7 @@ function ahuacatlLegacyGeoTestSuite () {
|
|||
/// @brief test invalid NEAR arguments count
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testInvalidNearArgument : function () {
|
||||
testLegacyInvalidNearArgument : function () {
|
||||
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH.code, "RETURN NEAR(\"" + locations.name() + "\", 0, 0, \"foo\")");
|
||||
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH.code, "RETURN NEAR(\"" + locations.name() + "\", 0, 0, true)");
|
||||
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH.code, "RETURN NEAR(\"" + locations.name() + "\", 0, 0, 10, true)");
|
||||
|
@ -258,7 +258,7 @@ function ahuacatlLegacyGeoTestSuite () {
|
|||
/// @brief test invalid WITHIN arguments count
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testInvalidWithinArgument : function () {
|
||||
testLegacyInvalidWithinArgument : function () {
|
||||
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH.code, "RETURN WITHIN(\"" + locations.name() + "\", 0, 0, \"foo\")");
|
||||
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH.code, "RETURN WITHIN(\"" + locations.name() + "\", 0, 0, true)");
|
||||
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH.code, "RETURN WITHIN(\"" + locations.name() + "\", 0, 0, 0, true)");
|
||||
|
@ -269,7 +269,7 @@ function ahuacatlLegacyGeoTestSuite () {
|
|||
/// @brief test invalid collection parameter
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testInvalidCollectionArgument : function () {
|
||||
testLegacyInvalidCollectionArgument : function () {
|
||||
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH.code, "RETURN WITHIN(1234, 0, 0, 10)");
|
||||
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH.code, "RETURN WITHIN(false, 0, 0, 10)");
|
||||
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH.code, "RETURN WITHIN(true, 0, 0, 10)");
|
||||
|
@ -1015,7 +1015,7 @@ function geoJsonTestSuite() {
|
|||
/// @brief test simple circle on sphere
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testContainsCircle1: function () {
|
||||
testJsonContainsCircle1: function () {
|
||||
runQuery({
|
||||
string: "FOR x IN @@cc FILTER GEO_DISTANCE(GEO_POINT(102, 0), x.geometry) <= 450000 RETURN x._key",
|
||||
bindVars: {
|
||||
|
@ -1029,7 +1029,7 @@ function geoJsonTestSuite() {
|
|||
/// @brief test simple circle on sphere (without circle edge included)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testContainsCircle2: function () {
|
||||
testJsonContainsCircle2: function () {
|
||||
runQuery({
|
||||
string: "FOR x IN @@cc FILTER GEO_DISTANCE(GEO_POINT(101, 0), x.geometry) < 283439.318405 RETURN x._key",
|
||||
bindVars: {
|
||||
|
@ -1043,7 +1043,7 @@ function geoJsonTestSuite() {
|
|||
/// @brief test simple circle on sphere
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testContainsCircle3: function () {
|
||||
testJsonContainsCircle3: function () {
|
||||
runQuery({
|
||||
string: "FOR x IN @@cc FILTER GEO_DISTANCE(GEO_POINT(101, 0), x.geometry) <= 100000 RETURN x._key",
|
||||
bindVars: {
|
||||
|
@ -1057,7 +1057,7 @@ function geoJsonTestSuite() {
|
|||
/// @brief test simple circle on sphere
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testContainsCircle4: function () {
|
||||
testJsonContainsCircle4: function () {
|
||||
runQuery({
|
||||
string: "FOR x IN @@cc FILTER GEO_DISTANCE(GEO_POINT(101, 0), x.geometry) <= 100000 RETURN x._key",
|
||||
bindVars: {
|
||||
|
@ -1071,7 +1071,7 @@ function geoJsonTestSuite() {
|
|||
/// @brief test polygon contains
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testContainsPolygon1: function () {
|
||||
testJsonContainsPolygon1: function () {
|
||||
runQuery({
|
||||
string: "FOR x IN @@cc FILTER GEO_CONTAINS(GEO_POLYGON(@poly), x.geometry) RETURN x._key",
|
||||
bindVars: {
|
||||
|
@ -1086,7 +1086,7 @@ function geoJsonTestSuite() {
|
|||
/// @brief test polygon contains
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testContainsPolygon2: function () {
|
||||
testJsonContainsPolygon2: function () {
|
||||
runQuery({
|
||||
string: `LET poly = GEO_POLYGON(@coords)
|
||||
FOR x IN @@cc
|
||||
|
@ -1104,7 +1104,7 @@ function geoJsonTestSuite() {
|
|||
/// @brief test polygon intersection
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testIntersectsPolygon1: function () {
|
||||
testJsonIntersectsPolygon1: function () {
|
||||
runQuery({
|
||||
string: "FOR x IN @@cc FILTER GEO_INTERSECTS(GEO_POLYGON(@poly), x.geometry) RETURN x._key",
|
||||
bindVars: {
|
||||
|
@ -1119,7 +1119,7 @@ function geoJsonTestSuite() {
|
|||
/// @brief test polygon intersection
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testIntersectsPolygon2: function () {
|
||||
testJsonIntersectsPolygon2: function () {
|
||||
runQuery({
|
||||
string: "FOR x IN @@cc FILTER GEO_INTERSECTS(GEO_POLYGON(@poly), x.geometry) RETURN x._key",
|
||||
bindVars: {
|
||||
|
@ -1134,7 +1134,7 @@ function geoJsonTestSuite() {
|
|||
/// @brief test polygon intersection
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testIntersectsPolygon3: function () {
|
||||
testJsonIntersectsPolygon3: function () {
|
||||
runQuery({
|
||||
string: "FOR x IN @@cc FILTER GEO_INTERSECTS(GEO_POLYGON(@poly), x.geometry) RETURN x._key",
|
||||
bindVars: {
|
||||
|
@ -1149,7 +1149,7 @@ function geoJsonTestSuite() {
|
|||
/// @brief test polygon intersection using a reference
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testIntersectsPolygon4: function () {
|
||||
testJsonIntersectsPolygon4: function () {
|
||||
runQuery({
|
||||
string: `LET poly = GEO_POLYGON(@coords)
|
||||
FOR x IN @@cc
|
||||
|
|
|
@ -1141,7 +1141,7 @@ function ahuacatlQueryCacheViewTestSuite () {
|
|||
assertEqual(1, result2.json.length);
|
||||
},
|
||||
|
||||
testInvalidationAfterAqlInsertNoSync : function () {
|
||||
testViewInvalidationAfterAqlInsertNoSync : function () {
|
||||
if (!internal.debugCanUseFailAt()) {
|
||||
return;
|
||||
}
|
||||
|
@ -1199,7 +1199,7 @@ function ahuacatlQueryCacheViewTestSuite () {
|
|||
assertEqual([ 1, 2, 3, 4, 5, 9 ], result.json);
|
||||
},
|
||||
|
||||
testInvalidationAfterAqlInsert : function () {
|
||||
testViewInvalidationAfterAqlInsert : function () {
|
||||
let meta = { links: { "UnitTestsAhuacatlQueryCache1" : { includeAllFields: true } } };
|
||||
v.properties(meta);
|
||||
|
||||
|
@ -1230,7 +1230,7 @@ function ahuacatlQueryCacheViewTestSuite () {
|
|||
assertEqual([ 1, 2, 3, 4, 5, 9 ], result.json);
|
||||
},
|
||||
|
||||
testInvalidationAfterAqlUpdate : function () {
|
||||
testViewInvalidationAfterAqlUpdate : function () {
|
||||
let meta = { links: { "UnitTestsAhuacatlQueryCache1" : { includeAllFields: true } } };
|
||||
v.properties(meta);
|
||||
|
||||
|
@ -1261,7 +1261,7 @@ function ahuacatlQueryCacheViewTestSuite () {
|
|||
assertEqual([ 1, 2, 3, 4, 9 ], result.json);
|
||||
},
|
||||
|
||||
testInvalidationAfterAqlRemove : function () {
|
||||
testViewInvalidationAfterAqlRemove : function () {
|
||||
let meta = { links: { "UnitTestsAhuacatlQueryCache1" : { includeAllFields: true } } };
|
||||
v.properties(meta);
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ function ahuacatlTernaryCollectionTestSuite () {
|
|||
db._drop(cn);
|
||||
},
|
||||
|
||||
testTernarySimple : function () {
|
||||
testCollTernarySimple : function () {
|
||||
// this mainly tests if stringification of the ternary works...
|
||||
var query = "FOR i IN 1..10 LET v = i == 333 ? 2 : 3 FOR j IN " + cn + " FILTER j._id == v RETURN 1";
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ function ahuacatlClusterUpsertNonKeySuite () {
|
|||
/// @brief test upsert
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testUpsertOnlyUpdate : function () {
|
||||
testUpsertOnlyUpdateNonKey : function () {
|
||||
var actual = AQL_EXECUTE("FOR i IN 0..9 UPSERT { value : i } INSERT { new: true, value2: i, value: i } UPDATE { value2: i, new: false } IN @@cn1 RETURN { old: OLD, new: NEW }", { "@cn1": cn1 });
|
||||
|
||||
actual.json.sort(sorter);
|
||||
|
@ -207,7 +207,7 @@ function ahuacatlClusterUpsertNonKeySuite () {
|
|||
/// @brief test upsert
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testUpsertOnlyInsert : function () {
|
||||
testUpsertOnlyInsertNonKey : function () {
|
||||
var actual = AQL_EXECUTE("FOR i IN 50..59 UPSERT { value: i } INSERT { new: true, value2: i, value: i } UPDATE { value2: i, new: false } IN @@cn1 RETURN { old: OLD, new: NEW }", { "@cn1": cn1 });
|
||||
actual.json.sort(sorter);
|
||||
|
||||
|
@ -226,7 +226,7 @@ function ahuacatlClusterUpsertNonKeySuite () {
|
|||
/// @brief test upsert
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testUpsertMixed : function () {
|
||||
testUpsertMixedNonKey : function () {
|
||||
var actual = AQL_EXECUTE("FOR i IN 0..39 UPSERT { value: i } INSERT { new: true, value2: i, value: i } UPDATE { value2: i, new: false } IN @@cn1 RETURN { old: OLD, new: NEW }", { "@cn1": cn1 });
|
||||
actual.json.sort(sorter);
|
||||
|
||||
|
@ -253,7 +253,7 @@ function ahuacatlClusterUpsertNonKeySuite () {
|
|||
/// @brief test upsert
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testUpsertInsertWithKey : function () {
|
||||
testUpsertInsertWithKeyNonKey : function () {
|
||||
assertQueryError(errors.ERROR_CLUSTER_MUST_NOT_SPECIFY_KEY.code, "FOR i IN 20..29 UPSERT { value: i } INSERT { _key: CONCAT('test', i) } UPDATE { } IN @@cn1 RETURN { old: OLD, new: NEW }", { "@cn1": cn1 });
|
||||
},
|
||||
|
||||
|
@ -261,7 +261,7 @@ function ahuacatlClusterUpsertNonKeySuite () {
|
|||
/// @brief test upsert
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testUpsertShardKeyChange : function () {
|
||||
testUpsertShardKeyChangeNonKey : function () {
|
||||
assertQueryError(errors.ERROR_CLUSTER_MUST_NOT_CHANGE_SHARDING_ATTRIBUTES.code, "FOR i IN 0..19 UPSERT { value: i } INSERT { } UPDATE { value: OLD.value + 1 } IN @@cn1 RETURN { old: OLD, new: NEW }", { "@cn1": cn1 });
|
||||
}
|
||||
|
||||
|
|
|
@ -529,7 +529,7 @@ function dumpTestEnterpriseSuite () {
|
|||
assertEqual(100, c.count());
|
||||
},
|
||||
|
||||
testEdges : function () {
|
||||
testEEEdges : function () {
|
||||
let c = db._collection(edges);
|
||||
let p = c.properties();
|
||||
assertEqual(3, c.type()); // Edges
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,68 +1,68 @@
|
|||
/*jshint globalstrict:false, strict:false, unused: false */
|
||||
/*global fail, assertEqual, assertTrue, assertFalse, assertNull, assertNotNull, arango, ARGUMENTS */
|
||||
/* jshint globalstrict:false, strict:false, unused: false */
|
||||
/* global assertEqual, assertTrue, assertFalse, arango, ARGUMENTS */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test the replication
|
||||
///
|
||||
/// @file
|
||||
///
|
||||
/// DISCLAIMER
|
||||
///
|
||||
/// Copyright 2010-2012 triagens GmbH, Cologne, Germany
|
||||
///
|
||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
/// you may not use this file except in compliance with the License.
|
||||
/// You may obtain a copy of the License at
|
||||
///
|
||||
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||
///
|
||||
/// Unless required by applicable law or agreed to in writing, software
|
||||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
/// See the License for the specific language governing permissions and
|
||||
/// limitations under the License.
|
||||
///
|
||||
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
||||
///
|
||||
/// @author Jan Steemann
|
||||
/// @author Copyright 2013, triAGENS GmbH, Cologne, Germany
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief test the replication
|
||||
// /
|
||||
// / @file
|
||||
// /
|
||||
// / DISCLAIMER
|
||||
// /
|
||||
// / Copyright 2010-2012 triagens GmbH, Cologne, Germany
|
||||
// /
|
||||
// / Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// / you may not use this file except in compliance with the License.
|
||||
// / You may obtain a copy of the License at
|
||||
// /
|
||||
// / http://www.apache.org/licenses/LICENSE-2.0
|
||||
// /
|
||||
// / Unless required by applicable law or agreed to in writing, software
|
||||
// / distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// / WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// / See the License for the specific language governing permissions and
|
||||
// / limitations under the License.
|
||||
// /
|
||||
// / Copyright holder is triAGENS GmbH, Cologne, Germany
|
||||
// /
|
||||
// / @author Jan Steemann
|
||||
// / @author Copyright 2013, triAGENS GmbH, Cologne, Germany
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var jsunity = require("jsunity");
|
||||
var arangodb = require("@arangodb");
|
||||
var errors = arangodb.errors;
|
||||
var jsunity = require('jsunity');
|
||||
var arangodb = require('@arangodb');
|
||||
var db = arangodb.db;
|
||||
|
||||
var replication = require("@arangodb/replication");
|
||||
var replication = require('@arangodb/replication');
|
||||
var deriveTestSuite = require('@arangodb/test-helper').deriveTestSuite;
|
||||
let compareTicks = replication.compareTicks;
|
||||
var console = require("console");
|
||||
var internal = require("internal");
|
||||
var console = require('console');
|
||||
var internal = require('internal');
|
||||
var masterEndpoint = arango.getEndpoint();
|
||||
var slaveEndpoint = ARGUMENTS[0];
|
||||
|
||||
var cn = "UnitTestsReplication";
|
||||
var cn2 = "UnitTestsReplication2";
|
||||
|
||||
var connectToMaster = function() {
|
||||
arango.reconnect(masterEndpoint, db._name(), "root", "");
|
||||
var cn = 'UnitTestsReplication';
|
||||
var cn2 = 'UnitTestsReplication2';
|
||||
|
||||
var connectToMaster = function () {
|
||||
arango.reconnect(masterEndpoint, db._name(), 'root', '');
|
||||
db._flushCache();
|
||||
};
|
||||
|
||||
var connectToSlave = function() {
|
||||
arango.reconnect(slaveEndpoint, db._name(), "root", "");
|
||||
var connectToSlave = function () {
|
||||
arango.reconnect(slaveEndpoint, db._name(), 'root', '');
|
||||
db._flushCache();
|
||||
};
|
||||
|
||||
var collectionChecksum = function(name) {
|
||||
var collectionChecksum = function (name) {
|
||||
var c = db._collection(name).checksum(true, true);
|
||||
return c.checksum;
|
||||
};
|
||||
|
||||
var collectionCount = function(name) {
|
||||
var collectionCount = function (name) {
|
||||
return db._collection(name).count();
|
||||
};
|
||||
|
||||
var compare = function(masterFunc, masterFunc2, slaveFuncOngoing, slaveFuncFinal, applierConfiguration) {
|
||||
var compare = function (masterFunc, masterFunc2, slaveFuncOngoing, slaveFuncFinal, applierConfiguration) {
|
||||
var state = {};
|
||||
|
||||
db._flushCache();
|
||||
|
@ -77,31 +77,31 @@ var compare = function(masterFunc, masterFunc2, slaveFuncOngoing, slaveFuncFinal
|
|||
}
|
||||
|
||||
var includeSystem = true;
|
||||
var restrictType = "";
|
||||
var restrictType = '';
|
||||
var restrictCollections = [];
|
||||
applierConfiguration = applierConfiguration || { };
|
||||
|
||||
if (typeof applierConfiguration === 'object') {
|
||||
if (applierConfiguration.hasOwnProperty("includeSystem")) {
|
||||
if (applierConfiguration.hasOwnProperty('includeSystem')) {
|
||||
includeSystem = applierConfiguration.includeSystem;
|
||||
}
|
||||
if (applierConfiguration.hasOwnProperty("restrictType")) {
|
||||
if (applierConfiguration.hasOwnProperty('restrictType')) {
|
||||
restrictType = applierConfiguration.restrictType;
|
||||
}
|
||||
if (applierConfiguration.hasOwnProperty("restrictCollections")) {
|
||||
if (applierConfiguration.hasOwnProperty('restrictCollections')) {
|
||||
restrictCollections = applierConfiguration.restrictCollections;
|
||||
}
|
||||
}
|
||||
|
||||
var keepBarrier = false;
|
||||
if (applierConfiguration.hasOwnProperty("keepBarrier")) {
|
||||
if (applierConfiguration.hasOwnProperty('keepBarrier')) {
|
||||
keepBarrier = applierConfiguration.keepBarrier;
|
||||
}
|
||||
|
||||
var syncResult = replication.sync({
|
||||
endpoint: masterEndpoint,
|
||||
username: "root",
|
||||
password: "",
|
||||
username: 'root',
|
||||
password: '',
|
||||
verbose: true,
|
||||
includeSystem,
|
||||
restrictType,
|
||||
|
@ -119,9 +119,9 @@ var compare = function(masterFunc, masterFunc2, slaveFuncOngoing, slaveFuncFinal
|
|||
|
||||
applierConfiguration = applierConfiguration || {};
|
||||
applierConfiguration.endpoint = masterEndpoint;
|
||||
applierConfiguration.username = "root";
|
||||
applierConfiguration.password = "";
|
||||
applierConfiguration.force32mode = true;
|
||||
applierConfiguration.username = 'root';
|
||||
applierConfiguration.password = '';
|
||||
applierConfiguration.force32mode = true;
|
||||
|
||||
if (!applierConfiguration.hasOwnProperty('chunkSize')) {
|
||||
applierConfiguration.chunkSize = 16384;
|
||||
|
@ -132,8 +132,7 @@ var compare = function(masterFunc, masterFunc2, slaveFuncOngoing, slaveFuncFinal
|
|||
replication.applier.properties(applierConfiguration);
|
||||
if (keepBarrier) {
|
||||
replication.applier.start(syncResult.lastLogTick, syncResult.barrierId);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
replication.applier.start(syncResult.lastLogTick);
|
||||
}
|
||||
|
||||
|
@ -141,8 +140,8 @@ var compare = function(masterFunc, masterFunc2, slaveFuncOngoing, slaveFuncFinal
|
|||
|
||||
while (true) {
|
||||
var r = slaveFuncOngoing(state);
|
||||
if (r === "wait") {
|
||||
// special return code that tells us to hang on
|
||||
if (r === 'wait') {
|
||||
// special return code that tells us to hang on
|
||||
internal.wait(0.5, false);
|
||||
continue;
|
||||
}
|
||||
|
@ -153,23 +152,26 @@ var compare = function(masterFunc, masterFunc2, slaveFuncOngoing, slaveFuncFinal
|
|||
var slaveState = replication.applier.state();
|
||||
|
||||
if (slaveState.state.lastError.errorNum > 0) {
|
||||
console.topic("replication=error", "slave has errored:", JSON.stringify(slaveState.state.lastError));
|
||||
console.topic('replication=error', 'slave has errored:', JSON.stringify(slaveState.state.lastError));
|
||||
break;
|
||||
}
|
||||
|
||||
if (!slaveState.state.running) {
|
||||
console.topic("replication=error", "slave is not running");
|
||||
console.topic('replication=error', 'slave is not running');
|
||||
break;
|
||||
}
|
||||
|
||||
if (compareTicks(slaveState.state.lastAppliedContinuousTick, state.lastLogTick) >= 0 ||
|
||||
compareTicks(slaveState.state.lastProcessedContinuousTick, state.lastLogTick) >= 0) { // ||
|
||||
console.topic("replication=debug", "slave has caught up. syncResult.lastLogTick:", state.lastLogTick, "slaveState.lastAppliedContinuousTick:", slaveState.state.lastAppliedContinuousTick, "slaveState.lastProcessedContinuousTick:", slaveState.state.lastProcessedContinuousTick);
|
||||
compareTicks(slaveState.state.lastProcessedContinuousTick, state.lastLogTick) >= 0) {
|
||||
console.topic('replication=debug',
|
||||
'slave has caught up. syncResult.lastLogTick:', state.lastLogTick,
|
||||
'slaveState.lastAppliedContinuousTick:', slaveState.state.lastAppliedContinuousTick,
|
||||
'slaveState.lastProcessedContinuousTick:', slaveState.state.lastProcessedContinuousTick);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!printed) {
|
||||
console.topic("replication=debug", "waiting for slave to catch up");
|
||||
console.topic('replication=debug', 'waiting for slave to catch up');
|
||||
printed = true;
|
||||
}
|
||||
internal.wait(0.5, false);
|
||||
|
@ -179,7 +181,7 @@ var compare = function(masterFunc, masterFunc2, slaveFuncOngoing, slaveFuncFinal
|
|||
slaveFuncFinal(state);
|
||||
};
|
||||
|
||||
var stopApplier = function(dbName) {
|
||||
var stopApplier = function (dbName) {
|
||||
connectToSlave();
|
||||
try {
|
||||
db._useDatabase(dbName);
|
||||
|
@ -190,35 +192,35 @@ var stopApplier = function(dbName) {
|
|||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Basic test definition
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief Basic test definition
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function BaseTestConfig() {
|
||||
function BaseTestConfig () {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test require from present
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief test require from present
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testRequireFromPresentFalse: function() {
|
||||
testRequireFromPresentFalse: function () {
|
||||
connectToMaster();
|
||||
|
||||
compare(
|
||||
function(state) {
|
||||
function (state) {
|
||||
db._create(cn);
|
||||
},
|
||||
|
||||
function(state) {
|
||||
// flush the wal logs on the master so the start tick is not available
|
||||
// anymore when we start replicating
|
||||
function (state) {
|
||||
// flush the wal logs on the master so the start tick is not available
|
||||
// anymore when we start replicating
|
||||
for (var i = 0; i < 30; ++i) {
|
||||
db._collection(cn).save({
|
||||
value: i
|
||||
});
|
||||
internal.wal.flush(); //true, true);
|
||||
internal.wal.flush();
|
||||
}
|
||||
db._collection(cn).save({
|
||||
value: i
|
||||
|
@ -227,19 +229,19 @@ function BaseTestConfig() {
|
|||
internal.wait(6, false);
|
||||
},
|
||||
|
||||
function(state) {
|
||||
function (state) {
|
||||
return true;
|
||||
},
|
||||
|
||||
function(state) {
|
||||
if (db._engine().name === "rocksdb") {
|
||||
// rocksdb keeps wal longer
|
||||
function (state) {
|
||||
if (db._engine().name === 'rocksdb') {
|
||||
// rocksdb keeps wal longer
|
||||
let cc = db._collection(cn).count();
|
||||
assertEqual(cc, 31, "rocksdb must keep wal, documents not there");
|
||||
assertEqual(cc, 31, 'rocksdb must keep wal, documents not there');
|
||||
} else {
|
||||
// data loss on slave!
|
||||
// data loss on slave!
|
||||
let cc = db._collection(cn).count();
|
||||
assertTrue(cc < 25, "Expected less than " + cc);
|
||||
assertTrue(cc < 25, 'Expected less than ' + cc);
|
||||
}
|
||||
}, {
|
||||
requireFromPresent: false,
|
||||
|
@ -247,12 +249,12 @@ function BaseTestConfig() {
|
|||
}
|
||||
);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test require from present
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testRequireFromPresentTrue : function () {
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief test require from present
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testRequireFromPresentTrue: function () {
|
||||
connectToMaster();
|
||||
|
||||
compare(
|
||||
|
@ -261,11 +263,13 @@ function BaseTestConfig() {
|
|||
},
|
||||
|
||||
function (state) {
|
||||
// flush the wal logs on the master so the start tick is not available
|
||||
// anymore when we start replicating
|
||||
// flush the wal logs on the master so the start tick is not available
|
||||
// anymore when we start replicating
|
||||
for (var i = 0; i < 30; ++i) {
|
||||
db._collection(cn).save({ value: i });
|
||||
internal.wal.flush(); //true, true);
|
||||
db._collection(cn).save({
|
||||
value: i
|
||||
});
|
||||
internal.wal.flush();
|
||||
}
|
||||
internal.wal.flush(true, true);
|
||||
internal.wait(6, false);
|
||||
|
@ -276,10 +280,10 @@ function BaseTestConfig() {
|
|||
},
|
||||
|
||||
function (state) {
|
||||
// wait for slave applier to have started and run
|
||||
// wait for slave applier to have started and run
|
||||
internal.wait(5, false);
|
||||
|
||||
// slave should not have stopped
|
||||
// slave should not have stopped
|
||||
assertTrue(replication.applier.state().state.running);
|
||||
return true;
|
||||
},
|
||||
|
@ -295,11 +299,11 @@ function BaseTestConfig() {
|
|||
);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test require from present, no barrier
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief test require from present, no barrier
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testRequireFromPresentTrueNoBarrier : function () {
|
||||
testRequireFromPresentTrueNoBarrier: function () {
|
||||
connectToMaster();
|
||||
|
||||
compare(
|
||||
|
@ -308,30 +312,32 @@ function BaseTestConfig() {
|
|||
},
|
||||
|
||||
function (state) {
|
||||
// flush the wal logs on the master so the start tick is not available
|
||||
// anymore when we start replicating
|
||||
// flush the wal logs on the master so the start tick is not available
|
||||
// anymore when we start replicating
|
||||
for (var i = 0; i < 30; ++i) {
|
||||
db._collection(cn).save({ value: i });
|
||||
internal.wal.flush(); //true, true);
|
||||
db._collection(cn).save({
|
||||
value: i
|
||||
});
|
||||
internal.wal.flush();
|
||||
}
|
||||
internal.wal.flush(true, true);
|
||||
internal.wait(6, false);
|
||||
},
|
||||
|
||||
function (state) {
|
||||
// wait for slave applier to have started and detect the mess
|
||||
// wait for slave applier to have started and detect the mess
|
||||
return replication.applier.state().state.running;
|
||||
},
|
||||
|
||||
function (state) {
|
||||
if (db._engine().name === "rocksdb") {
|
||||
// rocksdb keeps wal longer
|
||||
assertTrue(replication.applier.state().state.running, "Applier should be running");
|
||||
assertEqual(db._collection(cn).count(), 30, "rocksdb must keep wal");
|
||||
if (db._engine().name === 'rocksdb') {
|
||||
// rocksdb keeps wal longer
|
||||
assertTrue(replication.applier.state().state.running, 'Applier should be running');
|
||||
assertEqual(db._collection(cn).count(), 30, 'rocksdb must keep wal');
|
||||
} else {
|
||||
// slave should have failed
|
||||
// slave should have failed
|
||||
assertFalse(replication.applier.state().state.running);
|
||||
// data loss on slave!
|
||||
// data loss on slave!
|
||||
assertTrue(db._collection(cn).count() < 25);
|
||||
}
|
||||
},
|
||||
|
@ -345,109 +351,111 @@ function BaseTestConfig() {
|
|||
};
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Test suite for _system database
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief Test suite for _system database
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function ReplicationSuite() {
|
||||
function ReplicationSuite () {
|
||||
let suite = {
|
||||
|
||||
let suite = BaseTestConfig();
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief set up
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief set up
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
setUp: function () {
|
||||
stopApplier('_system');
|
||||
|
||||
suite.setUp = function() {
|
||||
stopApplier("_system");
|
||||
connectToMaster();
|
||||
|
||||
connectToMaster();
|
||||
db._drop(cn);
|
||||
db._drop(cn2);
|
||||
},
|
||||
|
||||
db._drop(cn);
|
||||
db._drop(cn2);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief tear down
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
suite.tearDown = function() {
|
||||
stopApplier("_system");
|
||||
|
||||
connectToMaster();
|
||||
db._drop(cn);
|
||||
db._drop(cn2);
|
||||
|
||||
connectToSlave();
|
||||
db._drop(cn);
|
||||
db._drop(cn2);
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief tear down
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
tearDown: function () {
|
||||
stopApplier('_system');
|
||||
|
||||
connectToMaster();
|
||||
db._drop(cn);
|
||||
db._drop(cn2);
|
||||
|
||||
connectToSlave();
|
||||
db._drop(cn);
|
||||
db._drop(cn2);
|
||||
}
|
||||
};
|
||||
deriveTestSuite(BaseTestConfig(), suite, '_Repl');
|
||||
|
||||
return suite;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Test suite for other database
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief Test suite for other database
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function ReplicationOtherDBSuite() {
|
||||
const dbName = "UnitTestDB";
|
||||
function ReplicationOtherDBSuite () {
|
||||
const dbName = 'UnitTestDB';
|
||||
|
||||
let suite = BaseTestConfig();
|
||||
let suite = {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief set up
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief set up
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
suite.setUp = function() {
|
||||
stopApplier(dbName);
|
||||
setUp: function () {
|
||||
stopApplier(dbName);
|
||||
|
||||
db._useDatabase("_system");
|
||||
connectToSlave();
|
||||
try {
|
||||
db._dropDatabase(dbName);
|
||||
} catch (e) {
|
||||
}
|
||||
db._useDatabase('_system');
|
||||
connectToSlave();
|
||||
try {
|
||||
db._dropDatabase(dbName);
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
db._createDatabase(dbName);
|
||||
db._createDatabase(dbName);
|
||||
|
||||
connectToMaster();
|
||||
connectToMaster();
|
||||
|
||||
try {
|
||||
db._dropDatabase(dbName);
|
||||
} catch (e) {
|
||||
}
|
||||
db._createDatabase(dbName);
|
||||
db._useDatabase(dbName);
|
||||
};
|
||||
try {
|
||||
db._dropDatabase(dbName);
|
||||
} catch (e) {
|
||||
}
|
||||
db._createDatabase(dbName);
|
||||
db._useDatabase(dbName);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief tear down
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief tear down
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
suite.tearDown = function() {
|
||||
stopApplier(dbName);
|
||||
tearDown: function () {
|
||||
stopApplier(dbName);
|
||||
|
||||
db._useDatabase("_system");
|
||||
connectToMaster();
|
||||
try {
|
||||
db._dropDatabase(dbName);
|
||||
} catch (e) {
|
||||
}
|
||||
db._useDatabase('_system');
|
||||
connectToMaster();
|
||||
try {
|
||||
db._dropDatabase(dbName);
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
db._useDatabase("_system");
|
||||
try {
|
||||
db._dropDatabase(dbName);
|
||||
} catch (e) {
|
||||
db._useDatabase('_system');
|
||||
try {
|
||||
db._dropDatabase(dbName);
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
};
|
||||
deriveTestSuite(BaseTestConfig(), suite, '_ReplOther');
|
||||
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief executes the test suite
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief executes the test suite
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
jsunity.run(ReplicationSuite);
|
||||
jsunity.run(ReplicationOtherDBSuite);
|
||||
|
|
|
@ -1,68 +1,68 @@
|
|||
/*jshint globalstrict:false, strict:false, unused: false */
|
||||
/*global fail, assertEqual, assertTrue, assertFalse, assertNull, assertNotNull, arango, ARGUMENTS */
|
||||
/* jshint globalstrict:false, strict:false, unused: false */
|
||||
/* global assertEqual, assertTrue, assertFalse, arango, ARGUMENTS */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test the replication
|
||||
///
|
||||
/// @file
|
||||
///
|
||||
/// DISCLAIMER
|
||||
///
|
||||
/// Copyright 2010-2012 triagens GmbH, Cologne, Germany
|
||||
///
|
||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
/// you may not use this file except in compliance with the License.
|
||||
/// You may obtain a copy of the License at
|
||||
///
|
||||
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||
///
|
||||
/// Unless required by applicable law or agreed to in writing, software
|
||||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
/// See the License for the specific language governing permissions and
|
||||
/// limitations under the License.
|
||||
///
|
||||
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
||||
///
|
||||
/// @author Jan Steemann
|
||||
/// @author Copyright 2013, triAGENS GmbH, Cologne, Germany
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief test the replication
|
||||
// /
|
||||
// / @file
|
||||
// /
|
||||
// / DISCLAIMER
|
||||
// /
|
||||
// / Copyright 2010-2012 triagens GmbH, Cologne, Germany
|
||||
// /
|
||||
// / Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// / you may not use this file except in compliance with the License.
|
||||
// / You may obtain a copy of the License at
|
||||
// /
|
||||
// / http://www.apache.org/licenses/LICENSE-2.0
|
||||
// /
|
||||
// / Unless required by applicable law or agreed to in writing, software
|
||||
// / distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// / WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// / See the License for the specific language governing permissions and
|
||||
// / limitations under the License.
|
||||
// /
|
||||
// / Copyright holder is triAGENS GmbH, Cologne, Germany
|
||||
// /
|
||||
// / @author Jan Steemann
|
||||
// / @author Copyright 2013, triAGENS GmbH, Cologne, Germany
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var jsunity = require("jsunity");
|
||||
var arangodb = require("@arangodb");
|
||||
var errors = arangodb.errors;
|
||||
var jsunity = require('jsunity');
|
||||
var arangodb = require('@arangodb');
|
||||
var db = arangodb.db;
|
||||
|
||||
var replication = require("@arangodb/replication");
|
||||
var replication = require('@arangodb/replication');
|
||||
var deriveTestSuite = require('@arangodb/test-helper').deriveTestSuite;
|
||||
let compareTicks = replication.compareTicks;
|
||||
var console = require("console");
|
||||
var internal = require("internal");
|
||||
var console = require('console');
|
||||
var internal = require('internal');
|
||||
var masterEndpoint = arango.getEndpoint();
|
||||
var slaveEndpoint = ARGUMENTS[0];
|
||||
|
||||
var cn = "UnitTestsReplication";
|
||||
var cn2 = "UnitTestsReplication2";
|
||||
|
||||
var connectToMaster = function() {
|
||||
arango.reconnect(masterEndpoint, db._name(), "root", "");
|
||||
var cn = 'UnitTestsReplication';
|
||||
var cn2 = 'UnitTestsReplication2';
|
||||
|
||||
var connectToMaster = function () {
|
||||
arango.reconnect(masterEndpoint, db._name(), 'root', '');
|
||||
db._flushCache();
|
||||
};
|
||||
|
||||
var connectToSlave = function() {
|
||||
arango.reconnect(slaveEndpoint, db._name(), "root", "");
|
||||
var connectToSlave = function () {
|
||||
arango.reconnect(slaveEndpoint, db._name(), 'root', '');
|
||||
db._flushCache();
|
||||
};
|
||||
|
||||
var collectionChecksum = function(name) {
|
||||
var collectionChecksum = function (name) {
|
||||
var c = db._collection(name).checksum(true, true);
|
||||
return c.checksum;
|
||||
};
|
||||
|
||||
var collectionCount = function(name) {
|
||||
var collectionCount = function (name) {
|
||||
return db._collection(name).count();
|
||||
};
|
||||
|
||||
var compare = function(masterFunc, masterFunc2, slaveFuncOngoing, slaveFuncFinal, applierConfiguration) {
|
||||
var compare = function (masterFunc, masterFunc2, slaveFuncOngoing, slaveFuncFinal, applierConfiguration) {
|
||||
var state = {};
|
||||
|
||||
db._flushCache();
|
||||
|
@ -77,31 +77,31 @@ var compare = function(masterFunc, masterFunc2, slaveFuncOngoing, slaveFuncFinal
|
|||
}
|
||||
|
||||
var includeSystem = true;
|
||||
var restrictType = "";
|
||||
var restrictType = '';
|
||||
var restrictCollections = [];
|
||||
applierConfiguration = applierConfiguration || { };
|
||||
|
||||
if (typeof applierConfiguration === 'object') {
|
||||
if (applierConfiguration.hasOwnProperty("includeSystem")) {
|
||||
if (applierConfiguration.hasOwnProperty('includeSystem')) {
|
||||
includeSystem = applierConfiguration.includeSystem;
|
||||
}
|
||||
if (applierConfiguration.hasOwnProperty("restrictType")) {
|
||||
if (applierConfiguration.hasOwnProperty('restrictType')) {
|
||||
restrictType = applierConfiguration.restrictType;
|
||||
}
|
||||
if (applierConfiguration.hasOwnProperty("restrictCollections")) {
|
||||
if (applierConfiguration.hasOwnProperty('restrictCollections')) {
|
||||
restrictCollections = applierConfiguration.restrictCollections;
|
||||
}
|
||||
}
|
||||
|
||||
var keepBarrier = false;
|
||||
if (applierConfiguration.hasOwnProperty("keepBarrier")) {
|
||||
if (applierConfiguration.hasOwnProperty('keepBarrier')) {
|
||||
keepBarrier = applierConfiguration.keepBarrier;
|
||||
}
|
||||
|
||||
var syncResult = replication.sync({
|
||||
endpoint: masterEndpoint,
|
||||
username: "root",
|
||||
password: "",
|
||||
username: 'root',
|
||||
password: '',
|
||||
verbose: true,
|
||||
includeSystem,
|
||||
restrictType,
|
||||
|
@ -114,13 +114,13 @@ var compare = function(masterFunc, masterFunc2, slaveFuncOngoing, slaveFuncFinal
|
|||
connectToMaster();
|
||||
masterFunc2(state);
|
||||
|
||||
// use lastLogTick as of now
|
||||
// use lastLogTick as of now
|
||||
state.lastLogTick = replication.logger.state().state.lastLogTick;
|
||||
|
||||
applierConfiguration = applierConfiguration || {};
|
||||
applierConfiguration.endpoint = masterEndpoint;
|
||||
applierConfiguration.username = "root";
|
||||
applierConfiguration.password = "";
|
||||
applierConfiguration.username = 'root';
|
||||
applierConfiguration.password = '';
|
||||
applierConfiguration.force32mode = false;
|
||||
|
||||
if (!applierConfiguration.hasOwnProperty('chunkSize')) {
|
||||
|
@ -132,8 +132,7 @@ var compare = function(masterFunc, masterFunc2, slaveFuncOngoing, slaveFuncFinal
|
|||
replication.applier.properties(applierConfiguration);
|
||||
if (keepBarrier) {
|
||||
replication.applier.start(syncResult.lastLogTick, syncResult.barrierId);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
replication.applier.start(syncResult.lastLogTick);
|
||||
}
|
||||
|
||||
|
@ -141,8 +140,8 @@ var compare = function(masterFunc, masterFunc2, slaveFuncOngoing, slaveFuncFinal
|
|||
|
||||
while (true) {
|
||||
var r = slaveFuncOngoing(state);
|
||||
if (r === "wait") {
|
||||
// special return code that tells us to hang on
|
||||
if (r === 'wait') {
|
||||
// special return code that tells us to hang on
|
||||
internal.wait(0.5, false);
|
||||
continue;
|
||||
}
|
||||
|
@ -153,23 +152,26 @@ var compare = function(masterFunc, masterFunc2, slaveFuncOngoing, slaveFuncFinal
|
|||
var slaveState = replication.applier.state();
|
||||
|
||||
if (slaveState.state.lastError.errorNum > 0) {
|
||||
console.topic("replication=error", "slave has errored:", JSON.stringify(slaveState.state.lastError));
|
||||
console.topic('replication=error', 'slave has errored:', JSON.stringify(slaveState.state.lastError));
|
||||
break;
|
||||
}
|
||||
|
||||
if (!slaveState.state.running) {
|
||||
console.topic("replication=error", "slave is not running");
|
||||
console.topic('replication=error', 'slave is not running');
|
||||
break;
|
||||
}
|
||||
|
||||
if (compareTicks(slaveState.state.lastAppliedContinuousTick, state.lastLogTick) >= 0 ||
|
||||
compareTicks(slaveState.state.lastProcessedContinuousTick, state.lastLogTick) >= 0) { // ||
|
||||
console.topic("replication=debug", "slave has caught up. syncResult.lastLogTick:", state.lastLogTick, "slaveState.lastAppliedContinuousTick:", slaveState.state.lastAppliedContinuousTick, "slaveState.lastProcessedContinuousTick:", slaveState.state.lastProcessedContinuousTick);
|
||||
compareTicks(slaveState.state.lastProcessedContinuousTick, state.lastLogTick) >= 0) {
|
||||
console.topic('replication=debug',
|
||||
'slave has caught up. syncResult.lastLogTick:', state.lastLogTick,
|
||||
'slaveState.lastAppliedContinuousTick:', slaveState.state.lastAppliedContinuousTick,
|
||||
'slaveState.lastProcessedContinuousTick:', slaveState.state.lastProcessedContinuousTick);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!printed) {
|
||||
console.topic("replication=debug", "waiting for slave to catch up");
|
||||
console.topic('replication=debug', 'waiting for slave to catch up');
|
||||
printed = true;
|
||||
}
|
||||
internal.wait(0.5, false);
|
||||
|
@ -179,7 +181,7 @@ var compare = function(masterFunc, masterFunc2, slaveFuncOngoing, slaveFuncFinal
|
|||
slaveFuncFinal(state);
|
||||
};
|
||||
|
||||
var stopApplier = function(dbName) {
|
||||
var stopApplier = function (dbName) {
|
||||
connectToSlave();
|
||||
try {
|
||||
db._useDatabase(dbName);
|
||||
|
@ -190,35 +192,35 @@ var stopApplier = function(dbName) {
|
|||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Basic test definition
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief Basic test definition
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function BaseTestConfig() {
|
||||
function BaseTestConfig () {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test require from present
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief test require from present
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testRequireFromPresentFalse: function() {
|
||||
testRequireFromPresentFalse: function () {
|
||||
connectToMaster();
|
||||
|
||||
compare(
|
||||
function(state) {
|
||||
function (state) {
|
||||
db._create(cn);
|
||||
},
|
||||
|
||||
function(state) {
|
||||
// flush the wal logs on the master so the start tick is not available
|
||||
// anymore when we start replicating
|
||||
function (state) {
|
||||
// flush the wal logs on the master so the start tick is not available
|
||||
// anymore when we start replicating
|
||||
for (var i = 0; i < 30; ++i) {
|
||||
db._collection(cn).save({
|
||||
value: i
|
||||
});
|
||||
internal.wal.flush(); //true, true);
|
||||
internal.wal.flush();
|
||||
}
|
||||
db._collection(cn).save({
|
||||
value: i
|
||||
|
@ -227,19 +229,19 @@ function BaseTestConfig() {
|
|||
internal.wait(6, false);
|
||||
},
|
||||
|
||||
function(state) {
|
||||
function (state) {
|
||||
return true;
|
||||
},
|
||||
|
||||
function(state) {
|
||||
if (db._engine().name === "rocksdb") {
|
||||
// rocksdb keeps wal longer
|
||||
function (state) {
|
||||
if (db._engine().name === 'rocksdb') {
|
||||
// rocksdb keeps wal longer
|
||||
let cc = db._collection(cn).count();
|
||||
assertEqual(cc, 31, "rocksdb must keep wal, documents not there");
|
||||
assertEqual(cc, 31, 'rocksdb must keep wal, documents not there');
|
||||
} else {
|
||||
// data loss on slave!
|
||||
// data loss on slave!
|
||||
let cc = db._collection(cn).count();
|
||||
assertTrue(cc < 25, "Expected less than " + cc);
|
||||
assertTrue(cc < 25, 'Expected less than ' + cc);
|
||||
}
|
||||
}, {
|
||||
requireFromPresent: false,
|
||||
|
@ -247,12 +249,12 @@ function BaseTestConfig() {
|
|||
}
|
||||
);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test require from present
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testRequireFromPresentTrue : function () {
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief test require from present
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testRequireFromPresentTrue: function () {
|
||||
connectToMaster();
|
||||
|
||||
compare(
|
||||
|
@ -261,11 +263,13 @@ function BaseTestConfig() {
|
|||
},
|
||||
|
||||
function (state) {
|
||||
// flush the wal logs on the master so the start tick is not available
|
||||
// anymore when we start replicating
|
||||
// flush the wal logs on the master so the start tick is not available
|
||||
// anymore when we start replicating
|
||||
for (var i = 0; i < 30; ++i) {
|
||||
db._collection(cn).save({ value: i });
|
||||
internal.wal.flush(); //true, true);
|
||||
db._collection(cn).save({
|
||||
value: i
|
||||
});
|
||||
internal.wal.flush();
|
||||
}
|
||||
internal.wal.flush(true, true);
|
||||
internal.wait(6, false);
|
||||
|
@ -276,10 +280,10 @@ function BaseTestConfig() {
|
|||
},
|
||||
|
||||
function (state) {
|
||||
// wait for slave applier to have started and run
|
||||
// wait for slave applier to have started and run
|
||||
internal.wait(5, false);
|
||||
|
||||
// slave should not have stopped
|
||||
// slave should not have stopped
|
||||
assertTrue(replication.applier.state().state.running);
|
||||
return true;
|
||||
},
|
||||
|
@ -295,11 +299,11 @@ function BaseTestConfig() {
|
|||
);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test require from present, no barrier
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief test require from present, no barrier
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testRequireFromPresentTrueNoBarrier : function () {
|
||||
testRequireFromPresentTrueNoBarrier: function () {
|
||||
connectToMaster();
|
||||
|
||||
compare(
|
||||
|
@ -308,30 +312,32 @@ function BaseTestConfig() {
|
|||
},
|
||||
|
||||
function (state) {
|
||||
// flush the wal logs on the master so the start tick is not available
|
||||
// anymore when we start replicating
|
||||
// flush the wal logs on the master so the start tick is not available
|
||||
// anymore when we start replicating
|
||||
for (var i = 0; i < 30; ++i) {
|
||||
db._collection(cn).save({ value: i });
|
||||
internal.wal.flush(); //true, true);
|
||||
db._collection(cn).save({
|
||||
value: i
|
||||
});
|
||||
internal.wal.flush();
|
||||
}
|
||||
internal.wal.flush(true, true);
|
||||
internal.wait(6, false);
|
||||
},
|
||||
|
||||
function (state) {
|
||||
// wait for slave applier to have started and detect the mess
|
||||
// wait for slave applier to have started and detect the mess
|
||||
return replication.applier.state().state.running;
|
||||
},
|
||||
|
||||
function (state) {
|
||||
if (db._engine().name === "rocksdb") {
|
||||
// rocksdb keeps wal longer
|
||||
assertTrue(replication.applier.state().state.running, "Applier should be running");
|
||||
assertEqual(db._collection(cn).count(), 30, "rocksdb must keep wal");
|
||||
if (db._engine().name === 'rocksdb') {
|
||||
// rocksdb keeps wal longer
|
||||
assertTrue(replication.applier.state().state.running, 'Applier should be running');
|
||||
assertEqual(db._collection(cn).count(), 30, 'rocksdb must keep wal');
|
||||
} else {
|
||||
// slave should have failed
|
||||
// slave should have failed
|
||||
assertFalse(replication.applier.state().state.running);
|
||||
// data loss on slave!
|
||||
// data loss on slave!
|
||||
assertTrue(db._collection(cn).count() < 25);
|
||||
}
|
||||
},
|
||||
|
@ -345,109 +351,111 @@ function BaseTestConfig() {
|
|||
};
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Test suite for _system database
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief Test suite for _system database
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function ReplicationSuite() {
|
||||
function ReplicationSuite () {
|
||||
let suite = {
|
||||
|
||||
let suite = BaseTestConfig();
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief set up
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief set up
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
setUp: function () {
|
||||
stopApplier('_system');
|
||||
|
||||
suite.setUp = function() {
|
||||
stopApplier("_system");
|
||||
connectToMaster();
|
||||
|
||||
connectToMaster();
|
||||
db._drop(cn);
|
||||
db._drop(cn2);
|
||||
},
|
||||
|
||||
db._drop(cn);
|
||||
db._drop(cn2);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief tear down
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
suite.tearDown = function() {
|
||||
stopApplier("_system");
|
||||
|
||||
connectToMaster();
|
||||
db._drop(cn);
|
||||
db._drop(cn2);
|
||||
|
||||
connectToSlave();
|
||||
db._drop(cn);
|
||||
db._drop(cn2);
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief tear down
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
tearDown: function () {
|
||||
stopApplier('_system');
|
||||
|
||||
connectToMaster();
|
||||
db._drop(cn);
|
||||
db._drop(cn2);
|
||||
|
||||
connectToSlave();
|
||||
db._drop(cn);
|
||||
db._drop(cn2);
|
||||
}
|
||||
};
|
||||
deriveTestSuite(BaseTestConfig(), suite, '_Repl');
|
||||
|
||||
return suite;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Test suite for other database
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief Test suite for other database
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function ReplicationOtherDBSuite() {
|
||||
const dbName = "UnitTestDB";
|
||||
function ReplicationOtherDBSuite () {
|
||||
const dbName = 'UnitTestDB';
|
||||
|
||||
let suite = BaseTestConfig();
|
||||
let suite = {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief set up
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief set up
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
suite.setUp = function() {
|
||||
stopApplier(dbName);
|
||||
setUp: function () {
|
||||
stopApplier(dbName);
|
||||
|
||||
db._useDatabase("_system");
|
||||
connectToSlave();
|
||||
try {
|
||||
db._dropDatabase(dbName);
|
||||
} catch (e) {
|
||||
}
|
||||
db._useDatabase('_system');
|
||||
connectToSlave();
|
||||
try {
|
||||
db._dropDatabase(dbName);
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
db._createDatabase(dbName);
|
||||
db._createDatabase(dbName);
|
||||
|
||||
connectToMaster();
|
||||
connectToMaster();
|
||||
|
||||
try {
|
||||
db._dropDatabase(dbName);
|
||||
} catch (e) {
|
||||
}
|
||||
db._createDatabase(dbName);
|
||||
db._useDatabase(dbName);
|
||||
};
|
||||
try {
|
||||
db._dropDatabase(dbName);
|
||||
} catch (e) {
|
||||
}
|
||||
db._createDatabase(dbName);
|
||||
db._useDatabase(dbName);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief tear down
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief tear down
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
suite.tearDown = function() {
|
||||
stopApplier(dbName);
|
||||
tearDown: function () {
|
||||
stopApplier(dbName);
|
||||
|
||||
db._useDatabase("_system");
|
||||
connectToMaster();
|
||||
try {
|
||||
db._dropDatabase(dbName);
|
||||
} catch (e) {
|
||||
}
|
||||
db._useDatabase('_system');
|
||||
connectToMaster();
|
||||
try {
|
||||
db._dropDatabase(dbName);
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
db._useDatabase("_system");
|
||||
try {
|
||||
db._dropDatabase(dbName);
|
||||
} catch (e) {
|
||||
db._useDatabase('_system');
|
||||
try {
|
||||
db._dropDatabase(dbName);
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
deriveTestSuite(BaseTestConfig(), suite, '_OtherRepl');
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief executes the test suite
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief executes the test suite
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
jsunity.run(ReplicationSuite);
|
||||
jsunity.run(ReplicationOtherDBSuite);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -81,7 +81,7 @@ function arrayHashIndexSuite () {
|
|||
/// @brief test: get index
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testIndex : function () {
|
||||
testHashIndex : function () {
|
||||
var id = collection.ensureHashIndex("a[*]");
|
||||
|
||||
var idx = collection.index(id.id);
|
||||
|
@ -231,7 +231,7 @@ function arraySkiplistIndexSuite () {
|
|||
/// @brief test: get index
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testIndex : function () {
|
||||
testSkiplistIndex : function () {
|
||||
var id = collection.ensureSkiplist("a[*]");
|
||||
|
||||
var idx = collection.index(id.id);
|
||||
|
@ -251,7 +251,7 @@ function arraySkiplistIndexSuite () {
|
|||
/// @brief test: Unique index insertion and reading
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testInsertAndReadArrayUnique : function () {
|
||||
testSkipListInsertAndReadArrayUnique : function () {
|
||||
collection.ensureUniqueSkiplist("a[*]");
|
||||
|
||||
collection.save({a: [1, 2]});
|
||||
|
@ -269,7 +269,7 @@ function arraySkiplistIndexSuite () {
|
|||
/// @brief test: Multiple identical elements in array with unique constraint
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testInsertAndReadArrayIdenticalElementsUnique : function () {
|
||||
testSkipListInsertAndReadArrayIdenticalElementsUnique : function () {
|
||||
collection.ensureUniqueSkiplist("a[*]");
|
||||
|
||||
collection.save({a: [1, 2, 1, 3, 1]});
|
||||
|
|
|
@ -135,7 +135,7 @@ function HashIndexMultiFailuresSuite () {
|
|||
/// @brief test: hash index multi fill element oom
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testCreateIndexElementOOM : function () {
|
||||
testMultiFailCreateIndexElementOOM : function () {
|
||||
collection.ensureUniqueConstraint("a");
|
||||
internal.debugSetFailAt("FillElementOOM");
|
||||
try {
|
||||
|
@ -153,7 +153,7 @@ function HashIndexMultiFailuresSuite () {
|
|||
/// @brief test: hash index multi fill element oom, other position
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testCreateIndexElementOOMOther : function () {
|
||||
testMultiFailCreateIndexElementOOMOther : function () {
|
||||
collection.ensureUniqueConstraint("a");
|
||||
internal.debugSetFailAt("FillElementOOM2");
|
||||
try {
|
||||
|
|
|
@ -289,7 +289,7 @@ function routingSuiteBundle () {
|
|||
/// @brief test: simple routing
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSimpleRouting: function () {
|
||||
testBundleSimpleRouting: function () {
|
||||
var r = actions.firstRouting('GET', "/hello/world", routing);
|
||||
|
||||
assertEqual('m1', r.route.route.content);
|
||||
|
@ -373,7 +373,7 @@ function routingSuitePrefix () {
|
|||
/// @brief test: simple routing
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSimpleRouting: function () {
|
||||
testPrefixSimpleRouting: function () {
|
||||
var r = actions.firstRouting('GET', "/test/hello/world", routing);
|
||||
assertEqual('m1', r.route.route.content);
|
||||
assertEqual('/test/*', r.route.path);
|
||||
|
|
Loading…
Reference in New Issue