-
Notifications
You must be signed in to change notification settings - Fork 266
PHPLIB-1702: Always consult server encryptedFieldsMap when dropping collections #1742
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
base: v2.x
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix looks good, I have some comments on the tests.
$client = static::createTestClient(); | ||
|
||
// Ensure the key vault collection is dropped before each test | ||
$collection = $client->selectCollection('keyvault', 'datakeys', ['writeConcern' => new WriteConcern(WriteConcern::MAJORITY)]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll get used to the new name of this method.
$collection = $client->selectCollection('keyvault', 'datakeys', ['writeConcern' => new WriteConcern(WriteConcern::MAJORITY)]); | |
$collection = $client->getCollection('keyvault', 'datakeys', ['writeConcern' => new WriteConcern(WriteConcern::MAJORITY)]); |
Why do you need to set the writeConcern
, as that doesn't guarantee that all replica are up to date.
$collection->drop(); | ||
|
||
$this->clientEncryption = $client->createClientEncryption([ | ||
'keyVaultNamespace' => 'keyvault.datakeys', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To prevent any typo:
'keyVaultNamespace' => 'keyvault.datakeys', | |
'keyVaultNamespace' => $collection->getNamespace(), |
Otherwise you don't really need the $collection
variable.
|
||
// Ensure the key vault collection is dropped before each test | ||
$collection = $client->selectCollection('keyvault', 'datakeys', ['writeConcern' => new WriteConcern(WriteConcern::MAJORITY)]); | ||
$collection->drop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should also drop this collection in tearDown
.
$client = static::createTestClient(); | ||
|
||
// Ensure the key vault collection is dropped before each test | ||
$collection = $client->selectCollection('keyvault', 'datakeys', ['writeConcern' => new WriteConcern(WriteConcern::MAJORITY)]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$collection = $client->selectCollection('keyvault', 'datakeys', ['writeConcern' => new WriteConcern(WriteConcern::MAJORITY)]); | |
$collection = $client->getCollection('keyvault', 'datakeys', ['writeConcern' => new WriteConcern(WriteConcern::MAJORITY)]); |
{ | ||
protected ClientEncryption $clientEncryption; | ||
|
||
public function setUp(): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both test classes has the same setUp
method. They should probably be a single test class with 2 test methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM, but should this change target v1.21 for a patch release?
https://jira.mongodb.org/browse/PHPLIB-1702