mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel
This commit is contained in:
commit
7cf458a77d
|
@ -27,27 +27,7 @@ monitoring of the server.
|
||||||
@copydetails JSF_get_admin_statistics_description
|
@copydetails JSF_get_admin_statistics_description
|
||||||
|
|
||||||
@CLEARPAGE
|
@CLEARPAGE
|
||||||
@anchor HttpSystemAdminDescriptionShardingGET
|
@anchor HttpSystemAdminServerRole
|
||||||
@copydetails JSF_cluster_test_GET
|
@copydetails JSF_get_admin_server_role
|
||||||
|
|
||||||
@CLEARPAGE
|
|
||||||
@anchor HttpSystemAdminDescriptionShardingPUT
|
|
||||||
@copydetails JSF_cluster_test_PUT
|
|
||||||
|
|
||||||
@CLEARPAGE
|
|
||||||
@anchor HttpSystemAdminDescriptionShardingPOST
|
|
||||||
@copydetails JSF_cluster_test_POST
|
|
||||||
|
|
||||||
@CLEARPAGE
|
|
||||||
@anchor HttpSystemAdminDescriptionShardingDELETE
|
|
||||||
@copydetails JSF_cluster_test_DELETE
|
|
||||||
|
|
||||||
@CLEARPAGE
|
|
||||||
@anchor HttpSystemAdminDescriptionShardingPATCH
|
|
||||||
@copydetails JSF_cluster_test_PATCH
|
|
||||||
|
|
||||||
@CLEARPAGE
|
|
||||||
@anchor HttpSystemAdminDescriptionShardingHEAD
|
|
||||||
@copydetails JSF_cluster_test_HEAD
|
|
||||||
|
|
||||||
@BNAVIGATE_HttpSystem
|
@BNAVIGATE_HttpSystem
|
||||||
|
|
|
@ -7,9 +7,4 @@ TOC {#HttpSystemTOC}
|
||||||
- @ref HttpSystemFlushServerModules "POST /_admin/modules/flush"
|
- @ref HttpSystemFlushServerModules "POST /_admin/modules/flush"
|
||||||
- @ref HttpSystemAdminStatistics "GET /_admin/statistics"
|
- @ref HttpSystemAdminStatistics "GET /_admin/statistics"
|
||||||
- @ref HttpSystemAdminStatisticsDescription "GET /_admin/statistics-descriptions"
|
- @ref HttpSystemAdminStatisticsDescription "GET /_admin/statistics-descriptions"
|
||||||
- @ref HttpSystemAdminDescriptionShardingGET "GET /_admin/sharding-test"
|
- @ref HttpSystemAdminServerRole "GET /_admin/server/role"
|
||||||
- @ref HttpSystemAdminDescriptionShardingPUT "PUT /_admin/sharding-test"
|
|
||||||
- @ref HttpSystemAdminDescriptionShardingPOST "POST /_admin/sharding-test"
|
|
||||||
- @ref HttpSystemAdminDescriptionShardingDELETE "DELETE /_admin/sharding-test"
|
|
||||||
- @ref HttpSystemAdminDescriptionShardingPATCH "PATCH /_admin/sharding-test"
|
|
||||||
- @ref HttpSystemAdminDescriptionShardingHEAD "HEAD /_admin/sharding-test"
|
|
||||||
|
|
|
@ -213,6 +213,8 @@ pkglibexec_SCRIPTS =
|
||||||
|
|
||||||
if ENABLE_ALL_IN_ONE_ETCD
|
if ENABLE_ALL_IN_ONE_ETCD
|
||||||
pkglibexec_SCRIPTS += bin/etcd-arango$(PROGRAM_SUFFIX)
|
pkglibexec_SCRIPTS += bin/etcd-arango$(PROGRAM_SUFFIX)
|
||||||
|
|
||||||
|
CLEANUP += bin/etcd-arango$(PROGRAM_SUFFIX)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
|
@ -392,7 +392,7 @@ SHELL_SERVER_ONLY = \
|
||||||
@top_srcdir@/js/server/tests/shell-compaction-noncluster.js \
|
@top_srcdir@/js/server/tests/shell-compaction-noncluster.js \
|
||||||
@top_srcdir@/js/server/tests/shell-transactions-noncluster.js \
|
@top_srcdir@/js/server/tests/shell-transactions-noncluster.js \
|
||||||
@top_srcdir@/js/server/tests/shell-routing.js \
|
@top_srcdir@/js/server/tests/shell-routing.js \
|
||||||
@top_srcdir@/js/server/tests/shell-any.js \
|
@top_srcdir@/js/server/tests/shell-any-noncluster.js \
|
||||||
@top_srcdir@/js/server/tests/shell-bitarray-index.js \
|
@top_srcdir@/js/server/tests/shell-bitarray-index.js \
|
||||||
@top_srcdir@/js/server/tests/shell-database-noncluster.js \
|
@top_srcdir@/js/server/tests/shell-database-noncluster.js \
|
||||||
@top_srcdir@/js/server/tests/shell-foxx.js \
|
@top_srcdir@/js/server/tests/shell-foxx.js \
|
||||||
|
|
|
@ -1667,8 +1667,8 @@ static bool RunJsLint (v8::Handle<v8::Context> context) {
|
||||||
sysTestFiles->Set((uint32_t) i, v8::String::New(JsLint[i].c_str()));
|
sysTestFiles->Set((uint32_t) i, v8::String::New(JsLint[i].c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
TRI_AddGlobalVariableVocbase(context, "SYS_UNIT_TESTS", sysTestFiles);
|
context->Global()->Set(v8::String::New("SYS_UNIT_TESTS"), sysTestFiles);
|
||||||
TRI_AddGlobalVariableVocbase(context, "SYS_UNIT_TESTS_RESULT", v8::True());
|
context->Global()->Set(v8::String::New("SYS_UNIT_TESTS_RESULT"), v8::True());
|
||||||
|
|
||||||
// run tests
|
// run tests
|
||||||
char const* input = "require(\"jslint\").runCommandLineTests({ });";
|
char const* input = "require(\"jslint\").runCommandLineTests({ });";
|
||||||
|
|
|
@ -70,14 +70,17 @@ JAVASCRIPT_JSLINT = \
|
||||||
.PHONY: jslint
|
.PHONY: jslint
|
||||||
|
|
||||||
jslint:
|
jslint:
|
||||||
@for file in $(JAVASCRIPT_JSLINT); do \
|
@RESULT=0; \
|
||||||
|
for file in $(JAVASCRIPT_JSLINT); do \
|
||||||
@builddir@/bin/arangosh \
|
@builddir@/bin/arangosh \
|
||||||
-c none \
|
-c none \
|
||||||
--log.level error \
|
--log.level error \
|
||||||
--server.password "" \
|
--server.password "" \
|
||||||
--javascript.startup-directory @srcdir@/js \
|
--javascript.startup-directory @srcdir@/js \
|
||||||
--jslint $$file; \
|
--jslint $$file; \
|
||||||
done
|
if [ "$$?x" != "0x" ]; then RESULT=1; fi; \
|
||||||
|
done; \
|
||||||
|
exit $$RESULT
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
### @brief sets up the directories
|
### @brief sets up the directories
|
||||||
|
|
|
@ -133,7 +133,27 @@ actions.defineHttp({
|
||||||
});
|
});
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief returns the current server role
|
/// @fn JSF_get_admin_server_role
|
||||||
|
/// @brief returns the role of a server in a cluster
|
||||||
|
///
|
||||||
|
/// @RESTHEADER{GET /_admin/server/role,returns the role of a server in a cluster}
|
||||||
|
///
|
||||||
|
/// @RESTDESCRIPTION
|
||||||
|
///
|
||||||
|
/// Returns the role of a server in a cluster.
|
||||||
|
/// The role is returned in the `role` attribute of the result.
|
||||||
|
/// Possible return values for `role` are:
|
||||||
|
/// - `COORDINATOR`: the server is a coordinator in a cluster
|
||||||
|
/// - `PRIMARY`: the server is a primary database server in a cluster
|
||||||
|
/// - `SECONDARY`: the server is a secondary database server in a cluster
|
||||||
|
/// - `UNKNOWN`: in a cluster, `UNKNOWN` is returned if the server role cannot be
|
||||||
|
/// determined. On a single server, `UNKNOWN` is the only possible return
|
||||||
|
/// value.
|
||||||
|
///
|
||||||
|
/// @RESTRETURNCODES
|
||||||
|
///
|
||||||
|
/// @RESTRETURNCODE{200}
|
||||||
|
/// Is returned in all cases.
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
actions.defineHttp({
|
actions.defineHttp({
|
||||||
|
|
|
@ -0,0 +1,202 @@
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief test the random document selector
|
||||||
|
///
|
||||||
|
/// @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 2012, triAGENS GmbH, Cologne, Germany
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
var jsunity = require("jsunity");
|
||||||
|
|
||||||
|
var arangodb = require("org/arangodb");
|
||||||
|
var db = arangodb.db;
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- any
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief test suite
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
function AnySuite () {
|
||||||
|
var cn = "example";
|
||||||
|
var c;
|
||||||
|
|
||||||
|
var threshold = 15; // maximum tolerated stddev for distribution
|
||||||
|
|
||||||
|
var stddev = function (dist) {
|
||||||
|
var v;
|
||||||
|
var sum = 0;
|
||||||
|
var count = 0;
|
||||||
|
|
||||||
|
for (v in dist) {
|
||||||
|
if (dist.hasOwnProperty(v)) {
|
||||||
|
sum += dist[v];
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var avg = sum / count;
|
||||||
|
var sum2 = 0;
|
||||||
|
|
||||||
|
for (v in dist) {
|
||||||
|
if (dist.hasOwnProperty(v)) {
|
||||||
|
var d = dist[v] - avg;
|
||||||
|
sum2 += d * d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.sqrt(sum2 / count);
|
||||||
|
};
|
||||||
|
|
||||||
|
var getDistribution = function (n, rng) {
|
||||||
|
var dist = { };
|
||||||
|
var i;
|
||||||
|
|
||||||
|
for (i = 0; i < n; ++i) {
|
||||||
|
var pick = rng();
|
||||||
|
|
||||||
|
if (dist.hasOwnProperty(pick)) {
|
||||||
|
dist[pick]++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dist[pick] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return dist;
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief set up
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
setUp : function () {
|
||||||
|
db._drop(cn);
|
||||||
|
c = db._create(cn);
|
||||||
|
},
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief tear down
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
tearDown : function () {
|
||||||
|
db._drop(cn);
|
||||||
|
},
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief check entropy of Math.random()
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
testCheckEntropyNative : function () {
|
||||||
|
var i, n;
|
||||||
|
|
||||||
|
n = 100;
|
||||||
|
|
||||||
|
for (i = 0; i < n; ++i) {
|
||||||
|
c.save({ value: i });
|
||||||
|
}
|
||||||
|
|
||||||
|
var dist = getDistribution(n * 100, function () {
|
||||||
|
return parseInt(Math.random() * 100, 10);
|
||||||
|
});
|
||||||
|
|
||||||
|
assertTrue(stddev(dist) < threshold);
|
||||||
|
},
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief check entropy of any(), just one document
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
testCheckEntropyCollectionOne : function () {
|
||||||
|
c.save({ value: 1 });
|
||||||
|
|
||||||
|
var dist = getDistribution(100, function () {
|
||||||
|
return c.any().value;
|
||||||
|
});
|
||||||
|
|
||||||
|
assertTrue(stddev(dist) <= 0.01);
|
||||||
|
},
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief check entropy of any(), few picks
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
testCheckEntropyCollectionFew1 : function () {
|
||||||
|
var i, n;
|
||||||
|
|
||||||
|
n = 3;
|
||||||
|
|
||||||
|
for (i = 0; i < n; ++i) {
|
||||||
|
c.save({ value: i });
|
||||||
|
}
|
||||||
|
|
||||||
|
var dist = getDistribution(n * 200, function () {
|
||||||
|
return c.any().value;
|
||||||
|
});
|
||||||
|
|
||||||
|
assertTrue(stddev(dist) < threshold * 3.0);
|
||||||
|
},
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief check entropy of any(), few picks
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
testCheckEntropyCollectionFew2 : function () {
|
||||||
|
var i, n;
|
||||||
|
|
||||||
|
n = 10;
|
||||||
|
|
||||||
|
for (i = 0; i < n; ++i) {
|
||||||
|
c.save({ value: i });
|
||||||
|
}
|
||||||
|
|
||||||
|
var dist = getDistribution(n * 100, function () {
|
||||||
|
return c.any().value;
|
||||||
|
});
|
||||||
|
|
||||||
|
assertTrue(stddev(dist) < threshold * 1.5);
|
||||||
|
},
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- main
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief executes the test suite
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
jsunity.run(AnySuite);
|
||||||
|
|
||||||
|
return jsunity.done();
|
||||||
|
|
||||||
|
// Local Variables:
|
||||||
|
// mode: outline-minor
|
||||||
|
// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)"
|
||||||
|
// End:
|
||||||
|
|
Loading…
Reference in New Issue