Skip to content
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

Ignore disableMD5 option as md5 field is removed from the spec #1502

Merged
merged 4 commits into from
Nov 7, 2024
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
2 changes: 1 addition & 1 deletion tests/UnifiedSpecTests/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per my earlier comment about no tests using bucketOptions, I doubt this change is required. But if you'd like to keep it, I think it warrants the same comment I suggested below in Util.php so any future reader understands why this option is still here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct, this option is not necessary for the existing spec tests. But it should be allowed according to the spec.

Suggested change
Util::assertHasOnlyKeys($options, ['bucketName', 'chunkSizeBytes', 'disableMD5', 'readConcern', 'readPreference', 'writeConcern']);
Util::assertHasOnlyKeys($options, ['bucketName', 'chunkSizeBytes', 'readConcern', 'readPreference', 'writeConcern']);


if (array_key_exists('bucketName', $options)) {
assertIsString($options['bucketName']);
Expand Down
4 changes: 0 additions & 4 deletions tests/UnifiedSpecTests/UnifiedSpecTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,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',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted that this test was removed in mongodb/specifications@12be2df.

];

/**
Expand Down
5 changes: 3 additions & 2 deletions tests/UnifiedSpecTests/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ final class Util
'download' => ['id'],
'rename' => ['id', 'newFilename'],
'renameByName' => ['filename', 'newFilename'],
'uploadWithId' => ['id', 'filename', 'source', 'chunkSizeBytes', 'metadata'],
'upload' => ['filename', 'source', 'chunkSizeBytes', 'metadata'],
// "disableMD5" is ignored but allowed for backward compatibility
'uploadWithId' => ['id', 'filename', 'source', 'chunkSizeBytes', 'disableMD5', 'metadata'],
GromNaN marked this conversation as resolved.
Show resolved Hide resolved
'upload' => ['filename', 'source', 'chunkSizeBytes', 'disableMD5', 'metadata'],
],
];

Expand Down