-
Notifications
You must be signed in to change notification settings - Fork 266
PHPLIB-892: Require crypt_shared and/or mongocryptd for tests utilizing enterprise CSFLE features #1072
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
PHPLIB-892: Require crypt_shared and/or mongocryptd for tests utilizing enterprise CSFLE features #1072
Changes from all commits
35c7bbe
ae8b61c
5d8be5d
96d27b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,8 +24,6 @@ | |
use function getenv; | ||
use function implode; | ||
use function in_array; | ||
use function is_executable; | ||
use function is_readable; | ||
use function is_string; | ||
use function parse_url; | ||
use function PHPUnit\Framework\assertContainsOnly; | ||
|
@@ -42,9 +40,7 @@ | |
use function substr_replace; | ||
use function version_compare; | ||
|
||
use const DIRECTORY_SEPARATOR; | ||
use const FILTER_VALIDATE_BOOLEAN; | ||
use const PATH_SEPARATOR; | ||
|
||
/** | ||
* Unified test runner. | ||
|
@@ -341,6 +337,8 @@ private function isAuthenticated(): bool | |
|
||
/** | ||
* Return whether client-side encryption is supported. | ||
* | ||
* @see FunctionalTestCase::skipIfClientSideEncryptionIsNotSupported() | ||
*/ | ||
private function isClientSideEncryptionSupported(): bool | ||
{ | ||
|
@@ -354,31 +352,7 @@ private function isClientSideEncryptionSupported(): bool | |
return false; | ||
} | ||
|
||
return static::isCryptSharedLibAvailable() || static::isMongocryptdAvailable(); | ||
} | ||
|
||
private static function isCryptSharedLibAvailable(): bool | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @eramongodb, @kevinAlbs: The
The PHPLIB unified test runner currently checks three things:
I realize that the only unified CSFLE tests at the moment are for key management, which isn't an enterprise feature. But ignoring that for a moment and assuming legacy tests will eventually be ported to the unified format, was it your intention that the If yes, then I'd like to clarify this in the unified test spec. If no, then I think we should remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I expect
I think yes. Both "Client-Side Field Level Encryption" and "Queryable Encryption" require libmongocrypt. As of DRIVERS-2454, "In-Use Encryption" can be used to refer to both features. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. I opened mongodb/specifications#1439 and DRIVERS-2661 to update the unified/legacy test docs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
{ | ||
$cryptSharedLibPath = getenv('CRYPT_SHARED_LIB_PATH'); | ||
|
||
if ($cryptSharedLibPath === false) { | ||
return false; | ||
} | ||
|
||
return is_readable($cryptSharedLibPath); | ||
} | ||
|
||
private static function isMongocryptdAvailable(): bool | ||
{ | ||
$paths = explode(PATH_SEPARATOR, getenv("PATH")); | ||
|
||
foreach ($paths as $path) { | ||
if (is_executable($path . DIRECTORY_SEPARATOR . 'mongocryptd')) { | ||
return true; | ||
} | ||
} | ||
|
||
return false; | ||
return FunctionalTestCase::isCryptSharedLibAvailable() || FunctionalTestCase::isMongocryptdAvailable(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is one thing I had in mind when creating PHPLIB-1170. |
||
} | ||
|
||
/** | ||
|
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.
In PHPLIB-892 you wrote:
skipIfClientSideEncryptionIsNotSupported()
doesn't check for either of those things. Did something change since you wrote that comment?Also, in an earlier comment on that issue I pointed out that
DocumentationExamplesTest::testQueryableEncryption()
did requirecrypt_shared
and/ormongocryptd
(since it uses queryable encryption) but the prose test did not (since it explicitly encrypts). You could run the prose tests w/ocrypt_shared
andmongocryptd
to verify that.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.
@GromNaN: In light of mongodb/specifications#1439, I would be in favor of adding a check for
crypt_shared
and/ormongocryptd
to the baseskipIfClientSideEncryptionIsNotSupported()
method.A call to
skipIfClientSideEncryptionIsNotSupported()
could then be used here (after the topology and 7.0+ version check). I'm aware the version check inskipIfClientSideEncryptionIsNotSupported()
would be redundant, but that's OK.You could then also remove the explicit crypt_shared/mongocryptd check in
ClientSideEncryptionSpecTest::setUp()
.With that done,
skipIfClientSideEncryptionIsNotSupported()
would become consistent withUnifiedTestRunner::isClientSideEncryptionSupported()
and all of our tests would perform the same checks.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.
There is a slight difference between the server version check and the feature compatibility version check in
skipIfClientSideEncryptionIsNotSupported
. So this is not redundant.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.
I followed your instructions.
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.
Aye, technically different checks. I said "redundant" as our test suite is never run on mixed-version or upgraded replica sets, so FCV will always equate the server version.