Skip to content

Commit 5490c08

Browse files
authored
PHPLIB-768: Spec and prose tests for CSFLE KMIP support (#880)
* Add missing sprintf for UnexpectedValueException message This dates back to f0870fb and a9ab2fc * PHPLIB-768: Spec and prose tests for CSFLE KMIP support Add KMS server on Evergreen for KMIP tests. Synced with mongodb/specifications@f679da7 Temporarily update driver axis for testing against PHPC-1912. * PHPLIB-768 and PHPLIB-639: KMS TLS prose tests
1 parent fef895d commit 5490c08

File tree

11 files changed

+5483
-11
lines changed

11 files changed

+5483
-11
lines changed

Diff for: .evergreen/config.yml

+60-9
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,12 @@ functions:
245245
export AZURE_CLIENT_SECRET="${client_side_encryption_azure_client_secret}"
246246
export GCP_EMAIL="${client_side_encryption_gcp_email}"
247247
export GCP_PRIVATE_KEY="${client_side_encryption_gcp_privatekey}"
248+
export KMIP_ENDPOINT="${client_side_encryption_kmip_endpoint}"
249+
export KMS_ENDPOINT_EXPIRED="${client_side_encryption_kms_endpoint_expired}"
250+
export KMS_ENDPOINT_WRONG_HOST="${client_side_encryption_kms_endpoint_wrong_host}"
251+
export KMS_ENDPOINT_REQUIRE_CLIENT_CERT="${client_side_encryption_kms_endpoint_require_client_cert}"
252+
export KMS_TLS_CA_FILE="${client_side_encryption_kms_tls_ca_file}"
253+
export KMS_TLS_CERTIFICATE_KEY_FILE="${client_side_encryption_kms_tls_certificate_key_file}"
248254
export PATH="${PHP_PATH}/bin:$PATH"
249255
MOCK_SERVICE_ID=${MOCK_SERVICE_ID} API_VERSION=${API_VERSION} PHP_VERSION=${PHP_VERSION} AUTH=${AUTH} SSL=${SSL} MONGODB_URI="${MONGODB_URI}" sh ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
250256
@@ -341,6 +347,42 @@ functions:
341347
${DRIVERS_TOOLS}/.evergreen/run-load-balancer.sh stop
342348
fi
343349
350+
"start kms servers":
351+
- command: shell.exec
352+
# Init venv without background:true to install dependencies
353+
params:
354+
script: |-
355+
set -o errexit
356+
cd ${DRIVERS_TOOLS}/.evergreen/csfle
357+
. ./activate_venv.sh
358+
- command: shell.exec
359+
params:
360+
background: true
361+
# Use different ports for KMS HTTP servers to avoid conflicts with load balancers
362+
script: |-
363+
set -o errexit
364+
cd ${DRIVERS_TOOLS}/.evergreen/csfle
365+
. ./activate_venv.sh
366+
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/expired.pem --port 8100 &
367+
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/wrong-host.pem --port 8101 &
368+
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --port 8102 --require_client_cert &
369+
python -u kms_kmip_server.py --port 5698 &
370+
- command: expansions.update
371+
params:
372+
updates:
373+
- key: client_side_encryption_kms_tls_ca_file
374+
value: ${DRIVERS_TOOLS}/.evergreen/x509gen/ca.pem
375+
- key: client_side_encryption_kms_tls_certificate_key_file
376+
value: ${DRIVERS_TOOLS}/.evergreen/x509gen/client.pem
377+
- key: client_side_encryption_kms_endpoint_expired
378+
value: 127.0.0.1:8100
379+
- key: client_side_encryption_kms_endpoint_wrong_host
380+
value: 127.0.0.1:8101
381+
- key: client_side_encryption_kms_endpoint_require_client_cert
382+
value: 127.0.0.1:8102
383+
- key: client_side_encryption_kmip_endpoint
384+
value: localhost:5698
385+
344386
pre:
345387
- func: "fetch source"
346388
- func: "prepare resources"
@@ -397,6 +439,7 @@ tasks:
397439
- func: "bootstrap mongo-orchestration"
398440
vars:
399441
TOPOLOGY: "server"
442+
- func: "start kms servers"
400443
- func: "run tests"
401444

402445
- name: "test-replica_set"
@@ -405,6 +448,7 @@ tasks:
405448
- func: "bootstrap mongo-orchestration"
406449
vars:
407450
TOPOLOGY: "replica_set"
451+
- func: "start kms servers"
408452
- func: "run tests"
409453

410454
- name: "test-sharded_cluster"
@@ -413,6 +457,7 @@ tasks:
413457
- func: "bootstrap mongo-orchestration"
414458
vars:
415459
TOPOLOGY: "sharded_cluster"
460+
- func: "start kms servers"
416461
- func: "run tests"
417462

418463
- name: "test-atlas-data-lake"
@@ -428,6 +473,7 @@ tasks:
428473
TOPOLOGY: "server"
429474
AUTH: "auth"
430475
REQUIRE_API_VERSION: "yes"
476+
- func: "start kms servers"
431477
- func: "run tests"
432478
vars:
433479
API_VERSION: "1"
@@ -439,6 +485,7 @@ tasks:
439485
vars:
440486
TOPOLOGY: "server"
441487
ORCHESTRATION_FILE: "versioned-api-testing.json"
488+
- func: "start kms servers"
442489
- func: "run tests"
443490
vars:
444491
TESTS: "versioned-api"
@@ -460,6 +507,7 @@ tasks:
460507
TOPOLOGY: "sharded_cluster"
461508
SSL: "yes"
462509
- func: "start load balancer"
510+
- func: "start kms servers"
463511
- func: "run tests"
464512
vars:
465513
# Testing with HAProxy requires service ID mocking
@@ -561,20 +609,21 @@ axes:
561609
- id: driver-versions
562610
display_name: Driver Version
563611
values:
612+
# TODO: Update references to master branch after PHPC 1.12 is released
564613
- id: "lowest-supported"
565-
display_name: "1.11.0"
614+
# display_name: "1.11.0"
615+
display_name: "1.12-dev"
566616
variables:
567-
EXTENSION_VERSION: "1.11.0"
617+
EXTENSION_BRANCH: "master"
568618
- id: "latest-stable"
569-
display_name: "Latest Stable (1.11.x)"
570-
variables:
571-
EXTENSION_VERSION: "stable"
572-
- id: "upcoming-stable"
573-
display_name: "1.11-dev"
619+
# display_name: "Latest Stable (1.11.x)"
620+
display_name: "1.12-dev"
574621
variables:
575-
EXTENSION_BRANCH: "v1.11"
622+
# EXTENSION_VERSION: "stable"
623+
EXTENSION_BRANCH: "master"
576624
- id: "latest-dev"
577-
display_name: "1.12-dev (master)"
625+
# display_name: "1.12-dev (master)"
626+
display_name: "1.12-dev"
578627
variables:
579628
EXTENSION_BRANCH: "master"
580629

@@ -684,7 +733,9 @@ buildvariants:
684733
matrix_spec: { "os": "ubuntu1804-arm64-test", "edge-versions": "latest-stable", "php-versions": "*", "driver-versions": "*" }
685734
exclude_spec:
686735
# Avoid duplicate build variants from test-php-versions
736+
- { "os": "ubuntu1804-arm64-test", "edge-versions": "latest-stable", "php-versions": "*", "driver-versions": "lowest-supported" }
687737
- { "os": "ubuntu1804-arm64-test", "edge-versions": "latest-stable", "php-versions": "*", "driver-versions": "latest-stable" }
738+
- { "os": "ubuntu1804-arm64-test", "edge-versions": "latest-stable", "php-versions": "*", "driver-versions": "latest-dev" }
688739
display_name: "${os}, MongoDB ${edge-versions}, PHP ${php-versions}, ext-mongodb ${driver-versions}"
689740
tasks:
690741
- name: "test-standalone"

Diff for: .evergreen/run-tests.sh

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ if [ "${IS_MATRIX_TESTING}" = "true" ]; then
4343
. $DIR/install-dependencies.sh
4444
fi
4545

46+
# Enable verbose output to see skipped and incomplete tests
47+
PHPUNIT_OPTS="${PHPUNIT_OPTS} -v"
48+
4649
# For load balancer testing, we need to enable service ID mocking
4750
if [ "${MOCK_SERVICE_ID}" = "1" ]; then
4851
PHPUNIT_OPTS="${PHPUNIT_OPTS} -d mongodb.mock_service_id=1"

0 commit comments

Comments
 (0)