diff options
author | James Wahlin <james.wahlin@10gen.com> | 2017-04-11 10:12:56 -0400 |
---|---|---|
committer | James Wahlin <james.wahlin@10gen.com> | 2017-04-12 17:00:45 -0400 |
commit | b5e2615f9cf29942783ed554afeb364052dd83a4 (patch) | |
tree | 1deb75898a9f170ddc3ea482d829dbbfa0064287 /jstests | |
parent | 2788b12816f9124cae6b35a0554361b232c27419 (diff) | |
download | mongo-b5e2615f9cf29942783ed554afeb364052dd83a4.tar.gz |
SERVER-28271 Improve handling of invalid view pipeline defs
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/core/views/invalid_system_views.js | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/jstests/core/views/invalid_system_views.js b/jstests/core/views/invalid_system_views.js index b4610198f48..170c0131251 100644 --- a/jstests/core/views/invalid_system_views.js +++ b/jstests/core/views/invalid_system_views.js @@ -106,15 +106,27 @@ assert.writeOK(viewsDB.system.views.remove(badViewDefinition)); } - let badViews = [ - {_id: "badViewStringPipeline", pipeline: "bad"}, - {_id: "badViewEmptyObjectPipeline", pipeline: {}}, - {_id: "badViewNumericalPipeline", pipeline: 7}, - {_id: "badViewArrayWithIntegerPipeline", pipeline: [1]}, - {_id: "badViewArrayWithEmptyObjectPipeline", pipeline: [{}]}, - {_id: "badViewArrayWithEmptyArrayPipeline", pipeline: [[]]}, - {_id: 7, pipeline: []}, - {_id: "invalid_system_views.embedded\0null", viewOn: "collection", pipeline: []} - ]; - badViews.forEach(runTest); + runTest( + {_id: "invalid_system_views.badViewStringPipeline", viewOn: "collection", pipeline: "bad"}); + runTest({ + _id: "invalid_system_views.badViewEmptyObjectPipeline", + viewOn: "collection", + pipeline: {} + }); + runTest( + {_id: "invalid_system_views.badViewNumericalPipeline", viewOn: "collection", pipeline: 7}); + runTest({ + _id: "invalid_system_views.badViewArrayWithIntegerPipeline", + viewOn: "collection", + pipeline: [1] + }); + runTest({ + _id: "invalid_system_views.badViewArrayWithEmptyArrayPipeline", + viewOn: "collection", + pipeline: [[]] + }); + runTest({_id: 7, viewOn: "collection", pipeline: []}); + runTest({_id: "invalid_system_views.embedded\0null", viewOn: "collection", pipeline: []}); + runTest({_id: "invalidNotFullyQualifiedNs", viewOn: "collection", pipeline: []}); + runTest({_id: "invalid_system_views.missingViewOnField", pipeline: []}); }()); |