diff options
author | David Golden <david.golden@mongodb.com> | 2019-09-10 01:08:02 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-09-10 01:08:02 +0000 |
commit | af71c266dae464807509962e6f12d5f2d9a61f73 (patch) | |
tree | a620a0193187a18445ad9aa1d8f4b6680e8a7034 /src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/go.mongodb.org/mongo-driver/data/command-monitoring | |
parent | 492a2cfcbc915efa8900b5a6a36a44ac83813b3e (diff) | |
download | mongo-af71c266dae464807509962e6f12d5f2d9a61f73.tar.gz |
Import tools: 57a9d511b40add1c87d7d9b1cc8ab116275ac7c4 from branch master
ref: f6fdd97dbe..57a9d511b4
for: 4.3.1
TOOLS-1602 mongoimport --columnsHaveTypes takes boolean() but documents bool()
TOOLS-1806 Don't include default values in option descriptions since they are echoed by default
TOOLS-2315 Change "jsonFormat" member to be public
TOOLS-2349 Use `EstimatedDocumentCount` instead `CountDocuments` for progress bar render
TOOLS-2350 Write location not correctly set
TOOLS-2357 Non-transaction op processed as transaction op
TOOLS-2361 Upgrade to Go driver 1.1.1
Diffstat (limited to 'src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/go.mongodb.org/mongo-driver/data/command-monitoring')
4 files changed, 129 insertions, 8 deletions
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/go.mongodb.org/mongo-driver/data/command-monitoring/README.rst b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/go.mongodb.org/mongo-driver/data/command-monitoring/README.rst new file mode 100644 index 00000000000..9f0562364ad --- /dev/null +++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/go.mongodb.org/mongo-driver/data/command-monitoring/README.rst @@ -0,0 +1,128 @@ +.. role:: javascript(code) + :language: javascript + +================== +Command Monitoring +================== + +.. contents:: + +-------- + +Testing +======= + +Tests are provided in YML and JSON format to assert proper upconversion of commands. + +Database and Collection Names +----------------------------- + +The collection under test is specified in each test file with the fields +``database_name`` and ``collection_name``. + +Data +---- + +The ``data`` at the beginning of each test file is the data that should exist in the +collection under test before each test run. + +Expectations +------------ + +Fake Placeholder Values +``````````````````````` + +When an attribute in an expectation contains the value ``"42"``, ``42`` or ``""``, this is a fake +placeholder value indicating that a special case MUST be tested that could not be +expressed in a YAML or JSON test. These cases are as follows: + +Cursor Matching +^^^^^^^^^^^^^^^ + +When encountering a ``cursor`` or ``getMore`` value of ``"42"`` in a test, the driver MUST assert +that the values are equal to each other and greater than zero. + +Errors +^^^^^^ + +For write errors, ``code`` values of ``42`` MUST assert that the value is present and +greater than zero. ``errmsg`` values of ``""`` MUST assert that the value is not empty +(a string of length greater than 1). + +OK Values +^^^^^^^^^ + +The server is inconsistent on whether the ok values returned are integers or doubles so +for simplicity the tests specify all expected values as doubles. Server 'ok' values of +integers MUST be converted to doubles for comparison with the expected values. + +Additional Values +````````````````` + +The expected events provide the minimum data that is required and can be tested. It is +possible for more values to be present in the events, such as extra data provided when +using sharded clusters or ``nModified`` field in updates. The driver MUST assert the +expected data is present and also MUST allow for additional data to be present as well +at the top level of the command document or reply document. + +For example, say the client sends a causally-consistent "distinct" command with +readConcern level "majority", like:: + + { + "distinct": "collection", + "key": "key", + "readConcern":{ + "afterClusterTime": {"$timestamp":{"t":1522336030,"i":1}}, + "level":"majority" + }, + "$clusterTime": { + "clusterTime": { "$timestamp": { "i": 1, "t": 1522335530 } }, + "signature": { + "hash": { "$binary": "AAAAAAAAAAAAAAAAAAAAAAAAAAA=", "$type": "00" }, + "keyId": { "$numberLong": "0" } + } + }, + "lsid": { + "id": { "$binary": "RaigP3oASqu+galPvRAfcg==", "$type": "04" } + } + } + +Then it would pass a command-started event like the following YAML, because the +fields not mentioned in the YAML are ignored:: + + command: + distinct: collection + key: key + +However, if there are fields in command subdocuments that are not mentioned in +the YAML, then the command does *not* pass the test:: + + command: + distinct: collection + key: key + # Fails because the expected readConcern has no "afterClusterTime". + readConcern: + level: majority + +Ignoring Tests Based On Server Version or Topology Type +``````````````````````````````````````````````````````` + +Due to variations in server behavior, some tests may not be valid and MUST NOT be run on +certain server versions or topology types. These tests are indicated with any of the +following fields, which will be optionally provided at the ``description`` level of each +test: + +- ``ignore_if_server_version_greater_than`` (optional): If specified, the test MUST be + skipped if the minor version of the server is greater than this minor version. The + server's patch version MUST NOT be considered. For example, a value of ``3.0`` implies + that the test can run on server version ``3.0.15`` but not ``3.1.0``. + +- ``ignore_if_server_version_less_than`` (optional): If specified, the test MUST be + skipped if the minor version of the server is less than this minor version. The + server's patch version MUST NOT be considered. For example, a value of ``3.2`` implies + that the test can run on server version ``3.2.0`` but not ``3.0.15``. + +- ``ignore_if_topology_type`` (optional): An array of server topologies for which the test + MUST be skipped. Valid topologies are "single", "replicaset", and "sharded". + +Tests that have none of these fields MUST be run on all supported server versions. diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/go.mongodb.org/mongo-driver/data/command-monitoring/bulkWrite.yml b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/go.mongodb.org/mongo-driver/data/command-monitoring/bulkWrite.yml index eec361d0a37..b2e4a1b9a47 100644 --- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/go.mongodb.org/mongo-driver/data/command-monitoring/bulkWrite.yml +++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/go.mongodb.org/mongo-driver/data/command-monitoring/bulkWrite.yml @@ -39,7 +39,7 @@ tests: command: update: *collection_name updates: - - { q: {_id: 3 }, u: { $set: { x: 333 } }, upsert: false, multi: false } + - { q: {_id: 3 }, u: { $set: { x: 333 } } } ordered: true command_name: "update" database_name: *database_name diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/go.mongodb.org/mongo-driver/data/command-monitoring/updateMany.yml b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/go.mongodb.org/mongo-driver/data/command-monitoring/updateMany.yml index c09602ce365..8e1a90677f9 100644 --- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/go.mongodb.org/mongo-driver/data/command-monitoring/updateMany.yml +++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/go.mongodb.org/mongo-driver/data/command-monitoring/updateMany.yml @@ -27,7 +27,6 @@ tests: q: { _id: { $gt: 1 }} u: { $inc: { x: 1 }} multi: true - upsert: false command_name: "update" database_name: *database_name - @@ -54,7 +53,6 @@ tests: q: { _id: { $gt: 1 }} u: { $nothing: { x: 1 }} multi: true - upsert: false command_name: "update" database_name: *database_name - diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/go.mongodb.org/mongo-driver/data/command-monitoring/updateOne.yml b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/go.mongodb.org/mongo-driver/data/command-monitoring/updateOne.yml index d9fe28921f3..70a1ae1bbb5 100644 --- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/go.mongodb.org/mongo-driver/data/command-monitoring/updateOne.yml +++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/go.mongodb.org/mongo-driver/data/command-monitoring/updateOne.yml @@ -26,8 +26,6 @@ tests: - q: { _id: { $gt: 1 }} u: { $inc: { x: 1 }} - multi: false - upsert: false command_name: "update" database_name: *database_name - @@ -54,7 +52,6 @@ tests: - q: { _id: 4 } u: { $inc: { x: 1 } } - multi: false upsert: true command_name: "update" database_name: *database_name @@ -81,8 +78,6 @@ tests: - q: { _id: { $gt: 1 }} u: { $nothing: { x: 1 }} - multi: false - upsert: false command_name: "update" database_name: *database_name - |