diff --git a/.evergreen/config/generated/build/build-php-7.4.yml b/.evergreen/config/generated/build/build-php-7.4.yml index 713be9d40..f9ea50615 100644 --- a/.evergreen/config/generated/build/build-php-7.4.yml +++ b/.evergreen/config/generated/build/build-php-7.4.yml @@ -7,6 +7,9 @@ tasks: vars: PHP_VERSION: "7.4" - func: "compile extension" + vars: + # TODO: remove this 1.18.0 is released + EXTENSION_BRANCH: "master" - func: "upload extension" - name: "build-php-7.4-lowest" tags: ["build", "php7.4", "lowest"] @@ -16,7 +19,9 @@ tasks: PHP_VERSION: "7.4" - func: "compile extension" vars: - EXTENSION_VERSION: "1.17.0" + # TODO: change to "1.18.0" once 1.18.0 is released + # EXTENSION_VERSION: "1.18.0" + EXTENSION_BRANCH: "master" - func: "upload extension" - name: "build-php-7.4-next-stable" tags: ["build", "php7.4", "next-stable"] @@ -26,7 +31,9 @@ tasks: PHP_VERSION: "7.4" - func: "compile extension" vars: - EXTENSION_BRANCH: "v1.17" + # TODO: change to "v1.18" once 1.18.0 is released + # EXTENSION_VERSION: "v1.18" + EXTENSION_BRANCH: "master" - func: "upload extension" - name: "build-php-7.4-next-minor" tags: ["build", "php7.4", "next-minor"] diff --git a/.evergreen/config/generated/build/build-php-8.0.yml b/.evergreen/config/generated/build/build-php-8.0.yml index c69691a59..9b971466c 100644 --- a/.evergreen/config/generated/build/build-php-8.0.yml +++ b/.evergreen/config/generated/build/build-php-8.0.yml @@ -7,6 +7,9 @@ tasks: vars: PHP_VERSION: "8.0" - func: "compile extension" + vars: + # TODO: remove this 1.18.0 is released + EXTENSION_BRANCH: "master" - func: "upload extension" - name: "build-php-8.0-lowest" tags: ["build", "php8.0", "lowest"] @@ -16,7 +19,9 @@ tasks: PHP_VERSION: "8.0" - func: "compile extension" vars: - EXTENSION_VERSION: "1.17.0" + # TODO: change to "1.18.0" once 1.18.0 is released + # EXTENSION_VERSION: "1.18.0" + EXTENSION_BRANCH: "master" - func: "upload extension" - name: "build-php-8.0-next-stable" tags: ["build", "php8.0", "next-stable"] @@ -26,7 +31,9 @@ tasks: PHP_VERSION: "8.0" - func: "compile extension" vars: - EXTENSION_BRANCH: "v1.17" + # TODO: change to "v1.18" once 1.18.0 is released + # EXTENSION_VERSION: "v1.18" + EXTENSION_BRANCH: "master" - func: "upload extension" - name: "build-php-8.0-next-minor" tags: ["build", "php8.0", "next-minor"] diff --git a/.evergreen/config/generated/build/build-php-8.1.yml b/.evergreen/config/generated/build/build-php-8.1.yml index 42e2bdbcc..d0eeb3350 100644 --- a/.evergreen/config/generated/build/build-php-8.1.yml +++ b/.evergreen/config/generated/build/build-php-8.1.yml @@ -7,6 +7,9 @@ tasks: vars: PHP_VERSION: "8.1" - func: "compile extension" + vars: + # TODO: remove this 1.18.0 is released + EXTENSION_BRANCH: "master" - func: "upload extension" - name: "build-php-8.1-lowest" tags: ["build", "php8.1", "lowest"] @@ -16,7 +19,9 @@ tasks: PHP_VERSION: "8.1" - func: "compile extension" vars: - EXTENSION_VERSION: "1.17.0" + # TODO: change to "1.18.0" once 1.18.0 is released + # EXTENSION_VERSION: "1.18.0" + EXTENSION_BRANCH: "master" - func: "upload extension" - name: "build-php-8.1-next-stable" tags: ["build", "php8.1", "next-stable"] @@ -26,7 +31,9 @@ tasks: PHP_VERSION: "8.1" - func: "compile extension" vars: - EXTENSION_BRANCH: "v1.17" + # TODO: change to "v1.18" once 1.18.0 is released + # EXTENSION_VERSION: "v1.18" + EXTENSION_BRANCH: "master" - func: "upload extension" - name: "build-php-8.1-next-minor" tags: ["build", "php8.1", "next-minor"] diff --git a/.evergreen/config/generated/build/build-php-8.2.yml b/.evergreen/config/generated/build/build-php-8.2.yml index 756245940..1c18dc746 100644 --- a/.evergreen/config/generated/build/build-php-8.2.yml +++ b/.evergreen/config/generated/build/build-php-8.2.yml @@ -7,6 +7,9 @@ tasks: vars: PHP_VERSION: "8.2" - func: "compile extension" + vars: + # TODO: remove this 1.18.0 is released + EXTENSION_BRANCH: "master" - func: "upload extension" - name: "build-php-8.2-lowest" tags: ["build", "php8.2", "lowest"] @@ -16,7 +19,9 @@ tasks: PHP_VERSION: "8.2" - func: "compile extension" vars: - EXTENSION_VERSION: "1.17.0" + # TODO: change to "1.18.0" once 1.18.0 is released + # EXTENSION_VERSION: "1.18.0" + EXTENSION_BRANCH: "master" - func: "upload extension" - name: "build-php-8.2-next-stable" tags: ["build", "php8.2", "next-stable"] @@ -26,7 +31,9 @@ tasks: PHP_VERSION: "8.2" - func: "compile extension" vars: - EXTENSION_BRANCH: "v1.17" + # TODO: change to "v1.18" once 1.18.0 is released + # EXTENSION_VERSION: "v1.18" + EXTENSION_BRANCH: "master" - func: "upload extension" - name: "build-php-8.2-next-minor" tags: ["build", "php8.2", "next-minor"] diff --git a/.evergreen/config/generated/build/build-php-8.3.yml b/.evergreen/config/generated/build/build-php-8.3.yml index 1be1779fe..108a0983b 100644 --- a/.evergreen/config/generated/build/build-php-8.3.yml +++ b/.evergreen/config/generated/build/build-php-8.3.yml @@ -7,6 +7,9 @@ tasks: vars: PHP_VERSION: "8.3" - func: "compile extension" + vars: + # TODO: remove this 1.18.0 is released + EXTENSION_BRANCH: "master" - func: "upload extension" - name: "build-php-8.3-lowest" tags: ["build", "php8.3", "lowest"] @@ -16,7 +19,9 @@ tasks: PHP_VERSION: "8.3" - func: "compile extension" vars: - EXTENSION_VERSION: "1.17.0" + # TODO: change to "1.18.0" once 1.18.0 is released + # EXTENSION_VERSION: "1.18.0" + EXTENSION_BRANCH: "master" - func: "upload extension" - name: "build-php-8.3-next-stable" tags: ["build", "php8.3", "next-stable"] @@ -26,7 +31,9 @@ tasks: PHP_VERSION: "8.3" - func: "compile extension" vars: - EXTENSION_BRANCH: "v1.17" + # TODO: change to "v1.18" once 1.18.0 is released + # EXTENSION_VERSION: "v1.18" + EXTENSION_BRANCH: "master" - func: "upload extension" - name: "build-php-8.3-next-minor" tags: ["build", "php8.3", "next-minor"] diff --git a/.evergreen/config/templates/build/build-extension.yml b/.evergreen/config/templates/build/build-extension.yml index 04946be87..140b0a5d0 100644 --- a/.evergreen/config/templates/build/build-extension.yml +++ b/.evergreen/config/templates/build/build-extension.yml @@ -6,6 +6,9 @@ tasks: vars: PHP_VERSION: "%phpVersion%" - func: "compile extension" + vars: + # TODO: remove this 1.18.0 is released + EXTENSION_BRANCH: "master" - func: "upload extension" - name: "build-php-%phpVersion%-lowest" tags: ["build", "php%phpVersion%", "lowest"] @@ -15,7 +18,9 @@ tasks: PHP_VERSION: "%phpVersion%" - func: "compile extension" vars: - EXTENSION_VERSION: "1.17.0" + # TODO: change to "1.18.0" once 1.18.0 is released + # EXTENSION_VERSION: "1.18.0" + EXTENSION_BRANCH: "master" - func: "upload extension" - name: "build-php-%phpVersion%-next-stable" tags: ["build", "php%phpVersion%", "next-stable"] @@ -25,7 +30,9 @@ tasks: PHP_VERSION: "%phpVersion%" - func: "compile extension" vars: - EXTENSION_BRANCH: "v1.17" + # TODO: change to "v1.18" once 1.18.0 is released + # EXTENSION_VERSION: "v1.18" + EXTENSION_BRANCH: "master" - func: "upload extension" - name: "build-php-%phpVersion%-next-minor" tags: ["build", "php%phpVersion%", "next-minor"] diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 97fa36a33..e49ca886d 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -19,7 +19,9 @@ on: env: PHP_VERSION: "8.2" - DRIVER_VERSION: "stable" + # TODO: change to "stable" once 1.18.0 is released + # DRIVER_VERSION: "stable" + DRIVER_VERSION: "mongodb/mongo-php-driver@master" jobs: phpcs: diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 320804bd3..a321cce1e 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -19,7 +19,9 @@ on: env: PHP_VERSION: "8.2" - DRIVER_VERSION: "stable" + # TODO: change to "stable" once 1.18.0 is released + # DRIVER_VERSION: "stable" + DRIVER_VERSION: "mongodb/mongo-php-driver@master" jobs: psalm: @@ -35,7 +37,7 @@ jobs: uses: shivammathur/cache-extensions@v1 with: php-version: ${{ env.PHP_VERSION }} - extensions: "mongodb-${{ ENV.DRIVER_VERSION }}" + extensions: "mongodb-${{ env.DRIVER_VERSION }}" key: "extcache-v1" - name: Cache extensions @@ -49,7 +51,7 @@ jobs: uses: "shivammathur/setup-php@v2" with: coverage: "none" - extensions: "mongodb-${{ ENV.DRIVER_VERSION }}" + extensions: "mongodb-${{ env.DRIVER_VERSION }}" php-version: "${{ env.PHP_VERSION }}" tools: "cs2pr" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fbeae4576..3b36b457b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,6 +17,11 @@ on: paths-ignore: - "docs/**" +env: + # TODO: change to "stable" once 1.18.0 is released + # DRIVER_VERSION: "stable" + DRIVER_VERSION: "mongodb/mongo-php-driver@master" + jobs: phpunit: name: "PHPUnit tests" @@ -36,34 +41,34 @@ jobs: mongodb-version: - "4.4" driver-version: - - "stable" + - "${{ env.DRIVER_VERSION }}" topology: - "server" include: - os: "ubuntu-20.04" php-version: "8.0" mongodb-version: "6.0" - driver-version: "stable" + driver-version: "${{ env.DRIVER_VERSION }}" topology: "replica_set" - os: "ubuntu-20.04" php-version: "8.0" mongodb-version: "6.0" - driver-version: "stable" + driver-version: "${{ env.DRIVER_VERSION }}" topology: "sharded_cluster" - os: "ubuntu-20.04" php-version: "8.0" mongodb-version: "5.0" - driver-version: "stable" + driver-version: "${{ env.DRIVER_VERSION }}" topology: "server" - os: "ubuntu-20.04" php-version: "8.0" mongodb-version: "4.4" - driver-version: "stable" + driver-version: "${{ env.DRIVER_VERSION }}" topology: "replica_set" - os: "ubuntu-20.04" php-version: "8.0" mongodb-version: "4.4" - driver-version: "stable" + driver-version: "${{ env.DRIVER_VERSION }}" topology: "sharded_cluster" steps: diff --git a/composer.json b/composer.json index c8a1ea090..0a6a6503d 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "php": "^7.4 || ^8.0", "ext-hash": "*", "ext-json": "*", - "ext-mongodb": "^1.17.0", + "ext-mongodb": "^1.18.0", "jean85/pretty-package-versions": "^2.0.1", "psr/log": "^1.1.4|^2|^3", "symfony/polyfill-php80": "^1.27", diff --git a/tests/UnifiedSpecTests/retryable-writes/insertOne-serverErrors.json b/tests/UnifiedSpecTests/retryable-writes/insertOne-serverErrors.json index 0d0d639cd..89827fcf3 100644 --- a/tests/UnifiedSpecTests/retryable-writes/insertOne-serverErrors.json +++ b/tests/UnifiedSpecTests/retryable-writes/insertOne-serverErrors.json @@ -165,6 +165,309 @@ ] } ] + }, + { + "description": "RetryableWriteError label is added based on top-level code in pre-4.4 server response", + "runOnRequirements": [ + { + "minServerVersion": "4.2", + "maxServerVersion": "4.2.99", + "topologies": [ + "replicaset", + "sharded" + ] + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 2 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorCode": 189 + } + } + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 3, + "x": 33 + } + }, + "expectError": { + "errorLabelsContain": [ + "RetryableWriteError" + ] + } + } + ], + "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" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "coll", + "databaseName": "retryable-writes-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "RetryableWriteError label is added based on writeConcernError in pre-4.4 mongod response", + "runOnRequirements": [ + { + "minServerVersion": "4.2", + "maxServerVersion": "4.2.99", + "topologies": [ + "replicaset" + ] + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 2 + }, + "data": { + "failCommands": [ + "insert" + ], + "writeConcernError": { + "code": 91, + "errmsg": "Replication is being shut down" + } + } + } + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 3, + "x": 33 + } + }, + "expectError": { + "errorLabelsContain": [ + "RetryableWriteError" + ] + } + } + ], + "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" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "coll", + "databaseName": "retryable-writes-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "RetryableWriteError label is not added based on writeConcernError in pre-4.4 mongos response", + "runOnRequirements": [ + { + "minServerVersion": "4.2", + "maxServerVersion": "4.2.99", + "topologies": [ + "sharded" + ] + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "writeConcernError": { + "code": 91, + "errmsg": "Replication is being shut down" + } + } + } + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 3, + "x": 33 + } + }, + "expectError": { + "errorLabelsOmit": [ + "RetryableWriteError" + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "coll", + "documents": [ + { + "_id": 3, + "x": 33 + } + ] + }, + "commandName": "insert", + "databaseName": "retryable-writes-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "coll", + "databaseName": "retryable-writes-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] } ] }