Skip to content

PHPLIB-820: Key Management API spec tests #957

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 12 commits into from
Aug 23, 2022
Merged

Conversation

jmikola
Copy link
Member

@jmikola jmikola commented Aug 10, 2022

https://jira.mongodb.org/browse/PHPLIB-820
https://jira.mongodb.org/browse/PHPLIB-929

Depends on mongodb/mongo-php-driver#1339, but I'd rather not update the CI configs to temporarily test against my fork. Feel free to review the code for now and hold off on examining CI results.

@jmikola jmikola marked this pull request as ready for review August 17, 2022 18:07
@jmikola jmikola requested review from alcaeus and levon80999 August 17, 2022 18:07
@jmikola jmikola changed the title PHPC-2093: Key Management API spec tests PHPLIB-820: Key Management API spec tests Aug 17, 2022
Comment on lines +368 to +370
if (FunctionalTestCase::getModuleInfo('libmongocrypt') === 'disabled') {
return false;
}
Copy link
Member

Choose a reason for hiding this comment

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

Nit: this could also be extracted to a isDriverWithMongocrypt or something similar.

Copy link
Member Author

Choose a reason for hiding this comment

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

Noted. I opted not to do so since it's a one-liner and only called from this context.

I had FunctionalTestCase::skipIfClientSideEncryptionIsNotSupported() in mind when writing this.

$clientEncryptionOpts['keyVaultClient'] = $this->entityMap->getClient($clientId)->getManager();
}

if (isset($clientEncryptionOpts['kmsProviders'])) {
Copy link
Member

Choose a reason for hiding this comment

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

Noting for the benefit of @levon80999 and others that may want to run these tests: I suggest defining these secrets in a phpunit.xml file based on phpunit.xml.dist. This file takes precedence over the dist file and is in gitignore, allowing your own configuration to be added.

Copy link
Member Author

Choose a reason for hiding this comment

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

This was actually helpful for me as well. I was previously using a shell script to export the environment variables before calling vendor/bin/simple-phpunit, but phpunit.xml is much nicer.

This is particularly relevant for kmsProviders tests, which may need to be skipped according to runOnRequirements.csfle
This was causing a test failure for PHP versions before 8.0
@jmikola
Copy link
Member Author

jmikola commented Aug 22, 2022

@alcaeus: Looking at the CI failures, most pertain to the change stream spec tests and a yet-to-be-synced CSFLE spec test (PHPLIB-930). The actual spec and prose tests from this PR are passing after my most recent fixed for the "valid-fail" tests (72af6d9), and removal of a trailing comma (e8e2405).

I'll wait for one last thumbs up from you before merging down.

Copy link
Member

@alcaeus alcaeus left a comment

Choose a reason for hiding this comment

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

LGTM!

@jmikola jmikola merged commit 5d48a1e into mongodb:master Aug 23, 2022
@jmikola jmikola deleted the phpc-2093 branch August 23, 2022 20:45
levon80999 pushed a commit to levon80999/mongo-php-library that referenced this pull request Sep 28, 2022
* Unified spec and prose tests for CSFLE key management API

Support runOnRequirement.csfle, clientEncryption entity/operations, and $$placeholder syntax

Synced with mongodb/specifications@10b4a41

* Note ClientEncryption's parent client to ensure events are observed

* Set ClientEncryption tlsOptions when KMIP endpoint is used

* PHPLIB-929: Prose test for rewrapManyDataKey

* Do not consider SkippedTest exceptions as errors for valid-fail tests

This is particularly relevant for kmsProviders tests, which may need to be skipped according to runOnRequirements.csfle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants