From a291f6dcfae38a31a4c816bcb1ba3298017f5ee9 Mon Sep 17 00:00:00 2001 From: Vasiliy Date: Thu, 26 Jul 2018 19:03:35 +0300 Subject: [PATCH] issue 431.1: remove error generation for empty jSON (#6007) --- arangod/RestHandler/RestViewHandler.cpp | 5 ---- js/client/modules/@arangodb/test-utils.js | 2 +- .../aql/aql-view-arangosearch-ddl-cluster.js | 25 +++++++++++++++++++ .../aql-view-arangosearch-ddl-noncluster.js | 25 +++++++++++++++++++ 4 files changed, 51 insertions(+), 6 deletions(-) diff --git a/arangod/RestHandler/RestViewHandler.cpp b/arangod/RestHandler/RestViewHandler.cpp index 9ecc3430b9..cabef800a8 100644 --- a/arangod/RestHandler/RestViewHandler.cpp +++ b/arangod/RestHandler/RestViewHandler.cpp @@ -160,11 +160,6 @@ void RestViewHandler::createView() { //////////////////////////////////////////////////////////////////////////////// void RestViewHandler::modifyView(bool partialUpdate) { - if (_request->payload().isEmptyObject()) { - generateError(rest::ResponseCode::BAD, TRI_ERROR_HTTP_CORRUPTED_JSON); - return; - } - std::vector const& suffixes = _request->suffixes(); if ((suffixes.size() != 2) || (suffixes[1] != "properties" && suffixes[1] != "rename")) { diff --git a/js/client/modules/@arangodb/test-utils.js b/js/client/modules/@arangodb/test-utils.js index a0a04e02a6..ab63ea4da7 100644 --- a/js/client/modules/@arangodb/test-utils.js +++ b/js/client/modules/@arangodb/test-utils.js @@ -726,7 +726,7 @@ function runInRSpec (options, instanceInfo, file, addArgs) { } } - fs.remove(jsonFN); + if (fs.exists(jsonFN)) fs.remove(jsonFN); fs.remove(tmpname); return result; } diff --git a/js/common/tests/aql/aql-view-arangosearch-ddl-cluster.js b/js/common/tests/aql/aql-view-arangosearch-ddl-cluster.js index b43ceac3b0..298121d8bd 100644 --- a/js/common/tests/aql/aql-view-arangosearch-ddl-cluster.js +++ b/js/common/tests/aql/aql-view-arangosearch-ddl-cluster.js @@ -680,6 +680,31 @@ function IResearchFeatureDDLTestSuite () { assertEqual(300, properties.commit.consolidate.count.segmentThreshold); assertEqual((0.85).toFixed(6), properties.commit.consolidate.count.threshold.toFixed(6)); assertEqual("de_DE.UTF-8", properties.locale); + + view.properties({}, false); // full update (reset to defaults) + result = db._query("FOR doc IN VIEW TestView SORT doc.name RETURN doc", null, { waitForSync: true }).toArray(); + assertEqual(0, result.length); + properties = view.properties(); + assertTrue(Object === properties.commit.constructor); + assertEqual(10, properties.commit.cleanupIntervalStep); + assertEqual(60000, properties.commit.commitIntervalMsec); + assertTrue(Object === properties.commit.consolidate.constructor); + assertEqual(4, Object.keys(properties.commit.consolidate).length); + assertTrue(Object === properties.commit.consolidate.bytes.constructor); + assertEqual(300, properties.commit.consolidate.bytes.segmentThreshold); + assertEqual((0.85).toFixed(6), properties.commit.consolidate.bytes.threshold.toFixed(6)); + assertTrue(Object === properties.commit.consolidate.bytes_accum.constructor); + assertEqual(300, properties.commit.consolidate.bytes_accum.segmentThreshold); + assertEqual((0.85).toFixed(6), properties.commit.consolidate.bytes_accum.threshold.toFixed(6)); + assertTrue(Object === properties.commit.consolidate.count.constructor); + assertEqual(300, properties.commit.consolidate.count.segmentThreshold); + assertEqual((0.85).toFixed(6), properties.commit.consolidate.count.threshold.toFixed(6)); + assertTrue(Object === properties.commit.consolidate.fill.constructor); + assertEqual(300, properties.commit.consolidate.fill.segmentThreshold); + assertEqual((0.85).toFixed(6), properties.commit.consolidate.fill.threshold.toFixed(6)); + assertEqual("C", properties.locale); + assertTrue(Object === properties.links.constructor); + assertEqual(0, Object.keys(properties.links).length); }, testLinkModify: function() { diff --git a/js/common/tests/aql/aql-view-arangosearch-ddl-noncluster.js b/js/common/tests/aql/aql-view-arangosearch-ddl-noncluster.js index 57d27077bf..aa8a7de4b5 100644 --- a/js/common/tests/aql/aql-view-arangosearch-ddl-noncluster.js +++ b/js/common/tests/aql/aql-view-arangosearch-ddl-noncluster.js @@ -600,6 +600,31 @@ function iResearchFeatureAqlTestSuite () { assertEqual(300, properties.commit.consolidate.count.segmentThreshold); assertEqual((0.85).toFixed(6), properties.commit.consolidate.count.threshold.toFixed(6)); assertEqual("de_DE.UTF-8", properties.locale); + + view.properties({}, false); // full update (reset to defaults) + result = db._query("FOR doc IN VIEW TestView SORT doc.name RETURN doc", null, { waitForSync: true }).toArray(); + assertEqual(0, result.length); + properties = view.properties(); + assertTrue(Object === properties.commit.constructor); + assertEqual(10, properties.commit.cleanupIntervalStep); + assertEqual(60000, properties.commit.commitIntervalMsec); + assertTrue(Object === properties.commit.consolidate.constructor); + assertEqual(4, Object.keys(properties.commit.consolidate).length); + assertTrue(Object === properties.commit.consolidate.bytes.constructor); + assertEqual(300, properties.commit.consolidate.bytes.segmentThreshold); + assertEqual((0.85).toFixed(6), properties.commit.consolidate.bytes.threshold.toFixed(6)); + assertTrue(Object === properties.commit.consolidate.bytes_accum.constructor); + assertEqual(300, properties.commit.consolidate.bytes_accum.segmentThreshold); + assertEqual((0.85).toFixed(6), properties.commit.consolidate.bytes_accum.threshold.toFixed(6)); + assertTrue(Object === properties.commit.consolidate.count.constructor); + assertEqual(300, properties.commit.consolidate.count.segmentThreshold); + assertEqual((0.85).toFixed(6), properties.commit.consolidate.count.threshold.toFixed(6)); + assertTrue(Object === properties.commit.consolidate.fill.constructor); + assertEqual(300, properties.commit.consolidate.fill.segmentThreshold); + assertEqual((0.85).toFixed(6), properties.commit.consolidate.fill.threshold.toFixed(6)); + assertEqual("C", properties.locale); + assertTrue(Object === properties.links.constructor); + assertEqual(0, Object.keys(properties.links).length); }, testLinkModify: function() {