{ "description": "replaceOne-errorLabels", "schemaVersion": "1.3", "runOnRequirements": [ { "minServerVersion": "4.3.1", "topologies": [ "replicaset", "sharded", "load-balanced" ] } ], "createEntities": [ { "client": { "id": "client0", "useMultipleMongoses": false } }, { "database": { "id": "database0", "client": "client0", "databaseName": "retryable-writes-tests" } }, { "collection": { "id": "collection0", "database": "database0", "collectionName": "coll" } } ], "initialData": [ { "collectionName": "coll", "databaseName": "retryable-writes-tests", "documents": [ { "_id": 1, "x": 11 }, { "_id": 2, "x": 22 } ] } ], "tests": [ { "description": "ReplaceOne succeeds with RetryableWriteError from server", "operations": [ { "name": "failPoint", "object": "testRunner", "arguments": { "client": "client0", "failPoint": { "configureFailPoint": "failCommand", "mode": { "times": 1 }, "data": { "failCommands": [ "update" ], "errorCode": 112, "errorLabels": [ "RetryableWriteError" ] } } } }, { "object": "collection0", "name": "replaceOne", "arguments": { "filter": { "_id": 1 }, "replacement": { "_id": 1, "x": 111 } }, "expectResult": { "matchedCount": 1, "modifiedCount": 1, "upsertedCount": 0 } } ], "outcome": [ { "collectionName": "coll", "databaseName": "retryable-writes-tests", "documents": [ { "_id": 1, "x": 111 }, { "_id": 2, "x": 22 } ] } ] }, { "description": "ReplaceOne fails if server does not return RetryableWriteError", "operations": [ { "name": "failPoint", "object": "testRunner", "arguments": { "client": "client0", "failPoint": { "configureFailPoint": "failCommand", "mode": { "times": 1 }, "data": { "failCommands": [ "update" ], "errorCode": 11600, "errorLabels": [] } } } }, { "object": "collection0", "name": "replaceOne", "arguments": { "filter": { "_id": 1 }, "replacement": { "_id": 1, "x": 111 } }, "expectError": { "isError": true, "errorLabelsOmit": [ "RetryableWriteError" ] } } ], "outcome": [ { "collectionName": "coll", "databaseName": "retryable-writes-tests", "documents": [ { "_id": 1, "x": 11 }, { "_id": 2, "x": 22 } ] } ] }, { "description": "ReplaceOne succeeds after PrimarySteppedDown", "operations": [ { "name": "failPoint", "object": "testRunner", "arguments": { "client": "client0", "failPoint": { "configureFailPoint": "failCommand", "mode": { "times": 1 }, "data": { "failCommands": [ "update" ], "errorCode": 189, "errorLabels": [ "RetryableWriteError" ] } } } }, { "object": "collection0", "name": "replaceOne", "arguments": { "filter": { "_id": 1 }, "replacement": { "_id": 1, "x": 111 } }, "expectResult": { "matchedCount": 1, "modifiedCount": 1, "upsertedCount": 0 } } ], "outcome": [ { "collectionName": "coll", "databaseName": "retryable-writes-tests", "documents": [ { "_id": 1, "x": 111 }, { "_id": 2, "x": 22 } ] } ] }, { "description": "ReplaceOne succeeds after WriteConcernError ShutdownInProgress", "operations": [ { "name": "failPoint", "object": "testRunner", "arguments": { "client": "client0", "failPoint": { "configureFailPoint": "failCommand", "mode": { "times": 1 }, "data": { "failCommands": [ "update" ], "errorLabels": [ "RetryableWriteError" ], "writeConcernError": { "code": 91, "errmsg": "Replication is being shut down" } } } } }, { "object": "collection0", "name": "replaceOne", "arguments": { "filter": { "_id": 1 }, "replacement": { "_id": 1, "x": 111 } }, "expectResult": { "matchedCount": 1, "modifiedCount": 1, "upsertedCount": 0 } } ], "outcome": [ { "collectionName": "coll", "databaseName": "retryable-writes-tests", "documents": [ { "_id": 1, "x": 111 }, { "_id": 2, "x": 22 } ] } ] } ] }