Skip to content

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

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 4 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions tests/UnifiedSpecTests/Operation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Copy link
Member

Choose a reason for hiding this comment

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

Is this needed to allow running upload-disableMD5.yml, which still exists in the upstream repository?

Those tests all assert md5: { $$exists: false }, so I'm not sure what it would matter. Wouldn't PHPLIB 2.x just ignore the option (vs. a possible deprecation notice in 1.x)?

Copy link
Member Author

@GromNaN GromNaN Oct 29, 2024

Choose a reason for hiding this comment

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

v2.x ignore the option.

  • If not set: md5 field is not set
  • If set to false: md5 field is not set ...

In v1.x, we talked about deprecating not setting disableMD5: true, but that was rejected because of the burden of having to set an option for something that is not used.

Copy link
Member

@jmikola jmikola Oct 29, 2024

Choose a reason for hiding this comment

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

I likely misunderstood the point of this change. Is it just being done to satisfy the Util.php check for unsupported options? If so, it'd be helpful to make a note of that in this comment (since I've just demonstrated how likely I am to misunderstand the purpose of this unset() ^_^).

No objections to merging after that.

Copy link
Member Author

Choose a reason for hiding this comment

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

After investigations, disableMD5 option is documented in the spec. So I added the option to the list of allowed options, with a comment.

Copy link
Member Author

@GromNaN GromNaN Oct 30, 2024

Choose a reason for hiding this comment

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

So I restored the option disableMD5 that I removed from the allowed options in #1398. Note that the spec document the option to create a bucket, not to call the upload method.

Copy link
Member

Choose a reason for hiding this comment

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

If spec tests actually use a disableMD5 option for upload operations, I think that's an oversight in the spec itself. The option should probably be added to File Upload with the same note it has on the corresponding bucket option (that it's deprecated and transitional).

Defer to you if that's worth doing at this point.


Util::assertArgumentsBySchema(Bucket::class, $this->name, $args);

switch ($this->name) {
Expand Down
4 changes: 0 additions & 4 deletions tests/UnifiedSpecTests/UnifiedSpecTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
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