From 3317992d27691a40195b01ae1c69a325f70bf0b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Tue, 29 Oct 2024 09:27:37 +0100 Subject: [PATCH 1/3] Ignore disableMD5 option as "md5" field is removed from the spec --- tests/UnifiedSpecTests/Operation.php | 4 ++++ tests/UnifiedSpecTests/UnifiedSpecTest.php | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/UnifiedSpecTests/Operation.php b/tests/UnifiedSpecTests/Operation.php index 63ca8fcd9..2ed73262d 100644 --- a/tests/UnifiedSpecTests/Operation.php +++ b/tests/UnifiedSpecTests/Operation.php @@ -769,6 +769,10 @@ private function executeForSession(Session $session) private function executeForBucket(Bucket $bucket) { $args = $this->prepareArguments(); + + // "md5" field is removed from the spec, option "disableMD5" is ignored + unset($args['disableMD5']); + Util::assertArgumentsBySchema(Bucket::class, $this->name, $args); switch ($this->name) { diff --git a/tests/UnifiedSpecTests/UnifiedSpecTest.php b/tests/UnifiedSpecTests/UnifiedSpecTest.php index 39d893e3d..46ce8adbe 100644 --- a/tests/UnifiedSpecTests/UnifiedSpecTest.php +++ b/tests/UnifiedSpecTests/UnifiedSpecTest.php @@ -64,10 +64,6 @@ class UnifiedSpecTest extends FunctionalTestCase 'index-management/search index operations ignore read and write concern: listSearchIndexes ignores read and write concern' => 'libmongoc appends readConcern to aggregate command', // Uses an invalid object name 'run-command/runCursorCommand: does not close the cursor when receiving an empty batch' => 'Uses an invalid object name', - // GridFS deprecated fields are removed - 'gridfs/gridfs-upload-disableMD5: upload when length is 0 sans MD5' => 'Deprecated fields are removed', - 'gridfs/gridfs-upload-disableMD5: upload when length is 1 sans MD5' => 'Deprecated fields are removed', - 'gridfs/gridfs-upload: upload when contentType is provided' => 'Deprecated fields are removed', ]; /** From 2cd6387f07ef6516758dee67de8ea26a08b9bc70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Wed, 30 Oct 2024 08:25:57 +0100 Subject: [PATCH 2/3] disableMD5 option is allowed in the spec, but ignored --- tests/UnifiedSpecTests/Context.php | 4 ++-- tests/UnifiedSpecTests/Operation.php | 4 ---- tests/UnifiedSpecTests/Util.php | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/UnifiedSpecTests/Context.php b/tests/UnifiedSpecTests/Context.php index 6b57a8130..cf93a930d 100644 --- a/tests/UnifiedSpecTests/Context.php +++ b/tests/UnifiedSpecTests/Context.php @@ -463,7 +463,7 @@ private function createSession(string $id, stdClass $o): void private function createBucket(string $id, stdClass $o): void { - Util::assertHasOnlyKeys($o, ['id', 'database', 'bucketOptions']); + Util::assertHasOnlyKeys($o, ['id', 'database', 'bucketOptions', 'disableMD5']); $databaseId = $o->database ?? null; assertIsString($databaseId); @@ -499,7 +499,7 @@ private static function prepareCollectionOrDatabaseOptions(array $options): arra private static function prepareBucketOptions(array $options): array { - Util::assertHasOnlyKeys($options, ['bucketName', 'chunkSizeBytes', 'readConcern', 'readPreference', 'writeConcern']); + Util::assertHasOnlyKeys($options, ['bucketName', 'chunkSizeBytes', 'disableMD5', 'readConcern', 'readPreference', 'writeConcern']); if (array_key_exists('bucketName', $options)) { assertIsString($options['bucketName']); diff --git a/tests/UnifiedSpecTests/Operation.php b/tests/UnifiedSpecTests/Operation.php index 2ed73262d..63ca8fcd9 100644 --- a/tests/UnifiedSpecTests/Operation.php +++ b/tests/UnifiedSpecTests/Operation.php @@ -769,10 +769,6 @@ private function executeForSession(Session $session) private function executeForBucket(Bucket $bucket) { $args = $this->prepareArguments(); - - // "md5" field is removed from the spec, option "disableMD5" is ignored - unset($args['disableMD5']); - Util::assertArgumentsBySchema(Bucket::class, $this->name, $args); switch ($this->name) { diff --git a/tests/UnifiedSpecTests/Util.php b/tests/UnifiedSpecTests/Util.php index f33522a31..f725c5bc0 100644 --- a/tests/UnifiedSpecTests/Util.php +++ b/tests/UnifiedSpecTests/Util.php @@ -134,8 +134,8 @@ final class Util 'delete' => ['id'], 'downloadByName' => ['filename', 'revision'], 'download' => ['id'], - 'uploadWithId' => ['id', 'filename', 'source', 'chunkSizeBytes', 'metadata'], - 'upload' => ['filename', 'source', 'chunkSizeBytes', 'metadata'], + 'uploadWithId' => ['id', 'filename', 'source', 'chunkSizeBytes', 'disableMD5', 'metadata'], + 'upload' => ['filename', 'source', 'chunkSizeBytes', 'disableMD5', 'metadata'], ], ]; From f8b4e79678ff578268fbba3a5fbf6cf195e82db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Mon, 4 Nov 2024 14:54:22 +0100 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: Jeremy Mikola --- tests/UnifiedSpecTests/Context.php | 2 +- tests/UnifiedSpecTests/Util.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/UnifiedSpecTests/Context.php b/tests/UnifiedSpecTests/Context.php index cf93a930d..40ab0c5cc 100644 --- a/tests/UnifiedSpecTests/Context.php +++ b/tests/UnifiedSpecTests/Context.php @@ -463,7 +463,7 @@ private function createSession(string $id, stdClass $o): void private function createBucket(string $id, stdClass $o): void { - Util::assertHasOnlyKeys($o, ['id', 'database', 'bucketOptions', 'disableMD5']); + Util::assertHasOnlyKeys($o, ['id', 'database', 'bucketOptions']); $databaseId = $o->database ?? null; assertIsString($databaseId); diff --git a/tests/UnifiedSpecTests/Util.php b/tests/UnifiedSpecTests/Util.php index f725c5bc0..49ec40ee3 100644 --- a/tests/UnifiedSpecTests/Util.php +++ b/tests/UnifiedSpecTests/Util.php @@ -134,6 +134,7 @@ final class Util 'delete' => ['id'], 'downloadByName' => ['filename', 'revision'], 'download' => ['id'], + // "disableMD5" is ignored but allowed for backward compatibility 'uploadWithId' => ['id', 'filename', 'source', 'chunkSizeBytes', 'disableMD5', 'metadata'], 'upload' => ['filename', 'source', 'chunkSizeBytes', 'disableMD5', 'metadata'], ],