8000 Broken client API and server default was wrong (#3748) · Kitter/arangodb@ce537af · GitHub
[go: up one dir, main page]

Skip to content

Commit ce537af

Browse files
m0ppersjsteemann
authored andcommitted
Broken client API and server default was wrong (arangodb#3748)
1 parent ecb18df commit ce537af

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

js/client/modules/@arangodb/arango-database.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,11 @@ ArangoDatabase.prototype._create = function (name, properties, type, options) {
356356
}
357357
});
358358
}
359+
360+
if (typeof type === 'object') {
361+
options = type;
362+
type = undefined;
363+
}
359364

360365
let urlAddons = [];
361366
if (typeof options === "object" && options !== null) {

js/common/tests/shell/shell-cluster-collection.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,7 @@ function ClusterCollectionSuite () {
374374
/// @brief test create
375375
////////////////////////////////////////////////////////////////////////////////
376376

377-
testCreateInsufficientDBServers : function () {
378-
377+
testCreateInsufficientDBServersDefault : function () {
379378
try {
380379
db._create("bigreplication", {replicationFactor: 8});
381380
fail();
@@ -386,6 +385,32 @@ function ClusterCollectionSuite () {
386385
db._drop('bigreplication');
387386
},
388387

388+
////////////////////////////////////////////////////////////////////////////////
389+
/// @brief test create
390+
////////////////////////////////////////////////////////////////////////////////
391+
392+
testCreateInsufficientDBServersIgnoreReplicationFactor : function () {
393+
// should not throw (just a warning)
394+
db._create("bigreplication", {replicationFactor: 8}, {enforceReplicationFactor: false});
395+
db._drop('bigreplication');
396+
},
397+
398+
399+
////////////////////////////////////////////////////////////////////////////////
400+
/// @brief test create
401+
////////////////////////////////////////////////////////////////////////////////
402+
403+
testCreateInsufficientDBServersEnforceReplicationFactor : function () {
404+
try {
405+
db._create("bigreplication", {replicationFactor: 8}, {enforceReplicationFactor: true});
406+
fail();
407+
}
408+
catch (err) {
409+
assertEqual(ERRORS.ERROR_CLUSTER_INSUFFICIENT_DBSERVERS.code, err.errorNum);
410+
}
411+
db._drop('bigreplication');
412+
},
413+
389414
////////////////////////////////////////////////////////////////////////////////
390415
/// @brief test creation / deleting of documents with replication set
391416
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)
0