Skip to content

PHPLIB-1132: Sync unified spec tests for revised runOnRequirements #1065

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 3 commits into from
May 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions tests/UnifiedSpecTests/UnifiedSpecTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,17 @@ public function provideLoadBalancers()
return $this->provideTests(__DIR__ . '/load-balancers/*.json');
}

/** @dataProvider provideRetryableWritesTests */
public function testRetryableWrites(UnifiedTestCase $test): void
{
self::$runner->run($test);
}

public function provideRetryableWritesTests()
{
return $this->provideTests(__DIR__ . '/retryable-writes/*.json');
}

/** @dataProvider provideRunCommandTests */
public function testRunCommand(UnifiedTestCase $test): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"minServerVersion": "4.0.0",
"topologies": [
"replicaset",
"sharded-replicaset",
"load-balanced",
"sharded"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"minServerVersion": "6.1.0",
"topologies": [
"replicaset",
"sharded-replicaset",
"load-balanced",
"sharded"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
"minServerVersion": "4.1.11",
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded",
"load-balanced"
]
}
Expand Down Expand Up @@ -190,7 +190,7 @@
"minServerVersion": "4.2",
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded",
"load-balanced"
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"minServerVersion": "6.0.0",
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded",
"load-balanced"
],
"serverless": "forbid"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"minServerVersion": "3.6",
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded",
"load-balanced"
],
"serverless": "forbid"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"minServerVersion": "4.3.1",
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded",
"load-balanced"
],
"serverless": "forbid"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"minServerVersion": "6.0.0",
"topologies": [
"replicaset",
"sharded-replicaset",
"sharded"
],
"serverless": "forbid"
Expand Down Expand Up @@ -463,7 +462,6 @@
"runOnRequirements": [
{
"topologies": [
"sharded-replicaset",
"sharded"
]
}
Expand Down
205 changes: 205 additions & 0 deletions tests/UnifiedSpecTests/retryable-writes/bulkWrite-serverErrors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
{
"description": "retryable-writes bulkWrite serverErrors",
"schemaVersion": "1.0",
"runOnRequirements": [
{
"minServerVersion": "3.6",
"topologies": [
"replicaset"
]
}
],
"createEntities": [
{
"client": {
"id": "client0",
"useMultipleMongoses": false,
"observeEvents": [
"commandStartedEvent"
]
}
},
{
"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": "BulkWrite succeeds after retryable writeConcernError in first batch",
"runOnRequirements": [
{
"minServerVersion": "4.0",
"topologies": [
"replicaset"
]
},
{
"minServerVersion": "4.1.7",
"topologies": [
"sharded"
]
}
],
"operations": [
{
"name": "failPoint",
"object": "testRunner",
"arguments": {
"client": "client0",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"insert"
],
"errorLabels": [
"RetryableWriteError"
],
"writeConcernError": {
"code": 91,
"errmsg": "Replication is being shut down"
}
}
}
}
},
{
"name": "bulkWrite",
"object": "collection0",
"arguments": {
"requests": [
{
"insertOne": {
"document": {
"_id": 3,
"x": 33
}
}
},
{
"deleteOne": {
"filter": {
"_id": 2
}
}
}
]
},
"expectResult": {
"deletedCount": 1,
"insertedCount": 1,
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0,
"insertedIds": {
"$$unsetOrMatches": {
"0": 3
}
},
"upsertedIds": {}
}
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"insert": "coll",
"documents": [
{
"_id": 3,
"x": 33
}
]
},
"commandName": "insert",
"databaseName": "retryable-writes-tests"
}
},
{
"commandStartedEvent": {
"command": {
"insert": "coll",
"documents": [
{
"_id": 3,
"x": 33
}
]
},
"commandName": "insert",
"databaseName": "retryable-writes-tests"
}
},
{
"commandStartedEvent": {
"command": {
"delete": "coll",
"deletes": [
{
"q": {
"_id": 2
},
"limit": 1
}
]
},
"commandName": "delete",
"databaseName": "retryable-writes-tests"
}
}
]
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "retryable-writes-tests",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 3,
"x": 33
}
]
}
]
}
]
}
Loading