10000 validation: AQL functions by ObiWahn · Pull Request #11327 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

validation: AQL functions #11327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve tests.
  • Loading branch information
ObiWahn committed Mar 31, 2020
commit 2b6d11acf7791740e836b76559842b326a14a498
2 changes: 1 addition & 1 deletion arangod/Aql/Functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7515,7 +7515,7 @@ AqlValue Functions::NotImplemented(ExpressionContext* expressionContext,
AqlValue Functions::GetSchema(ExpressionContext* expressionContext,
transaction::Methods* trx,
VPackFunctionParameters const& parameters) {
// GET_VALIDATON("collectionName")
// GET_VALIDATON(collectionName)
static char const* AFN = "GET_SCHEMA";

if (parameters.size() != 1) {
Expand Down
22 changes: 15 additions & 7 deletions tests/js/common/shell/shell-validation-rocksdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,12 @@ function ValidationBasicsSuite () {
}

},

testRemoveValidation: () => {
testCollection.properties({"validation" : { } });
sleepInCluster();
},

// json ////////////////////////////////////////////////////////////////////////////////////////////
testJson: () => {
const v = validatorJson;
Expand Down Expand Up @@ -361,7 +367,7 @@ function ValidationBasicsSuite () {

},
// AQL ////////////////////////////////////////////////////////////////////////////////////////////
testGET_SCHEMA: () => {
test_GET_SCHEMA: () => {
const v = validatorJson;
v.level = "strict";
testCollection.properties({"validation" : v });
Expand All @@ -372,27 +378,29 @@ function ValidationBasicsSuite () {
// get regular schema
res = db._query(`RETURN GET_SCHEMA("${testCollectionName}")`).toArray();
assertEqual(res[0], v.rule);
},

test_GET_SCHEMA_no_collection: () => {
// schema on non existing collection
try {
db._query(`RETURN GET_SCHEMA("nonExistingTestCollection")`).toArray();
fail();
} catch (err) {
assertEqual(ERRORS.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND.code, err.errorNum);
}
},

test_GET_SCHEMA_null: () => {
// no validation available must return `null`
testCollection.drop();
db._create(testCollectionName);
res = db._query(`RETURN GET_SCHEMA("${testCollectionName}")`).toArray();
testCollection.properties({validation : {}});
let res = db._query(`RETURN GET_SCHEMA("${testCollectionName}")`).toArray();
assertEqual(res[0], null);
},

testSCHEMA_VALIDATE: () => {
test_SCHEMA_VALIDATE: () => {
const v = validatorJson;
// unset validation
// FIXME - just pass empty object (PR 11346)
testCollection.properties({"validation" : { rule:{} } });
testCollection.properties({validation : {}});
sleepInCluster();

let res;
Expand Down
0